using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using MxAhg.Shared; using Peak.Network; using Photon.Pun; using Photon.Realtime; using Steamworks; using UnityEngine; using Zorro.Core; using Zorro.Core.Serizalization; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MxAhg.Shared { internal static class Protocol { public const byte EventCode = 172; public const string Magic = "MX_AHG"; public const int Version = 1; public const int CommandChallenge = 1; public const int CommandReport = 2; public const string AgentVersionKey = "mxahg_v"; public const string ProtocolKey = "mxahg_p"; public const string FileSignatureKey = "mxahg_s"; public const string FileCountKey = "mxahg_c"; public const string LoadedSignatureKey = "mxahg_l"; public const string LoadedCountKey = "mxahg_lc"; public const string HeartbeatKey = "mxahg_h"; public const string SelfHashKey = "mxahg_i"; public const int MaxFiles = 512; public const int MaxPlugins = 256; public const int MaxHarmonyOwners = 256; public static string Short(string value, int length = 16) { if (string.IsNullOrWhiteSpace(value)) { return "?"; } if (value.Length > length) { return value.Substring(0, length); } return value; } public static string HashFile(string path) { using SHA256 sHA = SHA256.Create(); using FileStream inputStream = File.OpenRead(path); return ToHex(sHA.ComputeHash(inputStream)); } public static string HashText(string value) { using SHA256 sHA = SHA256.Create(); return ToHex(sHA.ComputeHash(Encoding.UTF8.GetBytes(value ?? ""))); } public static string ComputeProof(string nonce, Snapshot snapshot) { if (snapshot == null) { return ""; } return HashText(nonce + "|" + snapshot.FileSignature + "|" + snapshot.LoadedSignature + "|" + snapshot.SelfHash + "|" + (snapshot.Truncated ? "1" : "0") + "|" + snapshot.Error + "|" + snapshot.BuildCanonical()); } public static string[] ToFlatFiles(IReadOnlyList entries) { if (entries == null || entries.Count == 0) { return Array.Empty(); } string[] array = new string[entries.Count * 4]; for (int i = 0; i < entries.Count; i++) { int num = i * 4; array[num] = entries[i].RelativePath ?? ""; array[num + 1] = entries[i].Sha256 ?? ""; array[num + 2] = entries[i].AssemblyName ?? ""; array[num + 3] = entries[i].AssemblyVersion ?? ""; } return array; } public static string[] ToFlatPlugins(IReadOnlyList entries) { if (entries == null || entries.Count == 0) { return Array.Empty(); } string[] array = new string[entries.Count * 5]; for (int i = 0; i < entries.Count; i++) { int num = i * 5; array[num] = entries[i].Guid ?? ""; array[num + 1] = entries[i].Name ?? ""; array[num + 2] = entries[i].Version ?? ""; array[num + 3] = entries[i].RelativePath ?? ""; array[num + 4] = entries[i].Sha256 ?? ""; } return array; } public static List ParseFiles(object value) { string[] array = ReadStringArray(value); List list = new List(); int num = Math.Min(array.Length / 4, 512); for (int i = 0; i < num; i++) { int num2 = i * 4; list.Add(new FileEntry { RelativePath = Limit(array[num2], 320), Sha256 = Limit(array[num2 + 1], 64), AssemblyName = Limit(array[num2 + 2], 160), AssemblyVersion = Limit(array[num2 + 3], 80) }); } return list; } public static List ParsePlugins(object value) { string[] array = ReadStringArray(value); List list = new List(); int num = Math.Min(array.Length / 5, 256); for (int i = 0; i < num; i++) { int num2 = i * 5; list.Add(new PluginEntry { Guid = Limit(array[num2], 180), Name = Limit(array[num2 + 1], 180), Version = Limit(array[num2 + 2], 80), RelativePath = Limit(array[num2 + 3], 320), Sha256 = Limit(array[num2 + 4], 64) }); } return list; } public static string[] ReadStringArray(object value) { if (value is string[] result) { return result; } if (value is object[] array) { int num = Math.Min(array.Length, 2560); string[] array2 = new string[num]; for (int i = 0; i < num; i++) { array2[i] = array[i]?.ToString() ?? ""; } return array2; } return Array.Empty(); } public static string Limit(string value, int maxLength) { if (string.IsNullOrEmpty(value)) { return ""; } if (value.Length > maxLength) { return value.Substring(0, maxLength); } return value; } private static string ToHex(byte[] bytes) { StringBuilder stringBuilder = new StringBuilder(bytes.Length * 2); for (int i = 0; i < bytes.Length; i++) { stringBuilder.Append(bytes[i].ToString("x2")); } return stringBuilder.ToString(); } } internal sealed class FileEntry { public string RelativePath = ""; public string Sha256 = ""; public string AssemblyName = ""; public string AssemblyVersion = ""; } internal sealed class PluginEntry { public string Guid = ""; public string Name = ""; public string Version = ""; public string RelativePath = ""; public string Sha256 = ""; } internal sealed class Snapshot { public readonly List Files = new List(); public readonly List Plugins = new List(); public readonly List HarmonyOwners = new List(); public string FileSignature = ""; public string LoadedSignature = ""; public string SelfHash = ""; public string Error = ""; public bool Truncated; public void Recalculate() { Files.Sort((FileEntry a, FileEntry b) => string.Compare(a.RelativePath, b.RelativePath, StringComparison.OrdinalIgnoreCase)); Plugins.Sort((PluginEntry a, PluginEntry b) => string.Compare(a.Guid, b.Guid, StringComparison.OrdinalIgnoreCase)); HarmonyOwners.Sort(StringComparer.OrdinalIgnoreCase); FileSignature = Protocol.HashText(BuildFileCanonical()); LoadedSignature = Protocol.HashText(BuildLoadedCanonical()); } public string BuildCanonical() { return BuildFileCanonical() + "\n--loaded--\n" + BuildLoadedCanonical(); } private string BuildFileCanonical() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < Files.Count; i++) { AppendField(stringBuilder, Files[i].RelativePath.ToLowerInvariant()); AppendField(stringBuilder, Files[i].Sha256.ToLowerInvariant()); AppendField(stringBuilder, Files[i].AssemblyName.ToLowerInvariant()); AppendField(stringBuilder, Files[i].AssemblyVersion); stringBuilder.Append('\n'); } return stringBuilder.ToString(); } private string BuildLoadedCanonical() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < Plugins.Count; i++) { AppendField(stringBuilder, Plugins[i].Guid.ToLowerInvariant()); AppendField(stringBuilder, Plugins[i].Name.ToLowerInvariant()); AppendField(stringBuilder, Plugins[i].Version); AppendField(stringBuilder, Plugins[i].RelativePath.ToLowerInvariant()); AppendField(stringBuilder, Plugins[i].Sha256.ToLowerInvariant()); stringBuilder.Append('\n'); } stringBuilder.Append("owners\n"); for (int j = 0; j < HarmonyOwners.Count; j++) { AppendField(stringBuilder, HarmonyOwners[j].ToLowerInvariant()); } return stringBuilder.ToString(); } private static void AppendField(StringBuilder sb, string value) { value = value ?? ""; sb.Append(value.Length).Append(':').Append(value) .Append('|'); } } internal static class Scanner { public const string AgentGuid = "com.maxkir041.mxahg"; public const string PeakMxGuid = "com.maxkir041.peakmx"; public static Snapshot Scan(string selfAssemblyPath, bool excludePeakMx = false) { Snapshot snapshot = new Snapshot(); List list = new List(); string text = Paths.PluginPath; if (string.IsNullOrWhiteSpace(text) || !Directory.Exists(text)) { text = Path.GetDirectoryName(selfAssemblyPath) ?? ""; } try { if (!string.IsNullOrWhiteSpace(selfAssemblyPath) && File.Exists(selfAssemblyPath)) { snapshot.SelfHash = Protocol.HashFile(selfAssemblyPath); } } catch (Exception ex) { list.Add("self: " + ex.Message); } try { string[] array = (Directory.Exists(text) ? Directory.GetFiles(text, "*.dll", SearchOption.AllDirectories) : Array.Empty()); Array.Sort(array, (IComparer?)StringComparer.OrdinalIgnoreCase); for (int i = 0; i < array.Length; i++) { if (snapshot.Files.Count >= 512) { snapshot.Truncated = true; break; } if (ShouldExcludeFile(Path.GetFileName(array[i]), excludePeakMx)) { continue; } try { AssemblyName assemblyName = null; try { assemblyName = AssemblyName.GetAssemblyName(array[i]); } catch { } snapshot.Files.Add(new FileEntry { RelativePath = RelativePath(text, array[i]), Sha256 = Protocol.HashFile(array[i]), AssemblyName = (assemblyName?.Name ?? Path.GetFileNameWithoutExtension(array[i])), AssemblyVersion = (assemblyName?.Version?.ToString() ?? "") }); } catch (Exception ex2) { list.Add(Path.GetFileName(array[i]) + ": " + ex2.Message); } } } catch (Exception ex3) { list.Add("files: " + ex3.Message); } try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { if (snapshot.Plugins.Count >= 256) { snapshot.Truncated = true; break; } PluginInfo value = pluginInfo.Value; object obj2; if (value == null) { obj2 = null; } else { BepInPlugin metadata = value.Metadata; obj2 = ((metadata != null) ? metadata.GUID : null); } if (obj2 == null) { obj2 = pluginInfo.Key ?? ""; } string guid = (string)obj2; if (ShouldExcludePlugin(guid, excludePeakMx)) { continue; } string text2 = ((value != null) ? value.Location : null) ?? ""; string sha = ""; try { if (File.Exists(text2)) { sha = Protocol.HashFile(text2); } } catch { } List plugins = snapshot.Plugins; PluginEntry obj4 = new PluginEntry { Guid = guid }; object obj5; if (value == null) { obj5 = null; } else { BepInPlugin metadata2 = value.Metadata; obj5 = ((metadata2 != null) ? metadata2.Name : null); } if (obj5 == null) { obj5 = ""; } obj4.Name = (string)obj5; object obj6; if (value == null) { obj6 = null; } else { BepInPlugin metadata3 = value.Metadata; obj6 = ((metadata3 == null) ? null : metadata3.Version?.ToString()); } if (obj6 == null) { obj6 = ""; } obj4.Version = (string)obj6; obj4.RelativePath = RelativePath(text, text2); obj4.Sha256 = sha; plugins.Add(obj4); } } catch (Exception ex4) { list.Add("plugins: " + ex4.Message); } try { HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (MethodBase allPatchedMethod in Harmony.GetAllPatchedMethods()) { Patches patchInfo = Harmony.GetPatchInfo(allPatchedMethod); if (((patchInfo != null) ? patchInfo.Owners : null) == null) { continue; } foreach (string owner in patchInfo.Owners) { if (!string.IsNullOrWhiteSpace(owner) && !ShouldExcludePlugin(owner, excludePeakMx) && !IsUnstableHarmonyOwner(owner)) { hashSet.Add(owner); } } } foreach (string item in hashSet) { if (snapshot.HarmonyOwners.Count >= 256) { snapshot.Truncated = true; break; } snapshot.HarmonyOwners.Add(item); } } catch (Exception ex5) { list.Add("harmony: " + ex5.Message); } snapshot.Error = string.Join("; ", list.ToArray()); snapshot.Recalculate(); return snapshot; } public static bool IsTechnicalFile(string path) { string fileName = Path.GetFileName(path ?? ""); if (!string.Equals(fileName, "MX-AHG.dll", StringComparison.OrdinalIgnoreCase)) { return string.Equals(fileName, "PEAK-MX.dll", StringComparison.OrdinalIgnoreCase); } return true; } public static bool IsTechnicalPlugin(string guid) { if (!string.Equals(guid, "com.maxkir041.mxahg", StringComparison.OrdinalIgnoreCase)) { return string.Equals(guid, "com.maxkir041.peakmx", StringComparison.OrdinalIgnoreCase); } return true; } public static bool IsUnstableHarmonyOwner(string owner) { if (!string.IsNullOrWhiteSpace(owner)) { return owner.StartsWith("harmony-auto-", StringComparison.OrdinalIgnoreCase); } return false; } private static bool ShouldExcludeFile(string fileName, bool excludePeakMx) { if (string.Equals(fileName, "MX-AHG.dll", StringComparison.OrdinalIgnoreCase)) { return true; } if (excludePeakMx) { return string.Equals(fileName, "PEAK-MX.dll", StringComparison.OrdinalIgnoreCase); } return false; } private static bool ShouldExcludePlugin(string guid, bool excludePeakMx) { if (string.Equals(guid, "com.maxkir041.mxahg", StringComparison.OrdinalIgnoreCase)) { return true; } if (excludePeakMx) { return string.Equals(guid, "com.maxkir041.peakmx", StringComparison.OrdinalIgnoreCase); } return false; } private static string RelativePath(string root, string file) { if (string.IsNullOrWhiteSpace(file)) { return ""; } try { Uri uri = new Uri(AppendSlash(Path.GetFullPath(root))); Uri uri2 = new Uri(Path.GetFullPath(file)); return Uri.UnescapeDataString(uri.MakeRelativeUri(uri2).ToString()).Replace('/', Path.DirectorySeparatorChar); } catch { return Path.GetFileName(file); } } private static string AppendSlash(string value) { char directorySeparatorChar = Path.DirectorySeparatorChar; if (!value.EndsWith(directorySeparatorChar.ToString(), StringComparison.Ordinal)) { directorySeparatorChar = Path.AltDirectorySeparatorChar; if (!value.EndsWith(directorySeparatorChar.ToString(), StringComparison.Ordinal)) { directorySeparatorChar = Path.DirectorySeparatorChar; return value + directorySeparatorChar; } } return value; } } } namespace PeakMX { internal static class AntiCheat { private const string EnabledKey = "pmx_ac"; private const string LockClientsKey = "pmx_ac_lock"; private const string HostActorKey = "pmx_ac_host"; private const string HostVersionKey = "pmx_ac_ver"; private static float _nextPublish; private static bool _lastPublishedEnabled; private static bool _hostEnabled; private static bool _hostLocksClients; private static int _hostActor; private static string _hostVersion = ""; private static int _lastLockNoticeHostActor = int.MinValue; private static bool _wasMasterClient; public static bool HostEnabled => _hostEnabled; public static bool HostLocksClients => _hostLocksClients; public static int HostActor => _hostActor; public static string HostVersion => _hostVersion; public static bool ClientToolsLocked { get { try { return PhotonNetwork.InRoom && _hostEnabled && _hostLocksClients && !PhotonNetwork.IsMasterClient; } catch { return false; } } } public static void Tick() { try { if (!PhotonNetwork.InRoom) { _hostEnabled = false; _hostLocksClients = false; _hostActor = 0; _hostVersion = ""; _nextPublish = 0f; _lastPublishedEnabled = false; _lastLockNoticeHostActor = int.MinValue; _wasMasterClient = false; return; } ReadRoomState(); bool isMasterClient = PhotonNetwork.IsMasterClient; bool flag = isMasterClient && !_wasMasterClient; _wasMasterClient = isMasterClient; if (isMasterClient) { if (flag) { AdoptInheritedRoomPolicy(); } ApplyHostMasterSwitch(); PublishHostState(); } if (ClientToolsLocked) { DisableRestrictedLocalTools(); } else { _lastLockNoticeHostActor = int.MinValue; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[AntiCheat] " + ex.Message)); } } } public static void SetHostEnabled(bool enabled) { ModConfig.AntiCheatEnabled = enabled; ModConfig.AdminProtectionEnabled = enabled; ApplyHostMasterSwitch(); _nextPublish = 0f; PublishHostState(); } public static string StatusText(Lang lang) { if (!PhotonNetwork.InRoom) { return Localization.Pick(lang, "Античит активируется в комнате.", "Anti-cheat becomes active inside a room.", "反作弊会在房间内启用。", "反作弊會在房間內啟用。"); } if (PhotonNetwork.IsMasterClient) { if (!ModConfig.AntiCheatEnabled) { return Localization.Pick(lang, "Античит хоста выключен.", "Host anti-cheat is disabled.", "房主反作弊已关闭。", "房主反作弊已關閉。"); } return Localization.Pick(lang, "Античит хоста включён.", "Host anti-cheat is enabled.", "房主反作弊已启用。", "房主反作弊已啟用。"); } if (_hostEnabled) { if (!_hostLocksClients) { return Localization.Pick(lang, "Хост включил античит без блокировки клиентских инструментов.", "The host enabled anti-cheat without locking client tools.", "房主启用了反作弊,但未锁定客户端工具。", "房主啟用了反作弊,但未鎖定用戶端工具。"); } return Localization.Pick(lang, "Хост включил античит. Инструменты PEAK-MX на клиентах заблокированы.", "The host enabled anti-cheat. PEAK-MX tools are locked on clients.", "房主启用了反作弊。客户端 PEAK-MX 工具已锁定。", "房主啟用了反作弊。用戶端 PEAK-MX 工具已鎖定。"); } return Localization.Pick(lang, "Хост не включал античит.", "The host has not enabled anti-cheat.", "房主未启用反作弊。", "房主未啟用反作弊。"); } public static void DisableRestrictedLocalTools() { ModConfig.SpeedMod = false; ModConfig.JumpMod = false; ModConfig.InfiniteJumps = false; ModConfig.ClimbMod = false; ModConfig.VineClimbMod = false; ModConfig.RopeClimbMod = false; ModConfig.GodMode = false; ModConfig.InfiniteStamina = false; ModConfig.NoFallDamage = false; ModConfig.NoFallingRagdoll = false; ModConfig.NoWeight = false; ModConfig.LockStatus = false; ModConfig.NoStatusEffects = false; ModConfig.NoInjury = false; ModConfig.NoHunger = false; ModConfig.NoCold = false; ModConfig.NoPoison = false; ModConfig.NoCurse = false; ModConfig.NoDrowsy = false; ModConfig.NoHot = false; ModConfig.NoCrab = false; ModConfig.NoThorns = false; ModConfig.NoSpores = false; ModConfig.NoWeb = false; ModConfig.NoArrows = false; ModConfig.NoPetrify = false; ModConfig.NoFlyTrap = false; ModConfig.TeleportToPing = false; ModConfig.NoSlipperySurfaces = false; ModConfig.LongInteraction = false; ModConfig.CinematicCamera = false; ModConfig.GlobalVoice = false; ModConfig.PlayerEsp = false; ModConfig.ItemEsp = false; if (ModConfig.WorldEsp != null) { ModConfig.WorldEsp.Value = false; } ModConfig.GameSpeedMod = false; ModConfig.PingHandSizeMultiplier = 1f; ModConfig.OverrideExpeditionTime = false; ModConfig.Fly = false; ModConfig.Noclip = false; ModConfig.InfiniteItems = false; ModConfig.UnlimitedLanternFuel = false; ModConfig.UnlimitedItemUses = false; ModConfig.RapidRandomOutfitColor = false; int num = ((_hostActor > 0) ? _hostActor : (-1)); if (_lastLockNoticeHostActor != num) { _lastLockNoticeHostActor = num; GameApi.AddAdminLog((Localization.Current == Lang.Russian) ? "anti-cheat: клиентские инструменты заблокированы хостом" : "anti-cheat: client tools locked by host", showNotice: false); } } private static void ApplyHostMasterSwitch() { if (ModConfig.AntiCheatEnabled) { if (ModConfig.ManyPlayersPluginAudit != null) { ModConfig.ManyPlayersPluginAudit.Value = false; } if (ModConfig.ManyPlayersPluginAuditKick != null) { ModConfig.ManyPlayersPluginAuditKick.Value = false; } } ModConfig.AdminProtectionEnabled = ModConfig.AntiCheatEnabled; } private static void AdoptInheritedRoomPolicy() { if (_hostEnabled && !ModConfig.AntiCheatEnabled) { ModConfig.AntiCheatEnabled = true; ModConfig.AdminProtectionEnabled = true; if (ModConfig.AntiCheatLockClients != null) { ModConfig.AntiCheatLockClients.Value = _hostLocksClients; } GameApi.AddAdminLog((Localization.Current == Lang.Russian) ? "anti-cheat: политика комнаты унаследована новым хостом" : "anti-cheat: room policy inherited by the new host"); } } private static void PublishHostState() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && PhotonNetwork.CurrentRoom != null) { bool antiCheatEnabled = ModConfig.AntiCheatEnabled; if (antiCheatEnabled != _lastPublishedEnabled || !(Time.realtimeSinceStartup < _nextPublish)) { _nextPublish = Time.realtimeSinceStartup + 2f; _lastPublishedEnabled = antiCheatEnabled; Hashtable val = new Hashtable { [(object)"pmx_ac"] = antiCheatEnabled, [(object)"pmx_ac_lock"] = ModConfig.AntiCheatLockClients == null || ModConfig.AntiCheatLockClients.Value, [(object)"pmx_ac_host"] = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0), [(object)"pmx_ac_ver"] = "1.1.2" }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); _hostEnabled = antiCheatEnabled; _hostLocksClients = ModConfig.AntiCheatLockClients == null || ModConfig.AntiCheatLockClients.Value; _hostActor = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0); _hostVersion = "1.1.2"; } } } private static void ReadRoomState() { try { Room currentRoom = PhotonNetwork.CurrentRoom; if (((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null) == null) { return; } Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; bool flag = default(bool); int num; if (((Dictionary)(object)customProperties).TryGetValue((object)"pmx_ac", out object value)) { if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } } else { num = 0; } _hostEnabled = (byte)((uint)num & (flag ? 1u : 0u)) != 0; bool flag2 = default(bool); int num2; if (((Dictionary)(object)customProperties).TryGetValue((object)"pmx_ac_lock", out object value2)) { if (value2 is bool) { flag2 = (bool)value2; num2 = ((1 == 0) ? 1 : 0); } else { num2 = 1; } } else { num2 = 1; } _hostLocksClients = (byte)((uint)num2 | (flag2 ? 1u : 0u)) != 0; _hostActor = ((((Dictionary)(object)customProperties).TryGetValue((object)"pmx_ac_host", out object value3) && int.TryParse(value3?.ToString(), out var result)) ? result : 0); _hostVersion = ((!((Dictionary)(object)customProperties).TryGetValue((object)"pmx_ac_ver", out object value4)) ? "" : (value4?.ToString() ?? "")); } catch { _hostEnabled = false; _hostLocksClients = false; _hostActor = 0; _hostVersion = ""; } } } public static class CheatTracker { public static void Tick() { } } internal static class CompatibilityDiagnostics { public struct Row { public readonly string Name; public readonly bool Ok; public readonly string Detail; public Row(string name, bool ok, string detail) { Name = name; Ok = ok; Detail = detail; } } private const BindingFlags AnyInstance = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static List Rows(bool russian) { List list = new List(); list.Add(new Row(russian ? "PEAK-MX" : "PEAK-MX", ok: true, "v1.1.2")); list.Add(new Row(russian ? "Версия игры" : "Game version", ok: true, Safe(() => Application.version, "?"))); list.Add(new Row(russian ? "Photon" : "Photon", Safe(() => PhotonNetwork.NetworkingClient != null, fallback: false), Safe(() => (!PhotonNetwork.InRoom) ? ((!russian) ? "not in room" : "не в комнате") : string.Format("{0}: {1}", russian ? "комната" : "room", PhotonNetwork.PlayerList.Length), "?"))); list.Add(CheckMethod(typeof(CharacterMovement), "RocketExplodeRPC", russian ? "Взрыв игрока" : "Player explosion", russian ? "RPC взрыва найден" : "Explosion RPC found")); list.Add(CheckMethod(typeof(CharacterMovement), "FallFactor", russian ? "Урон от падения" : "Fall damage", russian ? "метод найден" : "method found")); list.Add(CheckMethod(typeof(CharacterMovement), "MaxVelDmg", russian ? "Скорость падения" : "Fall velocity", russian ? "метод найден" : "method found")); list.Add(CheckMethod(typeof(CharacterMovement), "AcceptableAngle", new Type[1] { typeof(float) }, russian ? "Угол падения" : "Fall angle", russian ? "метод найден" : "method found")); list.Add(CheckMethod(typeof(CharacterInput), "ResetInput", russian ? "Блокировка ввода" : "Input blocker", russian ? "метод найден" : "method found")); list.Add(CheckField(typeof(Player), "itemSlots", russian ? "Основные слоты" : "Main slots")); list.Add(CheckField(typeof(Player), "backpackSlot", russian ? "Слот на спине" : "Back slot")); list.Add(CheckField(typeof(Player), "tempFullSlot", russian ? "Амулет/временный слот" : "Amulet/temp slot")); list.Add(CheckMember(typeof(ItemSlot), "prefab", russian ? "Предмет в слоте" : "Slot item")); list.Add(CheckMember(typeof(CharacterData), "dead", russian ? "Состояние смерти" : "Dead state")); list.Add(CheckMember(typeof(CharacterData), "currentItem", russian ? "Текущий предмет" : "Current item")); list.Add(CheckMember(typeof(CharacterData), "currentStamina", russian ? "Стамина" : "Stamina")); list.Add(CheckMethod(typeof(NetworkingUtilities), "HostRoomOptions", russian ? "Большие лобби" : "Large lobbies", russian ? "метод комнаты найден" : "room method found")); list.Add(CheckMethod(typeof(AirportCheckInKiosk), "StartGame", new Type[1] { typeof(int) }, russian ? "Старт экспедиции" : "Expedition start", russian ? "метод киоска найден" : "kiosk method found")); list.Add(CheckMethod(typeof(AirportCheckInKiosk), "LoadIslandMaster", new Type[2] { typeof(int), typeof(byte[]) }, russian ? "Загрузка острова" : "Island loading", russian ? "метод загрузки найден" : "load method found")); list.Add(CheckMethod(typeof(PlayerHandler), "AssignMixerGroup", new Type[1] { typeof(Character) }, russian ? "Голосовые группы" : "Voice groups", russian ? "метод найден" : "method found")); list.Add(CheckMethod(typeof(UIPlayerNames), "DisableName", new Type[1] { typeof(int) }, russian ? "UI имен игроков" : "Player names UI", russian ? "метод найден" : "method found")); list.Add(CheckMethod(typeof(PointPinger), "ReceivePoint_Rpc", new Type[2] { typeof(Vector3), typeof(Vector3) }, russian ? "Пинги карты" : "Map pings", russian ? "RPC найден" : "RPC found")); list.Add(CheckEnum("Arrow", russian ? "Стрелы" : "Arrows")); list.Add(CheckEnum("Petrify", russian ? "Окаменение" : "Petrify")); list.Add(CheckEnum("FlyTrap", russian ? "Мухоловка" : "Flytrap")); list.Add(CheckField(typeof(CharacterVoiceHandler), "m_source", russian ? "Голосовой источник" : "Voice source")); list.Add(CheckField(typeof(VoiceObscuranceFilter), "_voiceHandler", russian ? "Фильтр эха голоса" : "Voice echo filter")); list.Add(CheckField(typeof(MapHandler), "respawnThePeak", russian ? "Телепорт на пик" : "Peak teleport")); bool flag = Safe(delegate { GameApi.EnsureItemsLoaded(); return GameApi.ItemNames.Count > 0; }, fallback: false); list.Add(new Row(russian ? "База предметов" : "Item database", flag, flag ? GameApi.ItemNames.Count.ToString() : (russian ? "предметы не загружены" : "items not loaded"))); int num = 0; List list2 = new List(); foreach (GameApi.CosmeticCategory category in Enum.GetValues(typeof(GameApi.CosmeticCategory))) { int num2 = Safe(() => GameApi.GetCosmeticOptions(category).Length, 0); num += num2; list2.Add(category.ToString() + "=" + num2); } list.Add(new Row(russian ? "База косметики" : "Cosmetic database", num > 0, (num > 0) ? string.Join(", ", list2) : (russian ? "косметика не найдена" : "cosmetics not found"))); list.Add(new Row(russian ? "Ачивки" : "Achievements", Safe(() => SteamAch.AllTypes.Length != 0, fallback: false), Safe(() => SteamAch.AllTypes.Length.ToString(), "?"))); return list; } public static string BuildReport(bool russian) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("PEAK-MX compatibility report"); stringBuilder.AppendLine("Mod: 1.1.2"); stringBuilder.AppendLine("Game: " + Safe(() => Application.version, "?")); stringBuilder.AppendLine("Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.AppendLine(); List list = Rows(russian); for (int num = 0; num < list.Count; num++) { Row row = list[num]; stringBuilder.Append(row.Ok ? "[OK] " : "[WARN] "); stringBuilder.Append(row.Name); if (!string.IsNullOrWhiteSpace(row.Detail)) { stringBuilder.Append(": ").Append(row.Detail); } stringBuilder.AppendLine(); } stringBuilder.AppendLine(); stringBuilder.AppendLine(MxAhgHost.BuildReport(Localization.Current)); return stringBuilder.ToString(); } private static Row CheckMethod(Type type, string method, string name, string okDetail) { bool flag = Safe(() => type.GetMethod(method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null, fallback: false); return new Row(name, flag, flag ? okDetail : ("missing: " + type.Name + "." + method)); } private static Row CheckMethod(Type type, string method, Type[] args, string name, string okDetail) { bool flag = Safe(() => type.GetMethod(method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, args, null) != null, fallback: false); return new Row(name, flag, flag ? okDetail : ("missing: " + type.Name + "." + method)); } private static Row CheckField(Type type, string field, string name) { bool flag = Safe(() => type.GetField(field, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null, fallback: false); return new Row(name, flag, flag ? "ok" : ("missing: " + type.Name + "." + field)); } private static Row CheckMember(Type type, string member, string name) { bool flag = Safe(() => type.GetField(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null || type.GetProperty(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null || type.GetMethod("get_" + member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) != null, fallback: false); return new Row(name, flag, flag ? "ok" : ("missing: " + type.Name + "." + member)); } private static Row CheckEnum(string value, string name) where T : struct { bool flag = Safe(() => Enum.IsDefined(typeof(T), value), fallback: false); return new Row(name, flag, flag ? value : ("missing: " + value)); } private static T Safe(Func func, T fallback) { try { return func(); } catch { return fallback; } } } internal enum EntityKind { Beetle, Scorpion, Frog, Scoutmaster, Zombie, Bees, Tornado } internal enum EntityPlacement { NearPlayer, Crosshair } internal enum EntitySpawnStatus { Ready, Locked, NoRoom, NoPlayer, Unavailable, SceneNotReady, HostRequired, NoTornadoPath, NoGround, Limit, Cooldown, Failed, Spawned, Cleared } internal sealed class EntityDefinition { internal readonly EntityKind Kind; internal readonly string ResourcePath; internal GameObject Prefab; internal string Name => Kind switch { EntityKind.Beetle => Localization.Pick(Localization.Current, "Жук", "Beetle", "甲虫", "甲蟲", "Жук", "甲虫", "딱정벌레", "Escarabajo", "Besouro", "Käfer", "Scarabée", "Scarabeo", "Chrząszcz", "Böcek"), EntityKind.Scorpion => Localization.Pick(Localization.Current, "Скорпион", "Scorpion", "蝎子", "蠍子", "Скорпіон", "サソリ", "전갈", "Escorpión", "Escorpião", "Skorpion", "Scorpion", "Scorpione", "Skorpion", "Akrep"), EntityKind.Frog => Localization.Pick(Localization.Current, "Лягушка", "Frog", "青蛙", "青蛙", "Жаба", "カエル", "개구리", "Rana", "Sapo", "Frosch", "Grenouille", "Rana", "Żaba", "Kurbağa"), EntityKind.Scoutmaster => Localization.Pick(Localization.Current, "Скаутмастер", "Scoutmaster", "童子军领队", "童軍領隊", "Скаутмайстер", "スカウトマスター", "스카우트마스터", "Scoutmaster", "Scoutmaster", "Scoutmaster", "Scoutmaster", "Scoutmaster", "Scoutmaster", "Scoutmaster"), EntityKind.Zombie => Localization.Pick(Localization.Current, "Грибной зомби", "Mushroom zombie", "蘑菇僵尸", "蘑菇殭屍", "Грибний зомбі", "キノコゾンビ", "버섯 좀비", "Zombi de hongos", "Zumbi de cogumelos", "Pilzzombie", "Zombie champignon", "Zombie fungo", "Grzybowy zombie", "Mantar zombisi"), EntityKind.Bees => Localization.Pick(Localization.Current, "Рой пчёл", "Bee swarm", "蜂群", "蜂群", "Рій бджіл", "ハチの群れ", "벌떼", "Enjambre de abejas", "Enxame de abelhas", "Bienenschwarm", "Essaim d'abeilles", "Sciame di api", "Rój pszczół", "Arı sürüsü"), _ => Localization.Pick(Localization.Current, "Торнадо", "Tornado", "龙卷风", "龍捲風", "Торнадо", "竜巻", "토네이도", "Tornado", "Tornado", "Tornado", "Tornade", "Tornado", "Tornado", "Hortum"), }; internal EntityDefinition(EntityKind kind, string resourcePath) { Kind = kind; ResourcePath = resourcePath; } } internal readonly struct EntitySpawnResult { internal readonly EntitySpawnStatus Status; internal readonly int Count; internal readonly int Requested; internal EntitySpawnResult(EntitySpawnStatus status, int count = 0, int requested = 0) { Status = status; Count = count; Requested = requested; } } internal static class EntitySpawner { internal const int MaxBatch = 5; internal const int MaxAlive = 30; private static readonly EntityDefinition[] Definitions = new EntityDefinition[7] { new EntityDefinition(EntityKind.Beetle, "0_Items/Beetle"), new EntityDefinition(EntityKind.Scorpion, "0_Items/Scorpion"), new EntityDefinition(EntityKind.Frog, "0_Items/Frog"), new EntityDefinition(EntityKind.Scoutmaster, "Character_Scoutmaster"), new EntityDefinition(EntityKind.Zombie, "MushroomZombie"), new EntityDefinition(EntityKind.Bees, "BeeSwarm"), new EntityDefinition(EntityKind.Tornado, "Tornado") }; private static readonly List Spawned = new List(); private static Room _room; private static bool _loaded; private static float _nextSpawnAt; internal static IReadOnlyList Entities => Definitions; internal static int AliveCount { get { EnsureSession(); return Spawned.Count; } } internal static void LoadCatalog() { EntityDefinition[] definitions = Definitions; foreach (EntityDefinition entityDefinition in definitions) { GameObject val = Resources.Load(entityDefinition.ResourcePath); entityDefinition.Prefab = (((Object)(object)val != (Object)null && (Object)(object)val.GetComponent() != (Object)null && MatchesKind(val, entityDefinition.Kind)) ? val : null); } _loaded = true; } internal static void EnsureCatalog() { if (!_loaded) { LoadCatalog(); } } private static bool MatchesKind(GameObject prefab, EntityKind kind) { return kind switch { EntityKind.Beetle => (Object)(object)prefab.GetComponent() != (Object)null, EntityKind.Scorpion => (Object)(object)prefab.GetComponent() != (Object)null, EntityKind.Frog => (Object)(object)prefab.GetComponent() != (Object)null, EntityKind.Scoutmaster => (Object)(object)prefab.GetComponent() != (Object)null, EntityKind.Zombie => prefab.GetComponent()?.isNPCZombie ?? false, EntityKind.Bees => (Object)(object)prefab.GetComponent() != (Object)null, EntityKind.Tornado => (Object)(object)prefab.GetComponent() != (Object)null, _ => false, }; } internal static EntitySpawnResult Spawn(int index, Character target, EntityPlacement placement, int amount) { try { return SpawnCore(index, target, placement, amount); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[EntitySpawner] Spawn: " + ex.GetBaseException().Message)); } return new EntitySpawnResult(EntitySpawnStatus.Failed); } } private static EntitySpawnResult SpawnCore(int index, Character target, EntityPlacement placement, int amount) { //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) EnsureSession(); EntitySpawnStatus entitySpawnStatus = CommonBlockedStatus(); if (entitySpawnStatus != EntitySpawnStatus.Ready) { return new EntitySpawnResult(entitySpawnStatus); } if (Time.realtimeSinceStartup < _nextSpawnAt) { return new EntitySpawnResult(EntitySpawnStatus.Cooldown); } int num = Mathf.Clamp(amount, 1, 5); if (Spawned.Count + num > 30) { return new EntitySpawnResult(EntitySpawnStatus.Limit); } EnsureCatalog(); if (index < 0 || index >= Definitions.Length || (Object)(object)Definitions[index].Prefab == (Object)null) { return new EntitySpawnResult(EntitySpawnStatus.Unavailable); } EntityDefinition entityDefinition = Definitions[index]; Character val = (((Object)(object)target != (Object)null) ? target : Character.localCharacter); if ((Object)(object)val == (Object)null || (Object)(object)GameUtils.instance == (Object)null) { return new EntitySpawnResult(EntitySpawnStatus.NoPlayer); } if ((Object)(object)entityDefinition.Prefab.GetComponent() != (Object)null && (Object)(object)MobManager.instance == (Object)null) { return new EntitySpawnResult(EntitySpawnStatus.SceneNotReady); } if (entityDefinition.Kind == EntityKind.Frog && !PhotonNetwork.IsMasterClient) { return new EntitySpawnResult(EntitySpawnStatus.HostRequired); } if (entityDefinition.Kind == EntityKind.Zombie && (Object)(object)ZombieManager.Instance == (Object)null) { return new EntitySpawnResult(EntitySpawnStatus.SceneNotReady); } TornadoSpawner val2 = null; if (entityDefinition.Kind == EntityKind.Tornado) { val2 = FindTornadoPath(); if ((Object)(object)val2 == (Object)null) { return new EntitySpawnResult(EntitySpawnStatus.NoTornadoPath); } } if (!TryFindCenter(val, placement, out var center)) { return new EntitySpawnResult(EntitySpawnStatus.NoGround); } Vector3[] array = (Vector3[])(object)new Vector3[num]; for (int i = 0; i < num; i++) { Vector3 val3 = ((num == 1) ? Vector3.zero : (new Vector3(Mathf.Cos((float)i * (float)Math.PI * 2f / (float)num), 0f, Mathf.Sin((float)i * (float)Math.PI * 2f / (float)num)) * 2f)); if (!TryGround(center + val3, out var ground)) { return new EntitySpawnResult(EntitySpawnStatus.NoGround); } array[i] = ground + Vector3.up * ((entityDefinition.Kind == EntityKind.Bees) ? 1.8f : ((entityDefinition.Kind == EntityKind.Tornado) ? 0f : 0.6f)); } _nextSpawnAt = Time.realtimeSinceStartup + 0.5f; int num2 = 0; Vector3[] array2 = array; foreach (Vector3 val4 in array2) { GameObject val5 = null; try { val5 = (PhotonNetwork.IsMasterClient ? PhotonNetwork.InstantiateRoomObject(entityDefinition.ResourcePath, val4, Quaternion.identity, (byte)0, (object[])null) : PhotonNetwork.Instantiate(entityDefinition.ResourcePath, val4, Quaternion.identity, (byte)0, (object[])null)); if ((Object)(object)val5 == (Object)null) { break; } PhotonView component = val5.GetComponent(); if ((Object)(object)component == (Object)null || component.ViewID <= 0) { throw new InvalidOperationException("Entity has no network view."); } Character component2 = val5.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.data.spawnPoint = val5.transform; } if (entityDefinition.Kind == EntityKind.Scoutmaster) { PhotonView component3 = ((Component)val).GetComponent(); if ((Object)(object)component3 != (Object)null && component3.ViewID > 0) { component.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2] { component3.ViewID, 15f }); } } if (entityDefinition.Kind == EntityKind.Bees) { val5.GetComponent().HiveDestroyed(val4); } if (entityDefinition.Kind == EntityKind.Tornado) { component.RPC("RPCA_InitTornado", (RpcTarget)3, new object[1] { ((Component)val2).GetComponent().ViewID }); } Spawned.Add(val5); num2++; continue; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[EntitySpawner] " + entityDefinition.ResourcePath + ": " + ex.GetBaseException().Message)); } try { if ((Object)(object)val5 != (Object)null) { PhotonNetwork.Destroy(val5); } } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[EntitySpawner] Cleanup: " + ex2.GetBaseException().Message)); } } } break; } return new EntitySpawnResult((num2 > 0) ? EntitySpawnStatus.Spawned : EntitySpawnStatus.Failed, num2, num); } internal static EntitySpawnResult ClearSpawned() { EnsureSession(); EntitySpawnStatus entitySpawnStatus = CommonBlockedStatus(); if (entitySpawnStatus != EntitySpawnStatus.Ready) { return new EntitySpawnResult(entitySpawnStatus); } int num = 0; for (int num2 = Spawned.Count - 1; num2 >= 0; num2--) { GameObject val = Spawned[num2]; PhotonView val2 = (((Object)(object)val != (Object)null) ? val.GetComponent() : null); if (!((Object)(object)val2 == (Object)null) && (val2.IsMine || PhotonNetwork.IsMasterClient)) { try { PhotonNetwork.Destroy(val); Spawned.RemoveAt(num2); num++; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[EntitySpawner] Clear: " + ex.GetBaseException().Message)); } } } } return new EntitySpawnResult(EntitySpawnStatus.Cleared, num); } private static EntitySpawnStatus CommonBlockedStatus() { if (AntiCheat.ClientToolsLocked) { return EntitySpawnStatus.Locked; } if (!PhotonNetwork.InRoom) { return EntitySpawnStatus.NoRoom; } if ((Object)(object)Character.localCharacter == (Object)null) { return EntitySpawnStatus.NoPlayer; } return EntitySpawnStatus.Ready; } private static void EnsureSession() { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom != _room) { _room = currentRoom; Spawned.Clear(); _nextSpawnAt = 0f; } for (int num = Spawned.Count - 1; num >= 0; num--) { if ((Object)(object)Spawned[num] == (Object)null) { Spawned.RemoveAt(num); } } } private static TornadoSpawner FindTornadoPath() { TornadoSpawner[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (TornadoSpawner val in array) { Transform val2 = ((Component)val).transform.Find("TornadoPoints"); PhotonView component = ((Component)val).GetComponent(); if ((Object)(object)val2 != (Object)null && val2.childCount > 0 && (Object)(object)component != (Object)null && component.ViewID > 0) { return val; } } return null; } private static bool TryFindCenter(Character target, EntityPlacement placement, out Vector3 center) { //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_0064: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003b: 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) //IL_00b8: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) center = Vector3.zero; if (placement == EntityPlacement.Crosshair) { Camera main = Camera.main; RaycastHit val = default(RaycastHit); if ((Object)(object)main == (Object)null || !Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val, 80f, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1)) { return false; } center = ((RaycastHit)(ref val)).point; return true; } Vector3 val2 = target.data.lookDirection; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = ((Component)target).transform.forward; } val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.forward; } return TryGround(target.Center + ((Vector3)(ref val2)).normalized * 6f, out center); } private static bool TryGround(Vector3 position, out Vector3 ground) { //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_000b: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ground = Vector3.zero; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(position + Vector3.up * 8f, Vector3.down, ref val, 40f, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1) || ((RaycastHit)(ref val)).normal.y < 0.5f) { return false; } ground = ((RaycastHit)(ref val)).point; return true; } } internal static class EspPositions { internal static bool TryCharacter(Character character, out Vector3 position) { //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_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_0024: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if ((Object)(object)character == (Object)null) { return false; } try { position = character.Center; return IsFinite(position); } catch { return false; } } internal static bool TryItem(Item item, out Vector3 position) { //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_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_0024: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if ((Object)(object)item == (Object)null) { return false; } try { position = item.Center(); return IsFinite(position); } catch { return false; } } internal static bool TryObserver(Camera camera, out Vector3 position) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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) if (TryCharacter(Character.localCharacter, out position)) { return true; } if ((Object)(object)camera == (Object)null) { return false; } position = ((Component)camera).transform.position; return IsFinite(position); } internal static bool IsFinite(Vector3 position) { //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(position.x) && !float.IsInfinity(position.x) && !float.IsNaN(position.y) && !float.IsInfinity(position.y) && !float.IsNaN(position.z)) { return !float.IsInfinity(position.z); } return false; } } public static class Features { private static readonly FieldRef InvincibleRef = AccessTools.FieldRefAccess("isInvincible"); private static readonly FieldInfo ClimbSpeedF = AccessTools.Field(typeof(CharacterClimbing), "climbSpeedMod"); private static readonly FieldInfo VineSpeedF = AccessTools.Field(typeof(CharacterVineClimbing), "climbSpeedMod"); private static readonly FieldInfo RopeSpeedF = AccessTools.Field(typeof(CharacterRopeHandling), "climbSpeedMod"); private static float _baseJumpImpulse = float.NaN; private static float[] _lockedStatuses; private static bool _godApplied; private static bool _speedApplied; private static bool _jumpApplied; private static bool _climbApplied; private static bool _vineApplied; private static bool _ropeApplied; private static float _itemTimer; private static float _timeOverrideTimer; private static float _adminTimer; private static float _cosmeticShuffleTimer; private static float _baseInteractionDistance = -1f; private static float _baseInteractionArea = -1f; private static bool _timeScaleApplied; private static readonly Dictionary PingBaseFrustumSizes = new Dictionary(); private static GameObject _cinematicObject; private static CameraOverride _cinematicOverride; private static Vector2 _cinematicLook; public static void Tick() { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null) { return; } if (NeedsMovementTick()) { try { ApplyMovement(localCharacter); } catch (Exception e) { Warn("movement", e); } } if (NeedsCheatTick()) { try { ApplyCheats(localCharacter); } catch (Exception e2) { Warn("cheats", e2); } } try { ApplyInfiniteItems(); } catch (Exception e3) { Warn("items", e3); } try { ApplyWorldOverrides(); } catch (Exception e4) { Warn("world", e4); } if (NeedsUtilityTick()) { try { ApplyUtilityModifiers(localCharacter); } catch (Exception e5) { Warn("utility", e5); } } try { ApplyAdminProtection(); } catch (Exception e6) { Warn("admin", e6); } try { ApplyCosmeticShuffle(); } catch (Exception e7) { Warn("cosmetics", e7); } try { GameApi.ApplyFrozenPlayers(Time.deltaTime); } catch (Exception e8) { Warn("freeze", e8); } try { GameApi.ApplyInventoryLocks(Time.deltaTime); } catch (Exception e9) { Warn("inventory-lock", e9); } } private static bool NeedsMovementTick() { if (!ModConfig.SpeedMod && !_speedApplied && !ModConfig.JumpMod && !_jumpApplied && !ModConfig.InfiniteJumps && !ModConfig.ClimbMod && !_climbApplied && !ModConfig.VineClimbMod && !_vineApplied && !ModConfig.RopeClimbMod) { return _ropeApplied; } return true; } private static bool NeedsCheatTick() { if (!ModConfig.GodMode && !_godApplied && !ModConfig.InfiniteStamina && !ModConfig.NoFallDamage && !ModConfig.NoFallingRagdoll && !ModConfig.NoSlipperySurfaces && !ModConfig.NoWeight && !ModConfig.NoStatusEffects && !ModConfig.NoInjury && !ModConfig.NoHunger && !ModConfig.NoCold && !ModConfig.NoPoison && !ModConfig.NoCurse && !ModConfig.NoDrowsy && !ModConfig.NoHot && !ModConfig.NoCrab && !ModConfig.NoThorns && !ModConfig.NoSpores && !ModConfig.NoWeb && !ModConfig.NoArrows && !ModConfig.NoPetrify && !ModConfig.NoFlyTrap && !ModConfig.LockStatus) { return _lockedStatuses != null; } return true; } private static bool NeedsUtilityTick() { if (!ModConfig.LongInteraction && !(_baseInteractionDistance >= 0f) && !ModConfig.GameSpeedMod && !_timeScaleApplied && !ModConfig.CinematicCamera && !((Object)(object)_cinematicObject != (Object)null) && !(Mathf.Abs(ModConfig.PingHandSizeMultiplier - 1f) >= 0.01f)) { return PingBaseFrustumSizes.Count > 0; } return true; } private static void ApplyInfiniteItems() { if (!ModConfig.InfiniteItems) { return; } _itemTimer += Time.deltaTime; if (!(_itemTimer < 0.5f)) { _itemTimer = 0f; float value = ((ModConfig.RechargeValue > 0f) ? ModConfig.RechargeValue : 999f); int num = GameApi.SlotCount(); for (int i = 0; i < num; i++) { GameApi.RechargeSlot(i, value); } } } private static void ApplyWorldOverrides() { if (!ModConfig.OverrideExpeditionTime) { _timeOverrideTimer = 0f; return; } _timeOverrideTimer += Time.deltaTime; if (_timeOverrideTimer < 0.5f) { return; } _timeOverrideTimer = 0f; if (ModConfig.ExpeditionTimeSeconds <= 0.01f) { float num = GameApi.ExpeditionTimeSeconds(); if (!(num > 0.01f)) { return; } ModConfig.ExpeditionTimeSeconds = num; } GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } private static void ApplyAdminProtection() { if (!ModConfig.AdminProtectionEnabled) { _adminTimer = 0f; return; } _adminTimer += Time.deltaTime; if (!(_adminTimer < 2f)) { _adminTimer = 0f; GameApi.EnforceAdminProtection(); } } private static void ApplyCosmeticShuffle() { if (!ModConfig.RapidRandomOutfitColor) { _cosmeticShuffleTimer = 0f; return; } _cosmeticShuffleTimer += Time.unscaledDeltaTime; float num = Mathf.Clamp(ModConfig.RapidRandomOutfitColorInterval, 0.08f, 2f); if (!(_cosmeticShuffleTimer < num)) { _cosmeticShuffleTimer = 0f; GameApi.RandomizeOutfitAndColor(track: false); } } private static void ApplyMovement(Character c) { CharacterMovement val = c.refs?.movement; if ((Object)(object)val == (Object)null) { return; } if (ModConfig.SpeedMod) { val.movementModifier = ModConfig.SpeedAmount; _speedApplied = true; } else if (_speedApplied) { val.movementModifier = 1f; _speedApplied = false; } if (ModConfig.JumpMod) { if (float.IsNaN(_baseJumpImpulse) || _baseJumpImpulse <= 0f) { _baseJumpImpulse = ((val.jumpImpulse > 0f) ? val.jumpImpulse : 4f); } val.jumpImpulse = _baseJumpImpulse * ModConfig.JumpAmount; _jumpApplied = true; } else if (_jumpApplied) { if (!float.IsNaN(_baseJumpImpulse) && _baseJumpImpulse > 0f) { val.jumpImpulse = _baseJumpImpulse; } _jumpApplied = false; } if (ModConfig.InfiniteJumps) { c.data.jumpsRemaining = Mathf.Max(c.data.jumpsRemaining, 1); if (c.data.sinceJump > 0.28f) { c.data.sinceGrounded = Mathf.Min(c.data.sinceGrounded, 0.18f); } } ApplyClimbField(c, ClimbSpeedF, ModConfig.ClimbMod, ModConfig.ClimbAmount, ref _climbApplied); ApplyClimbField(c, VineSpeedF, ModConfig.VineClimbMod, ModConfig.VineClimbAmount, ref _vineApplied); ApplyClimbField(c, RopeSpeedF, ModConfig.RopeClimbMod, ModConfig.RopeClimbAmount, ref _ropeApplied); } private static void ApplyClimbField(Character c, FieldInfo f, bool on, float amount, ref bool applied) where T : Component { if (f == null) { return; } T component = ((Component)c).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (on) { f.SetValue(component, amount); applied = true; } else if (applied) { f.SetValue(component, 1f); applied = false; } } } private static void ApplyCheats(Character c) { CharacterData data = c.data; CharacterAfflictions val = ((c.refs != null) ? c.refs.afflictions : null); if (ModConfig.GodMode) { InvincibleRef.Invoke(data) = true; _godApplied = true; } else if (_godApplied) { InvincibleRef.Invoke(data) = false; data.RecalculateInvincibility(); _godApplied = false; } if (ModConfig.InfiniteStamina) { data.currentStamina = 1f; data.extraStamina = Mathf.Max(data.extraStamina, 0f); } if (ModConfig.NoFallDamage) { data.fallSeconds = 0f; } if (ModConfig.NoFallingRagdoll) { data.fallSeconds = 0f; } if (ModConfig.NoSlipperySurfaces) { data.slippy = 0f; data.sinceFallSlide = Mathf.Max(data.sinceFallSlide, 2f); } if (!((Object)(object)val != (Object)null)) { return; } if (ModConfig.NoStatusEffects) { for (int i = 0; i < CharacterAfflictions.NumStatusTypes; i++) { val.SetStatus((STATUSTYPE)i, 0f, false); } try { val.RemoveAllThorns(); } catch { } } else { ClearBlockedStatus(val, (STATUSTYPE)0, ModConfig.NoInjury); ClearBlockedStatus(val, (STATUSTYPE)1, ModConfig.NoHunger); ClearBlockedStatus(val, (STATUSTYPE)2, ModConfig.NoCold); ClearBlockedStatus(val, (STATUSTYPE)3, ModConfig.NoPoison); ClearBlockedStatus(val, (STATUSTYPE)5, ModConfig.NoCurse); ClearBlockedStatus(val, (STATUSTYPE)6, ModConfig.NoDrowsy); ClearBlockedStatus(val, (STATUSTYPE)8, ModConfig.NoHot); ClearBlockedStatus(val, (STATUSTYPE)4, ModConfig.NoCrab); ClearBlockedStatus(val, (STATUSTYPE)9, ModConfig.NoThorns); ClearBlockedStatus(val, (STATUSTYPE)10, ModConfig.NoSpores); ClearBlockedStatus(val, (STATUSTYPE)11, ModConfig.NoWeb); ClearBlockedStatus(val, (STATUSTYPE)12, ModConfig.NoArrows); ClearBlockedStatus(val, (STATUSTYPE)13, ModConfig.NoPetrify); ClearBlockedStatus(val, (STATUSTYPE)14, ModConfig.NoFlyTrap); } if (ModConfig.NoWeight) { val.SetStatus((STATUSTYPE)7, 0f, true); } if (ModConfig.NoThorns) { GameApi.ClearThorns(c, track: false); } if (ModConfig.NoArrows) { GameApi.ClearArrows(c, track: false); } if (ModConfig.LockStatus) { if (_lockedStatuses == null && val.currentStatuses != null) { _lockedStatuses = (float[])val.currentStatuses.Clone(); } if (_lockedStatuses != null && val.currentStatuses != null) { Array.Copy(_lockedStatuses, val.currentStatuses, Mathf.Min(_lockedStatuses.Length, val.currentStatuses.Length)); } } else { _lockedStatuses = null; } } private static void ClearBlockedStatus(CharacterAfflictions affl, STATUSTYPE type, bool blocked) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (blocked) { affl.SetStatus(type, 0f, false); } } private static void ApplyUtilityModifiers(Character c) { ApplyInteractionRange(); ApplyGameSpeed(); ApplyCinematicCamera(c); ApplyPingHandScale(); } private static void ApplyInteractionRange() { Interaction instance = Interaction.instance; if (!((Object)(object)instance == (Object)null)) { if (_baseInteractionDistance < 0f) { _baseInteractionDistance = instance.distance; _baseInteractionArea = instance.area; } if (ModConfig.LongInteraction) { instance.distance = Mathf.Max(_baseInteractionDistance, ModConfig.InteractionDistance); instance.area = Mathf.Max(_baseInteractionArea, 1.25f); } else if (_baseInteractionDistance >= 0f) { instance.distance = _baseInteractionDistance; instance.area = _baseInteractionArea; } } } private static void ApplyGameSpeed() { if (ModConfig.GameSpeedMod) { Time.timeScale = Mathf.Clamp(ModConfig.GameSpeed, 0.05f, 5f); _timeScaleApplied = true; } else if (_timeScaleApplied) { Time.timeScale = 1f; _timeScaleApplied = false; } } private static void ApplyCinematicCamera(Character c) { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) if (!ModConfig.CinematicCamera) { DisableCinematicCamera(); return; } if ((Object)(object)_cinematicObject == (Object)null) { _cinematicObject = new GameObject("PEAK-MX Cinematic Camera"); Object.DontDestroyOnLoad((Object)(object)_cinematicObject); _cinematicOverride = _cinematicObject.AddComponent(); Transform val = (((Object)(object)MainCamera.instance != (Object)null) ? ((Component)MainCamera.instance).transform : ((Component)c).transform); _cinematicObject.transform.position = val.position; _cinematicObject.transform.rotation = val.rotation; Quaternion rotation = _cinematicObject.transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; _cinematicLook = new Vector2(eulerAngles.y, eulerAngles.x); } _cinematicOverride.fov = Mathf.Clamp(ModConfig.CinematicCameraFov, 1f, 120f); float unscaledDeltaTime = Time.unscaledDeltaTime; _cinematicLook.x += Input.GetAxis("Mouse X") * 140f * unscaledDeltaTime; _cinematicLook.y -= Input.GetAxis("Mouse Y") * 140f * unscaledDeltaTime; _cinematicLook.y = Mathf.Clamp(_cinematicLook.y, -89f, 89f); _cinematicObject.transform.rotation = Quaternion.Euler(_cinematicLook.y, _cinematicLook.x, 0f); Vector3 zero = Vector3.zero; if (Input.GetKey((KeyCode)119)) { zero.z += 1f; } if (Input.GetKey((KeyCode)115)) { zero.z -= 1f; } if (Input.GetKey((KeyCode)100)) { zero.x += 1f; } if (Input.GetKey((KeyCode)97)) { zero.x -= 1f; } if (Input.GetKey((KeyCode)32) || Input.GetKey((KeyCode)101)) { zero.y += 1f; } if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)113)) { zero.y -= 1f; } float num = Mathf.Max(0.1f, ModConfig.CinematicCameraSpeed) * (Input.GetKey((KeyCode)304) ? 4f : 1f); Transform transform = _cinematicObject.transform; transform.position += _cinematicObject.transform.TransformDirection(((Vector3)(ref zero)).normalized) * num * unscaledDeltaTime; if ((Object)(object)MainCamera.instance != (Object)null) { MainCamera.instance.SetCameraOverride(_cinematicOverride); } } private static void DisableCinematicCamera() { if ((Object)(object)_cinematicObject == (Object)null) { return; } try { if ((Object)(object)MainCamera.instance != (Object)null) { MainCamera.instance.SetCameraOverride((CameraOverride)null); } } catch { } Object.Destroy((Object)(object)_cinematicObject); _cinematicObject = null; _cinematicOverride = null; } private static void ApplyPingHandScale() { float num = Mathf.Clamp(ModConfig.PingHandSizeMultiplier, 0.1f, 10f); if (Mathf.Abs(num - 1f) < 0.01f && PingBaseFrustumSizes.Count == 0) { return; } PointPing[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (PointPing val in array) { if (!((Object)(object)val == (Object)null)) { if (!PingBaseFrustumSizes.ContainsKey(val)) { PingBaseFrustumSizes[val] = Mathf.Max(0.001f, val.sizeOfFrustum); } val.sizeOfFrustum = PingBaseFrustumSizes[val] * num; } } if (!(Mathf.Abs(num - 1f) < 0.01f) || PingBaseFrustumSizes.Count <= 0) { return; } foreach (KeyValuePair pingBaseFrustumSize in PingBaseFrustumSizes) { if ((Object)(object)pingBaseFrustumSize.Key != (Object)null) { pingBaseFrustumSize.Key.sizeOfFrustum = pingBaseFrustumSize.Value; } } PingBaseFrustumSizes.Clear(); } private static void Warn(string where, Exception e) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[Features:" + where + "] " + e.Message)); } } } public static class GameApi { public enum CosmeticCategory { Skin, Accessory, Eyes, Mouth, Outfit, Hat, Sash, Medal } public struct AdminListEntry { public string Key; public string Label; public AdminListEntry(string key, string label) { Key = key; Label = label; } } private struct AdminMotionSample { public Vector3 Position; public float Time; } private struct WorldObjectScanHit { public string Label; public Vector3 Position; public float Distance; } private struct SlotPrefabAccessor { public MethodInfo Getter; public FieldInfo Field; } public static readonly List Items = new List(); public static readonly List ItemNames = new List(); public static readonly List PlayerChars = new List(); public static readonly List PlayerNames = new List(); private static readonly HashSet LocalCosmeticUnlocks = new HashSet(); private static readonly HashSet SessionBans = new HashSet(); private static readonly Dictionary SessionBanNames = new Dictionary(); private static readonly HashSet InventoryLocks = new HashSet(); private static readonly Dictionary InventoryLockNames = new Dictionary(); private static readonly Dictionary FrozenPlayers = new Dictionary(); private static readonly List FrozenKeysScratch = new List(); private static readonly List InventoryLockKeysScratch = new List(); private static readonly Dictionary AdminMotion = new Dictionary(); private static readonly Dictionary AdminMotionSuppressedUntil = new Dictionary(); private static readonly Dictionary AdminStrikes = new Dictionary(); private static readonly Dictionary AdminRareSlotState = new Dictionary(); private static readonly Dictionary AdminRareInventorySnapshot = new Dictionary(); private static readonly Dictionary> AdminRareItemEvents = new Dictionary>(); private static readonly HashSet AdminRareTouchedScratch = new HashSet(); private static readonly List AdminRareCurrentScratch = new List(); private static readonly Dictionary AdminRareCountsScratch = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary AdminAmuletFirstOwnerScratch = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary AdminAmuletDuplicateTargetScratch = new Dictionary(StringComparer.Ordinal); private static readonly HashSet AdminAmuletDuplicateSnapshot = new HashSet(StringComparer.Ordinal); private static readonly List AdminRareRemoveScratch = new List(); public static readonly List AdminProtectionLog = new List(); private static float _freezeRpcTimer; private static float _inventoryLockTimer; private static float _knifeFightAt = -1f; private static int _knifeFightCountdownSecond = -1; private static bool _itemsEverLoaded; private const float AdminRareItemWindowSeconds = 10f; private const int AdminRareItemBurstThreshold = 3; private static readonly string[] AdminRareKeywords = new string[28] { "cursed", "curse", "skull", "pandora", "effigy", "faerie", "bugle", "warp compass", "amulet", "medallion", "talisman", "charm", "panacea", "cure-all", "cure all", "mystic", "mystical", "arcane", "healing gem", "прокля", "череп", "амулет", "медальон", "талисман", "панаце", "лекар", "исцел", "мист" }; private static Customization _customizationDb; private static readonly MethodInfo CustomGetData = typeof(CharacterCustomization).GetMethod("GetCustomizationData", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetData = typeof(CharacterCustomization).GetMethod("SetCustomizationData", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetSkin = typeof(CharacterCustomization).GetMethod("SetCharacterSkinColor", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetAccessory = typeof(CharacterCustomization).GetMethod("SetCharacterAccessory", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetEyes = typeof(CharacterCustomization).GetMethod("SetCharacterEyes", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetMouth = typeof(CharacterCustomization).GetMethod("SetCharacterMouth", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetOutfit = typeof(CharacterCustomization).GetMethod("SetCharacterOutfit", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetHat = typeof(CharacterCustomization).GetMethod("SetCharacterHat", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetSash = typeof(CharacterCustomization).GetMethod("SetCharacterSash", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo CustomSetMedal = typeof(CharacterCustomization).GetMethod("SetCharacterMedal", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo RunTimeField = typeof(RunManager).GetField("timeSinceRunStarted", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo CharacterViewField = typeof(Character).GetField("view", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo RocketExplodeRpcMethod = typeof(CharacterMovement).GetMethod("RocketExplodeRPC", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly object SlotPrefabAccessorLock = new object(); private static readonly Dictionary SlotPrefabAccessors = new Dictionary(); private static readonly Segment[] WarpSegments; private static readonly string[] SegmentNamesEn; private static readonly string[] SegmentNamesRu; private const ItemTags ScoutAmuletTag = (ItemTags)512; public static readonly List LuggageLabels; public static readonly List LuggageObjects; public static readonly List WorldObjectLabels; private static readonly List WorldObjectPositions; public static readonly string[] StatusEn; public static readonly string[] StatusRu; private const int ArrowStatusIndex = 12; private const int PetrifyStatusIndex = 13; public static string AdminNoticeText { get; private set; } public static float AdminNoticeUntil { get; private set; } public static int SegmentCount => WarpSegments.Length; private static Item SlotPrefab(ItemSlot slot) { if (slot == null) { return null; } try { SlotPrefabAccessor slotPrefabAccessor = SlotPrefabAccessorFor(((object)slot).GetType()); if (slotPrefabAccessor.Getter != null) { object? obj = slotPrefabAccessor.Getter.Invoke(slot, null); return (Item)((obj is Item) ? obj : null); } if (slotPrefabAccessor.Field != null) { object? value = slotPrefabAccessor.Field.GetValue(slot); return (Item)((value is Item) ? value : null); } } catch (Exception ex) when (ex is MissingFieldException || ex is MissingMethodException || ex is TargetInvocationException || ex is ArgumentException || ex is InvalidOperationException) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] ItemSlot prefab lookup failed: " + ex.Message)); } } return null; } private static SlotPrefabAccessor SlotPrefabAccessorFor(Type type) { if (type == null) { return default(SlotPrefabAccessor); } lock (SlotPrefabAccessorLock) { if (SlotPrefabAccessors.TryGetValue(type, out var value)) { return value; } SlotPrefabAccessor slotPrefabAccessor = new SlotPrefabAccessor { Getter = (type.GetProperty("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetGetMethod(nonPublic: true) ?? type.GetMethod("get_prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)), Field = (type.GetField("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("_prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) }; SlotPrefabAccessors[type] = slotPrefabAccessor; return slotPrefabAccessor; } } public static void LoadItems() { try { Items.Clear(); ItemNames.Clear(); Object obj = Resources.Load("ItemDatabase", typeof(ItemDatabase)); ItemDatabase val = (ItemDatabase)(object)((obj is ItemDatabase) ? obj : null); if ((Object)(object)val != (Object)null) { try { if (val.itemLookup != null) { foreach (Item value in val.itemLookup.Values) { Add(value); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] LoadItems itemLookup: " + ex.Message)); } } try { foreach (Item @object in ((DatabaseAsset)(object)(ObjectDatabaseAsset)(object)val).Objects) { Add(@object); } } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)("[GameApi] LoadItems ObjectDatabaseAsset: " + ex2.Message)); } } try { foreach (Item object2 in ((DatabaseAsset)(object)val).Objects) { Add(object2); } } catch (Exception ex3) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("[GameApi] LoadItems DatabaseAsset: " + ex3.Message)); } } } try { Object[] array = Resources.LoadAll("0_Items", typeof(Item)); foreach (Object obj2 in array) { Add((Item)(object)((obj2 is Item) ? obj2 : null)); } } catch (Exception ex4) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { log4.LogDebug((object)("[GameApi] LoadItems 0_Items: " + ex4.Message)); } } try { Object[] array = Resources.FindObjectsOfTypeAll(typeof(Item)); foreach (Object obj3 in array) { Add((Item)(object)((obj3 is Item) ? obj3 : null)); } } catch (Exception ex5) { ManualLogSource log5 = Plugin.Log; if (log5 != null) { log5.LogDebug((object)("[GameApi] LoadItems all objects: " + ex5.Message)); } } _itemsEverLoaded = ItemNames.Count > 0; ManualLogSource log6 = Plugin.Log; if (log6 != null) { log6.LogInfo((object)$"[GameApi] items loaded: {ItemNames.Count}"); } } catch (Exception ex6) { ManualLogSource log7 = Plugin.Log; if (log7 != null) { log7.LogWarning((object)("[GameApi] LoadItems: " + ex6.Message)); } } } public static bool EnsureItemsLoaded() { if (_itemsEverLoaded && ItemNames.Count > 0) { return false; } LoadItems(); return ItemNames.Count > 0; } private static void Add(Item it) { if ((Object)(object)it == (Object)null) { return; } try { if (IsInventorySpawnableItem(it)) { string name = it.GetName(); if (!string.IsNullOrEmpty(name) && !HasItemAlready(it, name)) { Items.Add(it); ItemNames.Add(name); } } } catch { } } private static bool HasItemAlready(Item item, string displayName) { for (int i = 0; i < Items.Count; i++) { Item val = Items[i]; if ((Object)(object)val == (Object)null) { continue; } try { if ((Object)(object)val == (Object)(object)item) { return true; } if (val.itemID == item.itemID && (Object)(object)((Component)val).gameObject != (Object)null && (Object)(object)((Component)item).gameObject != (Object)null && string.Equals(((Object)((Component)val).gameObject).name, ((Object)((Component)item).gameObject).name, StringComparison.Ordinal)) { return true; } } catch { } } return ItemNames.Contains(displayName); } private static bool IsInventorySpawnableItem(Item item) { try { if ((Object)(object)item == (Object)null || item.UIData == null || (Object)(object)((Component)item).gameObject == (Object)null) { return false; } if ((((Object)((Component)item).gameObject).name ?? "").IndexOf("BaseConstructable", StringComparison.OrdinalIgnoreCase) >= 0) { return false; } if (!HasResourcePrefab(item)) { return false; } if (!item.UIData.canPocket && !item.UIData.canBackpack) { return false; } return true; } catch { return false; } } private static bool CanPocketItem(int itemIndex) { try { return itemIndex >= 0 && itemIndex < Items.Count && (Object)(object)Items[itemIndex] != (Object)null && Items[itemIndex].UIData != null && Items[itemIndex].UIData.canPocket && HasResourcePrefab(Items[itemIndex]); } catch { return false; } } private static bool CanBackpackItem(int itemIndex) { try { return itemIndex >= 0 && itemIndex < Items.Count && (Object)(object)Items[itemIndex] != (Object)null && Items[itemIndex].UIData != null && Items[itemIndex].UIData.canBackpack && HasResourcePrefab(Items[itemIndex]); } catch { return false; } } private static bool CanBackSlotItem(int itemIndex) { try { return itemIndex >= 0 && itemIndex < Items.Count && Items[itemIndex] is Backpack && HasResourcePrefab(Items[itemIndex]); } catch { return false; } } private static bool IsScoutAmuletItem(Item item) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)item == (Object)null) { return false; } if ((item.itemTags & 0x200) != 0) { return true; } string text = (item.GetName() + " " + ((Object)item).name + " " + (((Object)(object)((Component)item).gameObject != (Object)null) ? ((Object)((Component)item).gameObject).name : "")).ToLowerInvariant(); return text.IndexOf("amulet", StringComparison.Ordinal) >= 0 || text.IndexOf("medallion", StringComparison.Ordinal) >= 0 || text.IndexOf("talisman", StringComparison.Ordinal) >= 0 || text.IndexOf("charm", StringComparison.Ordinal) >= 0 || text.IndexOf("амулет", StringComparison.Ordinal) >= 0 || text.IndexOf("медальон", StringComparison.Ordinal) >= 0 || text.IndexOf("талисман", StringComparison.Ordinal) >= 0; } catch { return false; } } private static bool CanTempSlotItem(int itemIndex) { try { return itemIndex >= 0 && itemIndex < Items.Count && (Object)(object)Items[itemIndex] != (Object)null && (CanPocketItem(itemIndex) || IsScoutAmuletItem(Items[itemIndex])) && HasResourcePrefab(Items[itemIndex]); } catch { return false; } } private static bool HasResourcePrefab(Item item) { try { if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null) { return false; } return HasResourcePrefabName(((Object)((Component)item).gameObject).name); } catch { return false; } } private static bool HasResourcePrefabName(string prefabName) { try { if (string.IsNullOrWhiteSpace(prefabName)) { return false; } return Resources.Load("0_Items/" + prefabName, typeof(GameObject)) != (Object)null; } catch { return false; } } private static int RandomItemIndexForSlot(bool backpack) { EnsureItemsLoaded(); List list = new List(); for (int i = 0; i < Items.Count; i++) { if (backpack ? CanBackpackItem(i) : CanPocketItem(i)) { list.Add(i); } } if (list.Count == 0) { return -1; } return list[Random.Range(0, list.Count)]; } public static Texture2D ItemIcon(int index) { try { Item val = ((index >= 0 && index < Items.Count) ? Items[index] : null); if ((Object)(object)val == (Object)null || val.UIData == null) { return null; } Texture2D icon = val.UIData.icon; if ((Object)(object)icon != (Object)null) { return icon; } return TryTextureMember(val.UIData, "altIcon", "colorBlindIcon", "sprite", "smallIcon", "inventoryIcon"); } catch { return null; } } public static ushort ItemIdAt(int index) { try { return (index >= 0 && index < Items.Count && (Object)(object)Items[index] != (Object)null) ? Items[index].itemID : ushort.MaxValue; } catch { return ushort.MaxValue; } } private static Texture2D TryTextureMember(object source, params string[] names) { if (source == null || names == null) { return null; } Type type = source.GetType(); foreach (string name in names) { try { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(source); Texture2D val = (Texture2D)((value is Texture2D) ? value : null); if (val != null) { return val; } Sprite val2 = (Sprite)((value is Sprite) ? value : null); if (val2 != null && (Object)(object)val2.texture != (Object)null) { return val2.texture; } } } catch { } try { PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { object value2 = property.GetValue(source, null); Texture2D val3 = (Texture2D)((value2 is Texture2D) ? value2 : null); if (val3 != null) { return val3; } Sprite val4 = (Sprite)((value2 is Sprite) ? value2 : null); if (val4 != null && (Object)(object)val4.texture != (Object)null) { return val4.texture; } } } catch { } } return null; } public static bool SpawnToSlot(int itemIndex, int slot) { try { Player localPlayer = Player.localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.itemSlots == null) { return false; } if (slot < 0 || slot >= localPlayer.itemSlots.Length) { return false; } if (itemIndex < 0 || itemIndex >= Items.Count) { return false; } if (!CanPocketItem(itemIndex)) { return false; } SetSlotItem(localPlayer.itemSlots[slot], Items[itemIndex]); SyncInventory(localPlayer); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnToSlot: " + ex.Message)); } return false; } } public static bool ClearSlot(int slot) { try { Player localPlayer = Player.localPlayer; if ((Object)(object)localPlayer == (Object)null || localPlayer.itemSlots == null || slot < 0 || slot >= localPlayer.itemSlots.Length) { return false; } ClearItemSlot(localPlayer.itemSlots[slot]); SyncInventory(localPlayer); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ClearSlot: " + ex.Message)); } return false; } } private static void SyncInventory(Player p) { SyncInventory(p, (RpcTarget)1); } private static void SetSlotItem(ItemSlot slot, Item prefab) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (slot != null && !((Object)(object)prefab == (Object)null)) { ItemInstanceData val = new ItemInstanceData(Guid.NewGuid()); BackpackSlot val2 = (BackpackSlot)(object)((slot is BackpackSlot) ? slot : null); if (val2 != null) { Backpack val3 = (Backpack)(object)((prefab is Backpack) ? prefab : null); val2.backpackType = (BackpackType)((val3 != null) ? ((int)val3.backpackType) : 0); } slot.SetItem(prefab, val); ItemInstanceDataHandler.AddInstanceData(val); } } private static bool BackpackSlotSupportsStorage(BackpackSlot slot) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 try { if (slot == null || ((ItemSlot)slot).IsEmpty()) { return false; } Item obj = SlotPrefab((ItemSlot)(object)slot); Backpack val = (Backpack)(object)((obj is Backpack) ? obj : null); if (val == null) { return false; } if ((int)slot.backpackType == 3 || (int)slot.backpackType == 4) { return false; } return val.slotCount > 0; } catch { return false; } } private static void ClearItemSlot(ItemSlot slot) { if (slot != null) { slot.EmptyOut(); } } private static void SyncInventory(Player p, RpcTarget target) { //IL_0012: 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) byte[] array = IBinarySerializable.ToManagedArray(new InventorySyncData(p.itemSlots, p.backpackSlot, p.tempFullSlot)); ((MonoBehaviourPun)p).photonView.RPC("SyncInventoryRPC", target, new object[2] { array, true }); } private static Player PlayerOf(Character c) { try { return ((Object)(object)c != (Object)null) ? c.player : null; } catch { return null; } } private static bool IsLocal(Character c) { try { return (Object)(object)c == (Object)null || c.IsLocal || (Object)(object)c == (Object)(object)Character.localCharacter; } catch { return (Object)(object)c == (Object)null || (Object)(object)c == (Object)(object)Character.localCharacter; } } public static bool IsHost() { try { return PhotonNetwork.IsMasterClient; } catch { return PhotonNetwork.IsMasterClient; } } private static bool RequireHostForRemote(Character target, string action) { return true; } private static bool RequireHostAction(string action) { return true; } private static void LogHostOnly(string action, Character target) { string text = (((Object)(object)target != (Object)null) ? SafeCharacterName(target) : ""); string text2 = (string.IsNullOrWhiteSpace(text) ? (action + ": host only") : (action + ": host only for " + text)); AddAdminLog(text2); ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] " + text2)); } } private static CharacterCustomization LocalCustomization() { try { return (!((Object)(object)Character.localCharacter != (Object)null)) ? null : Character.localCharacter.refs?.customization; } catch { return null; } } private static Customization CustomizationDb() { try { if ((Object)(object)_customizationDb != (Object)null && HasAnyCosmeticOptions(_customizationDb)) { return _customizationDb; } try { Customization instance = Singleton.Instance; if ((Object)(object)instance != (Object)null && HasAnyCosmeticOptions(instance)) { _customizationDb = instance; return _customizationDb; } } catch { } Customization[] source = Resources.FindObjectsOfTypeAll(); _customizationDb = source.Where(HasAnyCosmeticOptions).OrderByDescending(TotalCosmeticOptionCount).FirstOrDefault() ?? source.FirstOrDefault(); return _customizationDb; } catch { return null; } } private static bool HasAnyCosmeticOptions(Customization db) { return TotalCosmeticOptionCount(db) > 0; } private static int TotalCosmeticOptionCount(Customization db) { if ((Object)(object)db == (Object)null) { return 0; } int num = 0; try { int num2 = num; CustomizationOption[] skins = db.skins; num = num2 + ((skins != null) ? skins.Length : 0); } catch { } try { int num3 = num; CustomizationOption[] accessories = db.accessories; num = num3 + ((accessories != null) ? accessories.Length : 0); } catch { } try { int num4 = num; CustomizationOption[] eyes = db.eyes; num = num4 + ((eyes != null) ? eyes.Length : 0); } catch { } try { int num5 = num; CustomizationOption[] mouths = db.mouths; num = num5 + ((mouths != null) ? mouths.Length : 0); } catch { } try { int num6 = num; CustomizationOption[] fits = db.fits; num = num6 + ((fits != null) ? fits.Length : 0); } catch { } try { int num7 = num; CustomizationOption[] hats = db.hats; num = num7 + ((hats != null) ? hats.Length : 0); } catch { } try { int num8 = num; CustomizationOption[] sashes = db.sashes; num = num8 + ((sashes != null) ? sashes.Length : 0); } catch { } try { int num9 = num; CustomizationOption[] medals = db.medals; num = num9 + ((medals != null) ? medals.Length : 0); } catch { } return num; } public static bool SpawnToSlotFor(Character target, int itemIndex, int slot) { try { if (IsLocal(target)) { return SpawnToSlot(itemIndex, slot); } if (!RequireHostForRemote(target, "inventory spawn")) { return false; } Player val = PlayerOf(target); if ((Object)(object)val == (Object)null || val.itemSlots == null) { return false; } if (slot < 0 || slot >= val.itemSlots.Length) { return false; } if (itemIndex < 0 || itemIndex >= Items.Count) { return false; } if (!CanPocketItem(itemIndex)) { return false; } SetSlotItem(val.itemSlots[slot], Items[itemIndex]); SyncInventory(val, (RpcTarget)0); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnToSlotFor: " + ex.Message)); } return false; } } public static string SmartSpawnItem(Character target, int itemIndex) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) try { EnsureItemsLoaded(); Character val = target ?? Character.localCharacter; Player val2 = TargetPlayer(val); if ((Object)(object)val2 == (Object)null || itemIndex < 0 || itemIndex >= Items.Count || (Object)(object)Items[itemIndex] == (Object)null) { return "failed"; } if (!RequireHostForRemote(val, "smart inventory spawn")) { return "failed"; } if (CanPocketItem(itemIndex) && val2.itemSlots != null) { for (int i = 0; i < val2.itemSlots.Length; i++) { if (val2.itemSlots[i] != null && val2.itemSlots[i].IsEmpty() && SpawnToSlotFor(val, itemIndex, i)) { return "slot:" + (i + 1); } } } Vector3 val3 = SafePosition(val) + Vector3.up * 0.7f; try { val3 += ((Component)val).transform.forward * 1.1f; } catch { } if (SpawnWorldItem(itemIndex, val3, Quaternion.identity)) { return "ground"; } } catch (Exception e) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SmartSpawnItem: " + RootExceptionMessage(e))); } } return "failed"; } public static bool ClearSlotFor(Character target, int slot) { try { if (IsLocal(target)) { return ClearSlot(slot); } if (!RequireHostForRemote(target, "inventory clear")) { return false; } Player val = PlayerOf(target); if ((Object)(object)val == (Object)null || val.itemSlots == null || slot < 0 || slot >= val.itemSlots.Length) { return false; } ClearItemSlot(val.itemSlots[slot]); SyncInventory(val, (RpcTarget)0); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ClearSlotFor: " + ex.Message)); } return false; } } public static int SlotCount() { return SlotCountFor(Player.localPlayer); } public static int SlotCountFor(Character c) { return SlotCountFor(PlayerOf(c)); } private static int SlotCountFor(Player p) { try { return ((Object)(object)p != (Object)null && p.itemSlots != null) ? p.itemSlots.Length : 0; } catch { return 0; } } private static Player TargetPlayer(Character c) { return PlayerOf(c) ?? Player.localPlayer; } public static string DescribeSlot(Character c, int slot) { try { Player val = TargetPlayer(c); if ((Object)(object)val == (Object)null || val.itemSlots == null || slot < 0 || slot >= val.itemSlots.Length) { return ""; } Item val2 = SlotPrefab(val.itemSlots[slot]); if ((Object)(object)val2 == (Object)null) { return "-"; } string name = val2.GetName(); return string.IsNullOrWhiteSpace(name) ? ((Object)val2).name : name; } catch { return ""; } } public static string DescribeBackSlot(Character c) { try { Player val = TargetPlayer(c); BackpackSlot val2 = (((Object)(object)val != (Object)null) ? val.backpackSlot : null); if (val2 == null || ((ItemSlot)val2).IsEmpty()) { return "-"; } Item val3 = SlotPrefab((ItemSlot)(object)val2); string text = (((Object)(object)val3 != (Object)null) ? val3.GetName() : ""); if (string.IsNullOrWhiteSpace(text) && (Object)(object)val3 != (Object)null) { text = ((Object)val3).name; } if (string.IsNullOrWhiteSpace(text)) { text = ((ItemSlot)val2).GetPrefabName(); } return text; } catch { return ""; } } public static string DescribeTempSlot(Character c) { try { Player val = TargetPlayer(c); ItemSlot val2 = (((Object)(object)val != (Object)null) ? val.tempFullSlot : null); if (val2 == null || val2.IsEmpty()) { return "-"; } Item val3 = SlotPrefab(val2); if ((Object)(object)val3 == (Object)null) { return "-"; } string name = val3.GetName(); return string.IsNullOrWhiteSpace(name) ? ((Object)val3).name : name; } catch { return ""; } } public static bool SpawnToBackSlotFor(Character target, int itemIndex) { try { if (!RequireHostForRemote(target, "back slot spawn")) { return false; } if (!CanBackSlotItem(itemIndex)) { return false; } Player val = TargetPlayer(target); if ((Object)(object)val == (Object)null || val.backpackSlot == null) { return false; } SetSlotItem((ItemSlot)(object)val.backpackSlot, Items[itemIndex]); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnToBackSlotFor: " + ex.Message)); } return false; } } public static bool ClearBackSlotFor(Character target) { try { if (!RequireHostForRemote(target, "back slot clear")) { return false; } Player val = TargetPlayer(target); if ((Object)(object)val == (Object)null || val.backpackSlot == null) { return false; } ClearItemSlot((ItemSlot)(object)val.backpackSlot); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ClearBackSlotFor: " + ex.Message)); } return false; } } public static void RechargeBackSlotFor(Character target, float value) { try { if (RequireHostForRemote(target, "back slot recharge")) { Player val = TargetPlayer(target); if (!((Object)(object)val == (Object)null) && val.backpackSlot != null && !((ItemSlot)val.backpackSlot).IsEmpty()) { RechargeItemSlotData((ItemSlot)(object)val.backpackSlot, value); SyncTargetInventory(target); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RechargeBackSlotFor: " + ex.Message)); } } } public static bool SpawnToTempSlotFor(Character target, int itemIndex) { try { if (!RequireHostForRemote(target, "temporary slot spawn")) { return false; } if (!CanTempSlotItem(itemIndex)) { return false; } Player val = TargetPlayer(target); if ((Object)(object)val == (Object)null || val.tempFullSlot == null) { return false; } SetSlotItem(val.tempFullSlot, Items[itemIndex]); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnToTempSlotFor: " + ex.Message)); } return false; } } public static bool ClearTempSlotFor(Character target) { try { if (!RequireHostForRemote(target, "temporary slot clear")) { return false; } Player val = TargetPlayer(target); if ((Object)(object)val == (Object)null || val.tempFullSlot == null) { return false; } ClearItemSlot(val.tempFullSlot); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ClearTempSlotFor: " + ex.Message)); } return false; } } public static void RechargeTempSlotFor(Character target, float value) { try { if (RequireHostForRemote(target, "temporary slot recharge")) { Player val = TargetPlayer(target); if (!((Object)(object)val == (Object)null) && val.tempFullSlot != null && !val.tempFullSlot.IsEmpty()) { RechargeItemSlotData(val.tempFullSlot, value); SyncTargetInventory(target); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RechargeTempSlotFor: " + ex.Message)); } } } public static bool HasBackpack(Character c) { try { Player val = TargetPlayer(c); return (Object)(object)val != (Object)null && val.backpackSlot != null && !((ItemSlot)val.backpackSlot).IsEmpty() && ((ItemSlot)val.backpackSlot).data != null; } catch { return false; } } public static int BackpackSlotCount(Character c) { BackpackData val = BackpackDataFor(c, create: false); if (val == null || val.itemSlots == null) { return 0; } return val.itemSlots.Length; } public static string DescribeBackpackSlot(Character c, int slot) { try { BackpackData val = BackpackDataFor(c, create: false); if (val == null || val.itemSlots == null || slot < 0 || slot >= val.itemSlots.Length) { return ""; } Item val2 = SlotPrefab(val.itemSlots[slot]); if ((Object)(object)val2 == (Object)null) { return "-"; } string name = val2.GetName(); return string.IsNullOrWhiteSpace(name) ? ((Object)val2).name : name; } catch { return ""; } } public static bool SpawnToBackpackSlotFor(Character target, int itemIndex, int slot) { try { if (!RequireHostForRemote(target, "backpack spawn")) { return false; } if (itemIndex < 0 || itemIndex >= Items.Count) { return false; } if (!CanBackpackItem(itemIndex)) { return false; } BackpackData val = BackpackDataFor(target, create: true); if (val == null || val.itemSlots == null || slot < 0 || slot >= val.itemSlots.Length) { return false; } SetSlotItem(val.itemSlots[slot], Items[itemIndex]); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnToBackpackSlotFor: " + ex.Message)); } return false; } } public static bool ClearBackpackSlotFor(Character target, int slot) { try { if (!RequireHostForRemote(target, "backpack clear")) { return false; } BackpackData val = BackpackDataFor(target, create: false); if (val == null || val.itemSlots == null || slot < 0 || slot >= val.itemSlots.Length) { return false; } ClearItemSlot(val.itemSlots[slot]); SyncTargetInventory(target); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ClearBackpackSlotFor: " + ex.Message)); } return false; } } public static void RechargeBackpackSlotFor(Character target, int slot, float value) { try { if (RequireHostForRemote(target, "backpack recharge")) { BackpackData val = BackpackDataFor(target, create: false); if (val != null && val.itemSlots != null && slot >= 0 && slot < val.itemSlots.Length) { RechargeItemSlotData(val.itemSlots[slot], value); SyncTargetInventory(target); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RechargeBackpackSlotFor: " + ex.Message)); } } } private static BackpackData BackpackDataFor(Character c, bool create) { try { Player val = TargetPlayer(c); if ((Object)(object)val == (Object)null || val.backpackSlot == null || ((ItemSlot)val.backpackSlot).IsEmpty() || ((ItemSlot)val.backpackSlot).data == null) { return null; } if (!BackpackSlotSupportsStorage(val.backpackSlot)) { return null; } BackpackData result = default(BackpackData); if (((ItemSlot)val.backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref result)) { return result; } return create ? ((ItemSlot)val.backpackSlot).data.RegisterNewEntry((DataEntryKey)7) : null; } catch { return null; } } private static void SyncTargetInventory(Character c) { Player val = TargetPlayer(c); if (!((Object)(object)val == (Object)null)) { SyncInventory(val, (RpcTarget)(IsLocal(c) ? 1 : 0)); } } public static CustomizationOption[] GetCosmeticOptions(CosmeticCategory category) { try { Customization val = CustomizationDb(); if ((Object)(object)val == (Object)null) { return Array.Empty(); } return category switch { CosmeticCategory.Skin => val.skins ?? Array.Empty(), CosmeticCategory.Accessory => val.accessories ?? Array.Empty(), CosmeticCategory.Eyes => val.eyes ?? Array.Empty(), CosmeticCategory.Mouth => val.mouths ?? Array.Empty(), CosmeticCategory.Outfit => val.fits ?? Array.Empty(), CosmeticCategory.Hat => val.hats ?? Array.Empty(), CosmeticCategory.Sash => val.sashes ?? Array.Empty(), CosmeticCategory.Medal => val.medals ?? Array.Empty(), _ => Array.Empty(), }; } catch { return Array.Empty(); } } public static int GetCurrentCosmeticIndex(CosmeticCategory category) { try { CharacterCustomization val = LocalCustomization(); if ((Object)(object)val == (Object)null) { return -1; } CharacterCustomizationData customizationData = GetCustomizationData(val); return category switch { CosmeticCategory.Skin => customizationData.currentSkin, CosmeticCategory.Accessory => customizationData.currentAccessory, CosmeticCategory.Eyes => customizationData.currentEyes, CosmeticCategory.Mouth => customizationData.currentMouth, CosmeticCategory.Outfit => customizationData.currentOutfit, CosmeticCategory.Hat => customizationData.currentHat, CosmeticCategory.Sash => customizationData.currentSash, CosmeticCategory.Medal => customizationData.currentMedal, _ => -1, }; } catch { return -1; } } public static int FindBlankCosmeticIndex(CosmeticCategory category) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); for (int i = 0; i < cosmeticOptions.Length; i++) { try { if ((Object)(object)cosmeticOptions[i] != (Object)null && cosmeticOptions[i].isBlank) { return i; } } catch { } } return -1; } public static bool IsCosmeticOptionGrantable(CosmeticCategory category, int index) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); if (index >= 0 && index < cosmeticOptions.Length) { return IsCosmeticOptionGrantable(category, cosmeticOptions[index]); } return false; } public static bool IsCosmeticOptionSelectable(CosmeticCategory category, int index) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); if (index >= 0 && index < cosmeticOptions.Length) { return IsCosmeticOptionSelectable(category, cosmeticOptions[index]); } return false; } public static bool IsCosmeticOptionSelectable(CosmeticCategory category, CustomizationOption option) { return (Object)(object)option != (Object)null; } public static bool IsCosmeticOptionGrantable(CosmeticCategory category, CustomizationOption option) { //IL_0019: 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) if ((Object)(object)option == (Object)null) { return false; } try { if (option.isBlank) { return true; } if (option.type != ExpectedCosmeticType(category)) { return false; } if (!HasKnownCosmeticRequirement(option)) { return false; } if (!HasCosmeticUnlockRequirement(option)) { return false; } return HasCosmeticVisual(category, option); } catch { return false; } } private static Type ExpectedCosmeticType(CosmeticCategory category) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //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_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_0050: Unknown result type (might be due to invalid IL or missing references) return (Type)(category switch { CosmeticCategory.Skin => 0, CosmeticCategory.Accessory => 10, CosmeticCategory.Eyes => 20, CosmeticCategory.Mouth => 30, CosmeticCategory.Outfit => 40, CosmeticCategory.Hat => 50, CosmeticCategory.Sash => 60, CosmeticCategory.Medal => 70, _ => 0, }); } private static bool HasCosmeticVisual(CosmeticCategory category, CustomizationOption option) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)option == (Object)null) { return false; } if ((Object)(object)option.texture != (Object)null) { return true; } if ((Object)(object)option.fitMesh != (Object)null || (Object)(object)option.fitMaterial != (Object)null || (Object)(object)option.fitMaterialShoes != (Object)null) { return true; } if ((Object)(object)option.fitMaterialOverridePants != (Object)null || (Object)(object)option.fitMaterialOverrideHat != (Object)null) { return true; } if (category == CosmeticCategory.Skin) { Color color = option.color; if (!(color.a > 0.01f) && !(color.r > 0.01f) && !(color.g > 0.01f)) { return color.b > 0.01f; } return true; } return false; } private static bool HasKnownCosmeticRequirement(CustomizationOption option) { string a = ((object)Unsafe.As(ref option.customRequirement)/*cast due to .constrained prefix*/).ToString(); if (!string.Equals(a, "None", StringComparison.OrdinalIgnoreCase) && !string.Equals(a, "Goat", StringComparison.OrdinalIgnoreCase)) { return string.Equals(a, "Crown", StringComparison.OrdinalIgnoreCase); } return true; } private static bool HasCosmeticUnlockRequirement(CustomizationOption option) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)option == (Object)null || option.isBlank) { return false; } if (option.requiresAscent) { return true; } if (option.requiresSteamStat) { return true; } if ((int)option.requiredAchievement != 0) { return true; } string a = ((object)Unsafe.As(ref option.customRequirement)/*cast due to .constrained prefix*/).ToString(); if (!string.Equals(a, "Goat", StringComparison.OrdinalIgnoreCase)) { return string.Equals(a, "Crown", StringComparison.OrdinalIgnoreCase); } return true; } public static bool SetCosmetic(CosmeticCategory category, int index) { try { CharacterCustomization val = LocalCustomization(); CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); if ((Object)(object)val == (Object)null || index < 0 || index >= cosmeticOptions.Length) { return false; } if (!IsCosmeticOptionSelectable(category, cosmeticOptions[index])) { return false; } CharacterCustomizationData customizationData = GetCustomizationData(val); switch (category) { case CosmeticCategory.Skin: customizationData.currentSkin = index; InvokeCustomizationSetter(val, CustomSetSkin, index); break; case CosmeticCategory.Accessory: customizationData.currentAccessory = index; InvokeCustomizationSetter(val, CustomSetAccessory, index); break; case CosmeticCategory.Eyes: customizationData.currentEyes = index; InvokeCustomizationSetter(val, CustomSetEyes, index); break; case CosmeticCategory.Mouth: customizationData.currentMouth = index; InvokeCustomizationSetter(val, CustomSetMouth, index); break; case CosmeticCategory.Outfit: customizationData.currentOutfit = index; InvokeCustomizationSetter(val, CustomSetOutfit, index); break; case CosmeticCategory.Hat: customizationData.currentHat = index; InvokeCustomizationSetter(val, CustomSetHat, index); break; case CosmeticCategory.Sash: customizationData.currentSash = index; InvokeCustomizationSetter(val, CustomSetSash, index); break; case CosmeticCategory.Medal: customizationData.currentMedal = index; InvokeCustomizationSetter(val, CustomSetMedal, index); break; default: return false; } customizationData.CorrectValues(); SetCustomizationData(val, customizationData); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetCosmetic: " + ex.Message)); } return false; } } public static bool RandomizeOutfitAndColor(bool track = true) { bool flag = false; try { CosmeticCategory[] array = (CosmeticCategory[])Enum.GetValues(typeof(CosmeticCategory)); for (int i = 0; i < array.Length; i++) { int num = RandomSelectableIndex(array[i]); if (num >= 0) { flag |= SetCosmetic(array[i], num); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RandomizeOutfitAndColor: " + ex.Message)); } } return flag; } private static int RandomSelectableIndex(CosmeticCategory category) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); List list = new List(); for (int i = 0; i < cosmeticOptions.Length; i++) { CustomizationOption option = cosmeticOptions[i]; if (IsCosmeticOptionSelectable(category, option)) { list.Add(i); } } if (list.Count == 0) { return -1; } return list[Random.Range(0, list.Count)]; } private static int RandomGrantableIndex(CosmeticCategory category) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(category); List list = new List(); for (int i = 0; i < cosmeticOptions.Length; i++) { CustomizationOption val = cosmeticOptions[i]; if (!((Object)(object)val == (Object)null) && !val.isBlank && IsCosmeticOptionGrantable(category, val)) { list.Add(i); } } if (list.Count != 0) { return list[Random.Range(0, list.Count)]; } return -1; } public static bool CloneLocalAppearanceFrom(Character source, bool includeNickname) { try { Character localCharacter = Character.localCharacter; if ((Object)(object)source == (Object)null || (Object)(object)localCharacter == (Object)null) { return false; } CharacterCustomization val = ((source.refs != null) ? source.refs.customization : null); CharacterCustomization val2 = LocalCustomization(); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return false; } Player player = OwnerOf(source) ?? PhotonNetwork.LocalPlayer; CharacterCustomizationData customizationDataFor = GetCustomizationDataFor(val, player); ApplyCustomizationData(val2, customizationDataFor); if (includeNickname) { SetLocalNickname(SafeCharacterName(source), track: false); } return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] CloneLocalAppearanceFrom: " + ex.Message)); } return false; } } private static void ApplyCustomizationData(CharacterCustomization cc, CharacterCustomizationData data) { data.CorrectValues(); SetCustomizationData(cc, data); InvokeCustomizationSetter(cc, CustomSetSkin, data.currentSkin); InvokeCustomizationSetter(cc, CustomSetAccessory, data.currentAccessory); InvokeCustomizationSetter(cc, CustomSetEyes, data.currentEyes); InvokeCustomizationSetter(cc, CustomSetMouth, data.currentMouth); InvokeCustomizationSetter(cc, CustomSetOutfit, data.currentOutfit); InvokeCustomizationSetter(cc, CustomSetHat, data.currentHat); InvokeCustomizationSetter(cc, CustomSetSash, data.currentSash); InvokeCustomizationSetter(cc, CustomSetMedal, data.currentMedal); } public static string LocalNickname() { try { string text = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.NickName : PhotonNetwork.NickName); if (!string.IsNullOrWhiteSpace(text)) { return text; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && !string.IsNullOrWhiteSpace(localCharacter.characterName)) { return localCharacter.characterName; } } catch { } return ""; } public static bool SetLocalNickname(string nickname, bool track = true) { try { string text = CleanNickname(nickname); if (string.IsNullOrWhiteSpace(text)) { return false; } PhotonNetwork.NickName = text; if (PhotonNetwork.LocalPlayer != null) { PhotonNetwork.LocalPlayer.NickName = text; } RefreshPlayers(); return true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetLocalNickname: " + ex.Message)); } return false; } } private static string CleanNickname(string nickname) { if (string.IsNullOrWhiteSpace(nickname)) { return ""; } string text = nickname.Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ') .Trim(); while (text.Contains(" ")) { text = text.Replace(" ", " "); } if (text.Length <= 32) { return text; } return text.Substring(0, 32); } public static bool UnlockCosmeticOption(CustomizationOption option) { //IL_0061: 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_0069: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)option == (Object)null) { return false; } LocalCosmeticUnlocks.Add(((Object)option).GetInstanceID()); try { if (option.requiresAscent) { SteamAch.SetMaxAscent(Mathf.Max(0, option.requiredAscent)); } } catch { } try { if (option.requiresSteamStat) { SteamAch.SetStatValue(option.requiredSteamStat, Mathf.Max(1, option.requiredSteamStatValue)); } } catch { } try { if ((int)option.requiredAchievement != 0) { SteamAch.Unlock(option.requiredAchievement); } } catch { } try { string a = ((object)Unsafe.As(ref option.customRequirement)/*cast due to .constrained prefix*/).ToString(); if (string.Equals(a, "Goat", StringComparison.OrdinalIgnoreCase)) { SteamAch.SetMaxAscent(8); } else if (string.Equals(a, "Crown", StringComparison.OrdinalIgnoreCase)) { SteamAch.UnlockAll(); } } catch { } try { option.testLocked = false; } catch { } return true; } public static bool LockCosmeticOption(CustomizationOption option) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)option == (Object)null) { return false; } LocalCosmeticUnlocks.Remove(((Object)option).GetInstanceID()); try { if ((int)option.requiredAchievement != 0) { SteamAch.Revoke(option.requiredAchievement); } } catch { } try { if (option.requiresSteamStat) { SteamAch.SetStatValue(option.requiredSteamStat, 0); } } catch { } try { if (option.requiresAscent) { SteamAch.SetMaxAscent(Mathf.Max(0, option.requiredAscent - 1)); } } catch { } try { if (string.Equals(((object)Unsafe.As(ref option.customRequirement)/*cast due to .constrained prefix*/).ToString(), "Goat", StringComparison.OrdinalIgnoreCase)) { SteamAch.SetMaxAscent(0); } } catch { } try { option.testLocked = true; } catch { } return true; } public static void UnlockAllCosmeticOptions() { int num = 0; try { foreach (CosmeticCategory value in Enum.GetValues(typeof(CosmeticCategory))) { CustomizationOption[] cosmeticOptions = GetCosmeticOptions(value); foreach (CustomizationOption val in cosmeticOptions) { if (IsCosmeticOptionGrantable(value, val)) { LocalCosmeticUnlocks.Add(((Object)val).GetInstanceID()); num++; } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] UnlockAllCosmeticOptions local: " + ex.Message)); } } try { SteamAch.UnlockAllCosmetics(); } catch { } } public static bool IsCosmeticLocallyUnlocked(CustomizationOption option) { try { return (Object)(object)option != (Object)null && LocalCosmeticUnlocks.Contains(((Object)option).GetInstanceID()); } catch { return false; } } private static string SafeCosmeticName(CustomizationOption option) { try { return ((Object)(object)option != (Object)null && !string.IsNullOrWhiteSpace(((Object)option).name)) ? ((Object)option).name : "Unknown"; } catch { return "Unknown"; } } private static CharacterCustomizationData GetCustomizationData(CharacterCustomization cc) { return GetCustomizationDataFor(cc, PhotonNetwork.LocalPlayer); } private static CharacterCustomizationData GetCustomizationDataFor(CharacterCustomization cc, Player player) { if (CustomGetData == null) { return null; } if (player == null) { return null; } object obj = (CustomGetData.IsStatic ? null : cc); object? obj2 = CustomGetData.Invoke(obj, new object[1] { player }); CharacterCustomizationData val = (CharacterCustomizationData)((obj2 is CharacterCustomizationData) ? obj2 : null); if (val == null) { return null; } return val; } private static void SetCustomizationData(CharacterCustomization cc, CharacterCustomizationData data) { SetCustomizationDataFor(cc, data, PhotonNetwork.LocalPlayer); } private static void SetCustomizationDataFor(CharacterCustomization cc, CharacterCustomizationData data, Player player) { if (!(CustomSetData == null) && player != null) { object obj = (CustomSetData.IsStatic ? null : cc); CustomSetData.Invoke(obj, new object[2] { data, player }); } } private static void InvokeCustomizationSetter(CharacterCustomization cc, MethodInfo method, int index) { if (!(method == null)) { object obj = (method.IsStatic ? null : cc); method.Invoke(obj, new object[1] { index }); } } public static void RefreshPlayers() { try { PlayerChars.Clear(); PlayerNames.Clear(); AddPlayerCharacter(Character.localCharacter); try { Player localPlayer = Player.localPlayer; AddPlayerCharacter((localPlayer != null) ? localPlayer.character : null); } catch { } List allCharacters = Character.AllCharacters; if (allCharacters != null) { foreach (Character item in allCharacters) { AddPlayerCharacter(item); } } Character[] array = Object.FindObjectsByType((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { AddPlayerCharacter(array[i]); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RefreshPlayers: " + ex.Message)); } } } private static void AddPlayerCharacter(Character c) { if ((Object)(object)c == (Object)null) { return; } try { if (!IsLocal(c)) { try { if (c.isBot || c.isZombie || c.isScoutmaster) { return; } } catch { } if ((Object)(object)ViewOf(c) == (Object)null) { return; } } for (int i = 0; i < PlayerChars.Count; i++) { if ((Object)(object)PlayerChars[i] == (Object)(object)c) { return; } } PlayerChars.Add(c); PlayerNames.Add(SafeCharacterName(c)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] AddPlayerCharacter: " + ex.Message)); } } } public static void ReviveSelf() { if ((Object)(object)Character.localCharacter != (Object)null) { RevivePlayer(Character.localCharacter); } } public static void KillSelf() { if ((Object)(object)Character.localCharacter != (Object)null) { KillPlayer(Character.localCharacter); } } public static void WarpToSpawn() { //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_0057: Unknown result type (might be due to invalid IL or missing references) try { Character localCharacter = Character.localCharacter; Transform val = (((Object)(object)localCharacter != (Object)null) ? localCharacter.data.spawnPoint : null); if (!((Object)(object)val == (Object)null)) { ((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val.position + new Vector3(0f, 2f, 0f), true }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpToSpawn: " + ex.Message)); } } } public static void WarpPlayerToSpawn(Character c) { //IL_0068: 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) try { if (!((Object)(object)c == (Object)null) && RequireHostForRemote(c, "warp player to spawn")) { Transform val = (((Object)(object)c.data != (Object)null) ? c.data.spawnPoint : null); if (!((Object)(object)val == (Object)null)) { SuppressAdminMovementCheck(c); ((MonoBehaviourPun)c).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val.position + new Vector3(0f, 2f, 0f), true }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpPlayerToSpawn: " + ex.Message)); } } } public static void TeleportToCoords(float x, float y, float z) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) try { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !localCharacter.data.dead) { ((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { (object)new Vector3(x, y, z), true }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] TeleportToCoords: " + ex.Message)); } } } public static void KillPlayer(Character c) { try { if ((Object)(object)c == (Object)null || !RequireHostForRemote(c, "kill player")) { return; } PhotonView val = ViewOf(c); if ((Object)(object)val == (Object)null) { return; } try { val.RPC("RPCA_Die", (RpcTarget)0, new object[0]); } catch (Exception e) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] KillPlayer RPCA_Die failed, falling back to RPCA_SetDead: " + RootExceptionMessage(e))); } val.RPC("RPCA_SetDead", (RpcTarget)0, new object[0]); } } catch (Exception e2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] KillPlayer: " + RootExceptionMessage(e2))); } } } public static void RevivePlayer(Character c) { //IL_0041: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)c == (Object)null) && RequireHostForRemote(c, "revive player")) { Vector3 val = (((Object)(object)c.Ghost != (Object)null) ? ((Component)c.Ghost).transform.position : c.Head) + new Vector3(0f, 4f, 0f); ((MonoBehaviourPun)c).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { val, false, -1 }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RevivePlayer: " + ex.Message)); } } } public static void RevivePlayerHere(Character c) { //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_005d: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_0067: 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) try { if (!((Object)(object)c == (Object)null) && RequireHostForRemote(c, "revive player here")) { Vector3 val = (((Object)(object)Character.localCharacter != (Object)null) ? (Character.localCharacter.Head + Vector3.up * 2f) : (SafePosition(c) + Vector3.up * 3f)); ((MonoBehaviourPun)c).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { val, false, -1 }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RevivePlayerHere: " + ex.Message)); } } } public static void ReviveAllDeadOnly() { try { if (!RequireHostAction("revive dead players")) { return; } RefreshPlayers(); int num = 0; for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if (!((Object)(object)val == (Object)null) && IsDead(val)) { RevivePlayer(val); num++; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ReviveAllDeadOnly: " + ex.Message)); } } } public static void AntiStuck(Character c = null) { //IL_0075: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || !RequireHostForRemote(val, "anti-stuck")) { return; } HaltCharacter(val); try { if ((Object)(object)val.data != (Object)null) { val.data.fallSeconds = 0f; val.data.sinceGrounded = 0f; val.data.sinceJump = 0f; } } catch { } Vector3 val2 = SafePosition(val) + Vector3.up * 2.75f; SuppressAdminMovementCheck(val); try { ((MonoBehaviourPun)val).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val2, true }); } catch { try { CharacterRefs refs = val.refs; if (refs != null) { CharacterRagdoll ragdoll = refs.ragdoll; if (ragdoll != null) { ragdoll.MoveAllRigsInDirection(Vector3.up * 2.75f); } } } catch { } } ClearArrows(val, track: false); RemovePhysicalThorns(val, arrowsOnly: false, logFailures: false); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] AntiStuck: " + ex.Message)); } } } public static void KickPlayer(Character c) { try { if ((Object)(object)c == (Object)null || IsLocal(c)) { return; } Player val = PlayerOf(c); PhotonView val2 = (((Object)(object)val != (Object)null) ? ((MonoBehaviourPun)val).photonView : null); Player val3 = (((Object)(object)val2 != (Object)null) ? val2.Owner : null); if ((Object)(object)val2 == (Object)null || val3 == null) { return; } val2.RPC("RPC_GetKicked", val3, new object[0]); try { PhotonNetwork.CloseConnection(val3); } catch { } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] KickPlayer: " + ex.Message)); } } } public static void KickPhotonPlayer(Player player, string reason) { try { if (player == null || player.IsLocal) { return; } bool flag = false; RefreshPlayers(); for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if (!((Object)(object)val == (Object)null)) { Player val2 = OwnerOf(val); if (val2 != null && val2.ActorNumber == player.ActorNumber) { KickPlayer(val); flag = true; break; } } } if (flag) { return; } try { PhotonNetwork.CloseConnection(player); } catch { } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] KickPhotonPlayer: " + ex.Message)); } } } public static void BanPlayer(Character c) { try { if (!((Object)(object)c == (Object)null) && !IsLocal(c)) { string text = PlayerBanId(c); if (!string.IsNullOrWhiteSpace(text)) { SessionBans.Add(text); SessionBanNames[text] = SafeCharacterName(c); AddAdminLog(SafeCharacterName(c) + ": session ban"); } KickPlayer(c); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] BanPlayer: " + ex.Message)); } } } public static bool IsSessionBanned(Character c) { string text = PlayerBanId(c); if (!string.IsNullOrWhiteSpace(text)) { return SessionBans.Contains(text); } return false; } public static void ToggleSessionBan(Character c) { try { if ((Object)(object)c == (Object)null || IsLocal(c) || !RequireHostForRemote(c, "session ban")) { return; } string text = PlayerBanId(c); if (!string.IsNullOrWhiteSpace(text)) { if (SessionBans.Contains(text)) { UnbanSession(text); return; } SessionBans.Add(text); SessionBanNames[text] = SafeCharacterName(c); AddAdminLog(SafeCharacterName(c) + ": session ban"); KickPlayer(c); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ToggleSessionBan: " + ex.Message)); } } } public static void UnbanSession(string key) { if (!string.IsNullOrWhiteSpace(key)) { string value; string obj = (SessionBanNames.TryGetValue(key, out value) ? value : key); SessionBans.Remove(key); SessionBanNames.Remove(key); AddAdminLog(obj + ": session unban"); } } public static List SessionBanEntries() { List list = new List(); foreach (string sessionBan in SessionBans) { string value; string label = ((SessionBanNames.TryGetValue(sessionBan, out value) && !string.IsNullOrWhiteSpace(value)) ? value : sessionBan); list.Add(new AdminListEntry(sessionBan, label)); } return list; } public static void ToggleMute(Character c) { try { if (RequireHostForRemote(c, "mute player")) { Player val = OwnerOf(c); if (val != null && val != PhotonNetwork.LocalPlayer) { SetMuted(val, !IsMuted(c)); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ToggleMute: " + ex.Message)); } } } public static bool IsMuted(Character c) { try { Player val = OwnerOf(c); if (val == null) { return false; } if (((object)val).GetType().GetProperty("CustomProperties")?.GetValue(val, null) is IDictionary dictionary && dictionary.Contains("mu")) { object obj = dictionary["mu"]; bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } return false; } catch { return false; } } private static void SetMuted(Player player, bool muted) { if (player == null) { return; } Type type = Type.GetType("ExitGames.Client.Photon.Hashtable, Photon3Unity3D"); if (!(type == null)) { object obj = Activator.CreateInstance(type); if (obj is IDictionary dictionary) { dictionary["mu"] = muted; } ((object)player).GetType().GetMethod("SetCustomProperties", new Type[1] { type })?.Invoke(player, new object[1] { obj }); } } public static bool IsFrozen(Character c) { string text = FreezeKey(c); if (!string.IsNullOrWhiteSpace(text)) { return FrozenPlayers.ContainsKey(text); } return false; } public static void ToggleFreeze(Character c) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)c == (Object)null || !RequireHostForRemote(c, "freeze player")) { return; } string text = FreezeKey(c); if (!string.IsNullOrWhiteSpace(text)) { if (FrozenPlayers.ContainsKey(text)) { FrozenPlayers.Remove(text); } else { FrozenPlayers[text] = SafePosition(c); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ToggleFreeze: " + ex.Message)); } } } public static void ApplyFrozenPlayers(float deltaTime) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) try { if (FrozenPlayers.Count == 0) { return; } _freezeRpcTimer += Mathf.Max(0f, deltaTime); bool flag = _freezeRpcTimer >= 0.2f; if (flag) { _freezeRpcTimer = 0f; } FrozenKeysScratch.Clear(); foreach (KeyValuePair frozenPlayer in FrozenPlayers) { FrozenKeysScratch.Add(frozenPlayer.Key); } for (int i = 0; i < FrozenKeysScratch.Count; i++) { string key = FrozenKeysScratch[i]; if (FrozenPlayers.TryGetValue(key, out var value)) { Character val = FindFrozenCharacter(key); if (!((Object)(object)val == (Object)null)) { FreezeCharacter(val, value, flag); } } } FrozenKeysScratch.Clear(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ApplyFrozenPlayers: " + ex.Message)); } } } public static bool IsInventoryLocked(Character c) { string text = AdminCharacterKey(c); if (!string.IsNullOrWhiteSpace(text)) { return InventoryLocks.Contains(text); } return false; } public static void ToggleInventoryLock(Character c) { try { if ((Object)(object)c == (Object)null || !RequireHostForRemote(c, "inventory lock")) { return; } string text = AdminCharacterKey(c); if (!string.IsNullOrWhiteSpace(text)) { string text2 = SafeCharacterName(c); if (InventoryLocks.Contains(text)) { InventoryLocks.Remove(text); InventoryLockNames.Remove(text); AddAdminLog(text2 + ": inventory unlock"); } else { InventoryLocks.Add(text); InventoryLockNames[text] = text2; AddAdminLog(text2 + ": inventory lock"); DropAllInventory(c, track: false); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ToggleInventoryLock: " + ex.Message)); } } } public static void UnlockInventoryLock(string key) { if (!string.IsNullOrWhiteSpace(key)) { string value; string obj = (InventoryLockNames.TryGetValue(key, out value) ? value : key); InventoryLocks.Remove(key); InventoryLockNames.Remove(key); AddAdminLog(obj + ": inventory unlock"); } } public static List InventoryLockEntries() { List list = new List(); foreach (string inventoryLock in InventoryLocks) { string value; string label = ((InventoryLockNames.TryGetValue(inventoryLock, out value) && !string.IsNullOrWhiteSpace(value)) ? value : inventoryLock); list.Add(new AdminListEntry(inventoryLock, label)); } return list; } public static void ApplyInventoryLocks(float deltaTime) { try { if (InventoryLocks.Count == 0) { return; } _inventoryLockTimer += Mathf.Max(0f, deltaTime); if (_inventoryLockTimer < 0.45f) { return; } _inventoryLockTimer = 0f; InventoryLockKeysScratch.Clear(); foreach (string inventoryLock in InventoryLocks) { InventoryLockKeysScratch.Add(inventoryLock); } for (int i = 0; i < InventoryLockKeysScratch.Count; i++) { string text = InventoryLockKeysScratch[i]; if (InventoryLocks.Contains(text)) { Character val = FindFrozenCharacter(text); if (!((Object)(object)val == (Object)null)) { DropAllInventory(val, track: false); } } } InventoryLockKeysScratch.Clear(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ApplyInventoryLocks: " + ex.Message)); } } } private static string FreezeKey(Character c) { return AdminCharacterKey(c); } private static string AdminCharacterKey(Character c) { if ((Object)(object)c == (Object)null) { return ""; } if (IsLocal(c)) { return "local"; } return PlayerBanId(c); } private static Character FindFrozenCharacter(string key) { if (string.Equals(key, "local", StringComparison.Ordinal)) { return Character.localCharacter; } List allCharacters = Character.AllCharacters; if (allCharacters == null) { return null; } for (int i = 0; i < allCharacters.Count; i++) { Character val = allCharacters[i]; if ((Object)(object)val != (Object)null && string.Equals(PlayerBanId(val), key, StringComparison.Ordinal)) { return val; } } return null; } private static Vector3 SafePosition(Character c) { //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_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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) try { return c.Center; } catch { try { return ((Component)c).transform.position; } catch { return Vector3.zero; } } } private static void FreezeCharacter(Character c, Vector3 position, bool sendRpc) { //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_0086: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null) { return; } HaltCharacter(c); try { if (Vector3.Distance(c.Center, position) > 0.08f && (Object)(object)c.refs?.ragdoll != (Object)null) { c.refs.ragdoll.MoveAllRigsInDirection(position - c.Center); } } catch { } if (!(!IsLocal(c) && IsHost() && sendRpc)) { return; } try { ((MonoBehaviourPun)c).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { position, false }); } catch { } } private static void HaltCharacter(Character c) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) try { CharacterRefs refs = c.refs; if (refs != null) { CharacterRagdoll ragdoll = refs.ragdoll; if (ragdoll != null) { ragdoll.HaltBodyVelocity(false); } } } catch { } try { List list = c.refs?.ragdoll?.partList; if (list == null) { return; } for (int i = 0; i < list.Count; i++) { Rigidbody val = (((Object)(object)list[i] != (Object)null) ? list[i].Rig : null); if (!((Object)(object)val == (Object)null) && !val.isKinematic) { val.linearVelocity = Vector3.zero; val.angularVelocity = Vector3.zero; } } } catch { } } public static void EnforceSessionBans() { try { if (!IsHost() || SessionBans.Count == 0) { return; } RefreshPlayers(); for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if (!((Object)(object)val == (Object)null) && !IsLocal(val)) { string text = PlayerBanId(val); if (!string.IsNullOrWhiteSpace(text) && SessionBans.Contains(text)) { KickPlayer(val); } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] EnforceSessionBans: " + ex.Message)); } } } public static void EnforceAdminProtection() { try { if (ModConfig.AdminProtectionEnabled && IsHost()) { if (ModConfig.AdminAutoKickSessionBans) { EnforceSessionBans(); } if (ModConfig.AdminDetectExtremeMovement) { CheckExtremeMovement(); } if (ModConfig.AdminDetectRareItemBursts) { CheckRareItemBursts(); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] EnforceAdminProtection: " + ex.Message)); } } } private static void CheckExtremeMovement() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) RefreshPlayers(); float realtimeSinceStartup = Time.realtimeSinceStartup; float num = Mathf.Max(5f, ModConfig.AdminMaxSpeed); int maxStrikes = Mathf.Clamp(ModConfig.AdminSpeedStrikes, 1, 10); for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if ((Object)(object)val == (Object)null || IsLocal(val) || IsFrozen(val)) { continue; } try { if ((Object)(object)val.data != (Object)null && val.data.dead) { continue; } } catch { } string text = PlayerBanId(val); if (string.IsNullOrWhiteSpace(text)) { continue; } Vector3 val2 = SafePosition(val); if (AdminMotionSuppressedUntil.TryGetValue(text, out var value)) { if (realtimeSinceStartup < value) { AdminMotion[text] = new AdminMotionSample { Position = val2, Time = realtimeSinceStartup }; continue; } AdminMotionSuppressedUntil.Remove(text); } if (AdminMotion.TryGetValue(text, out var value2)) { float num2 = Mathf.Max(0.001f, realtimeSinceStartup - value2.Time); if (num2 > 5f) { AdminMotion[text] = new AdminMotionSample { Position = val2, Time = realtimeSinceStartup }; continue; } Vector3 val3 = val2 - value2.Position; if (ModConfig.AdminIgnoreDownwardMovement && val3.y < 0f) { val3.y = 0f; } float num3 = ((Vector3)(ref val3)).magnitude / num2; int value3; if (num3 > num) { RegisterAdminStrike(val, text + ":speed", $"{SafeCharacterName(val)}: speed {num3:0.0} m/s", maxStrikes); } else if (AdminStrikes.TryGetValue(text + ":speed", out value3) && value3 > 0) { AdminStrikes[text + ":speed"] = value3 - 1; } } AdminMotion[text] = new AdminMotionSample { Position = val2, Time = realtimeSinceStartup }; } } private static void CheckRareItemBursts() { RefreshPlayers(); float realtimeSinceStartup = Time.realtimeSinceStartup; int maxStrikes = Mathf.Clamp(ModConfig.AdminSpeedStrikes, 1, 10); AdminAmuletFirstOwnerScratch.Clear(); AdminAmuletDuplicateTargetScratch.Clear(); for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if ((Object)(object)val == (Object)null || IsLocal(val)) { continue; } try { if ((Object)(object)val.data != (Object)null && val.data.dead) { continue; } } catch { } string text = PlayerBanId(val); if (string.IsNullOrWhiteSpace(text)) { continue; } Player val2 = PlayerOf(val); if ((Object)(object)val2 == (Object)null) { continue; } AdminRareTouchedScratch.Clear(); AdminRareCurrentScratch.Clear(); try { if (val2.itemSlots != null) { for (int j = 0; j < val2.itemSlots.Length; j++) { CheckRareItemSlot(val, text, "main:" + j, val2.itemSlots[j], realtimeSinceStartup, AdminRareTouchedScratch, AdminRareCurrentScratch, maxStrikes); } } } catch { } CheckRareItemSlot(val, text, "back", (ItemSlot)(object)val2.backpackSlot, realtimeSinceStartup, AdminRareTouchedScratch, AdminRareCurrentScratch, maxStrikes); CheckRareItemSlot(val, text, "temp", val2.tempFullSlot, realtimeSinceStartup, AdminRareTouchedScratch, AdminRareCurrentScratch, maxStrikes); try { BackpackData val3 = BackpackDataFor(val, create: false); if (val3?.itemSlots != null) { for (int k = 0; k < val3.itemSlots.Length; k++) { CheckRareItemSlot(val, text, "bag:" + k, val3.itemSlots[k], realtimeSinceStartup, AdminRareTouchedScratch, AdminRareCurrentScratch, maxStrikes); } } } catch { } CheckRareInventorySnapshot(val, text, AdminRareCurrentScratch, maxStrikes); TrackGlobalAmuletDuplicates(val, text, AdminRareCurrentScratch); PruneRareSlotState(text, AdminRareTouchedScratch); } foreach (KeyValuePair item in AdminAmuletDuplicateTargetScratch) { if (!AdminAmuletDuplicateSnapshot.Contains(item.Key)) { Character value = item.Value; string text2 = PlayerBanId(value); RegisterAdminStrike(value, text2 + ":amulet_duplicate_global:" + item.Key, SafeCharacterName(value) + ": duplicate amulet across players (" + RareItemDisplayName(item.Key) + ")", 1); } } AdminAmuletDuplicateSnapshot.Clear(); foreach (string key in AdminAmuletDuplicateTargetScratch.Keys) { AdminAmuletDuplicateSnapshot.Add(key); } } private static void CheckRareItemSlot(Character c, string playerKey, string slotName, ItemSlot slot, float now, HashSet touched, List currentRare, int maxStrikes) { string text = playerKey + "|" + slotName; touched.Add(text); string text2 = RareItemFingerprint(slot); if (!string.IsNullOrWhiteSpace(text2)) { currentRare.Add(text2); } AdminRareSlotState.TryGetValue(text, out var value); if (string.IsNullOrWhiteSpace(text2)) { if (!string.IsNullOrWhiteSpace(value)) { AdminRareSlotState.Remove(text); } } else if (!string.Equals(value, text2, StringComparison.Ordinal)) { AdminRareSlotState[text] = text2; RegisterRareItemEvent(c, playerKey, text2, now, maxStrikes); } } private static void CheckRareInventorySnapshot(Character c, string playerKey, List currentRare, int maxStrikes) { if (currentRare == null || currentRare.Count == 0) { AdminRareInventorySnapshot.Remove(playerKey); return; } currentRare.Sort(StringComparer.Ordinal); string text = string.Join("\n", currentRare.ToArray()); if (AdminRareInventorySnapshot.TryGetValue(playerKey, out var value) && string.Equals(value, text, StringComparison.Ordinal)) { return; } AdminRareInventorySnapshot[playerKey] = text; AdminRareCountsScratch.Clear(); for (int i = 0; i < currentRare.Count; i++) { string key = currentRare[i]; AdminRareCountsScratch[key] = ((!AdminRareCountsScratch.TryGetValue(key, out var value2)) ? 1 : (value2 + 1)); } foreach (KeyValuePair item in AdminRareCountsScratch) { if (item.Value >= 2 && IsAmuletFingerprint(item.Key)) { RegisterAdminStrike(c, playerKey + ":rare_duplicate:" + item.Key, $"{SafeCharacterName(c)}: duplicate rare item ({RareItemDisplayName(item.Key)} x{item.Value})", 1); } } if (currentRare.Count >= 5) { RegisterAdminStrike(c, playerKey + ":rare_total", $"{SafeCharacterName(c)}: too many rare items equipped ({currentRare.Count})", maxStrikes); } } private static void RegisterRareItemEvent(Character c, string playerKey, string fingerprint, float now, int maxStrikes) { if (!AdminRareItemEvents.TryGetValue(playerKey, out var value)) { value = new List(); AdminRareItemEvents[playerKey] = value; } value.Add(now); for (int num = value.Count - 1; num >= 0; num--) { if (now - value[num] > 10f) { value.RemoveAt(num); } } if (value.Count >= 3) { string text = RareItemDisplayName(fingerprint); RegisterAdminStrike(c, playerKey + ":rare_items", $"{SafeCharacterName(c)}: rare item burst {value.Count}/{10f:0}s ({text})", maxStrikes); value.Clear(); } } private static void PruneRareSlotState(string playerKey, HashSet touched) { string value = playerKey + "|"; AdminRareRemoveScratch.Clear(); foreach (string key in AdminRareSlotState.Keys) { if (key.StartsWith(value, StringComparison.Ordinal) && !touched.Contains(key)) { AdminRareRemoveScratch.Add(key); } } for (int i = 0; i < AdminRareRemoveScratch.Count; i++) { AdminRareSlotState.Remove(AdminRareRemoveScratch[i]); } } private static string RareItemFingerprint(ItemSlot slot) { try { if (slot == null || slot.IsEmpty()) { return ""; } Item val = SlotPrefab(slot); if ((Object)(object)val == (Object)null || !IsAdminRareAuditItem(val)) { return ""; } string name = val.GetName(); if (string.IsNullOrWhiteSpace(name)) { name = ((Object)val).name; } string text = (((Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : ((Object)val).name); string text2 = (IsScoutAmuletItem(val) ? "A" : "R"); return text2 + "|" + val.itemID + "|" + text + "|" + name; } catch { return ""; } } private static bool IsAmuletFingerprint(string fingerprint) { if (!string.IsNullOrWhiteSpace(fingerprint)) { return fingerprint.StartsWith("A|", StringComparison.Ordinal); } return false; } private static void TrackGlobalAmuletDuplicates(Character c, string playerKey, List currentRare) { if ((Object)(object)c == (Object)null || currentRare == null) { return; } for (int i = 0; i < currentRare.Count; i++) { string text = currentRare[i]; if (IsAmuletFingerprint(text)) { if (!AdminAmuletFirstOwnerScratch.TryGetValue(text, out var value)) { AdminAmuletFirstOwnerScratch[text] = playerKey; } else if (!string.Equals(value, playerKey, StringComparison.Ordinal)) { AdminAmuletDuplicateTargetScratch[text] = c; } } } } private static string RareItemDisplayName(string fingerprint) { if (string.IsNullOrWhiteSpace(fingerprint)) { return "?"; } string[] array = fingerprint.Split(new char[1] { '|' }); if (array.Length < 4 || string.IsNullOrWhiteSpace(array[3])) { return fingerprint; } return array[3]; } private static bool IsAdminRareAuditItem(Item item) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)item == (Object)null) { return false; } if ((item.itemTags & 0x201) != 0) { return true; } return ContainsAny((item.GetName() + " " + ((Object)item).name + " " + (((Object)(object)((Component)item).gameObject != (Object)null) ? ((Object)((Component)item).gameObject).name : "") + " " + ((object)item).GetType().Name).ToLowerInvariant(), AdminRareKeywords); } catch { return false; } } private static bool ContainsAny(string value, string[] needles) { if (string.IsNullOrWhiteSpace(value) || needles == null) { return false; } foreach (string value2 in needles) { if (!string.IsNullOrWhiteSpace(value2) && value.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static void RegisterAdminStrike(Character c, string key, string message, int maxStrikes) { int value; int num = ((!AdminStrikes.TryGetValue(key, out value)) ? 1 : (value + 1)); AdminStrikes[key] = num; AddAdminLog($"{message} ({num}/{maxStrikes})"); if (!ModConfig.AdminWarnOnly && num >= maxStrikes) { AddAdminLog(SafeCharacterName(c) + ": auto-kick by admin protection"); KickPlayer(c); AdminStrikes[key] = 0; } } public static void AddAdminLog(string message, bool showNotice = true) { if (!string.IsNullOrWhiteSpace(message)) { string item = DateTime.Now.ToString("HH:mm:ss") + " " + message; AdminProtectionLog.Insert(0, item); while (AdminProtectionLog.Count > 18) { AdminProtectionLog.RemoveAt(AdminProtectionLog.Count - 1); } if (showNotice) { AdminNoticeText = message; AdminNoticeUntil = Time.realtimeSinceStartup + 6f; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[AdminProtection] " + message)); } } } private static Player OwnerOf(Character c) { if ((Object)(object)c == (Object)null) { return null; } try { PhotonView val = ViewOf(c); if ((Object)(object)val != (Object)null && val.Owner != null) { return val.Owner; } } catch { } return null; } private static PhotonView ViewOf(Character c) { if ((Object)(object)c == (Object)null) { return null; } try { PhotonView val = (PhotonView)((CharacterViewField != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val != (Object)null) { return val; } } catch { } try { return ((MonoBehaviourPun)c).photonView; } catch { return null; } } private static string RootExceptionMessage(Exception e) { if (e == null) { return ""; } while (e is TargetInvocationException && e.InnerException != null) { e = e.InnerException; } return e.GetType().Name + ": " + e.Message; } private static string PlayerBanId(Character c) { Player val = OwnerOf(c); if (val == null) { return ""; } if (!string.IsNullOrWhiteSpace(val.UserId)) { return "uid:" + val.UserId; } if (!string.IsNullOrWhiteSpace(val.NickName)) { return "nick:" + val.NickName; } return "actor:" + val.ActorNumber; } private static void SuppressAdminMovementCheck(Character c, float seconds = 4f) { if (!((Object)(object)c == (Object)null) && !IsLocal(c)) { string text = PlayerBanId(c); if (!string.IsNullOrWhiteSpace(text)) { AdminMotionSuppressedUntil[text] = Time.realtimeSinceStartup + Mathf.Max(1f, seconds); AdminMotion.Remove(text); } } } public static void WarpToPlayer(Character c) { //IL_0019: 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_0037: 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) try { if (!((Object)(object)c == (Object)null) && !((Object)(object)Character.localCharacter == (Object)null)) { Vector3 val = c.Head + new Vector3(0f, 4f, 0f); ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpToPlayer: " + ex.Message)); } } } public static void BringPlayer(Character c) { //IL_002f: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)c == (Object)null) && !((Object)(object)Character.localCharacter == (Object)null) && RequireHostForRemote(c, "bring player")) { Vector3 val = Character.localCharacter.Head + new Vector3(0f, 4f, 0f); SuppressAdminMovementCheck(c); ((MonoBehaviourPun)c).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] BringPlayer: " + ex.Message)); } } } public static void PushPlayer(Character c, float power = 14f) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || !RequireHostForRemote(val, "push player")) { return; } Vector3 val2 = LocalAimDirection(val); if (val2.y < 0.12f) { val2.y = 0.12f; } Vector3 val3 = ((Vector3)(ref val2)).normalized + Vector3.up * 0.5f; val2 = ((Vector3)(ref val3)).normalized; float num = Mathf.Clamp(power, 2f, 60f); ApplyImpulse(val, val2 * num); ApplyForceAtPositionRpc(val, val2 * num * 18f, SafePosition(val), 2.5f); if (IsLocal(val) || !IsHost()) { return; } Vector3 forward = default(Vector3); ((Vector3)(ref forward))..ctor(val2.x, 0f, val2.z); if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = ((Component)val).transform.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val4 = SafePosition(val) + forward * Mathf.Clamp(power * 0.22f, 1.5f, 9f) + Vector3.up * Mathf.Clamp(power * 0.12f, 1f, 5f); SuppressAdminMovementCheck(val); try { ((MonoBehaviourPun)val).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val4, true }); } catch { } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] PushPlayer: " + ex.Message)); } } } public static void ExplodePlayer(Character c, float power = 34f, float radius = 9f) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a7: 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) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || !RequireHostForRemote(val, "explode player")) { return; } Vector3 val2 = SafePosition(val); SpawnExplosionVfx(val, val2); RefreshPlayers(); for (int i = 0; i < PlayerChars.Count; i++) { Character val3 = PlayerChars[i]; if (!((Object)(object)val3 == (Object)null)) { Vector3 val4 = SafePosition(val3) - val2; float num = Mathf.Max(0.35f, ((Vector3)(ref val4)).magnitude); if (!(num > radius)) { Vector3 val5 = ((((Vector3)(ref val4)).sqrMagnitude > 0.05f) ? ((Vector3)(ref val4)).normalized : LocalAimDirection(val3)) + Vector3.up * 0.7f; float num2 = power * Mathf.Clamp01(1f - num / radius + 0.25f); ApplyImpulse(val3, ((Vector3)(ref val5)).normalized * num2); ApplyForceAtPositionRpc(val3, ((Vector3)(ref val5)).normalized * num2 * 22f, val2, radius); } } } Vector3 val6 = LocalAimDirection(val) + Vector3.up * 1.35f + Random.insideUnitSphere * 0.15f; Vector3 normalized = ((Vector3)(ref val6)).normalized; ApplyImpulse(val, normalized * Mathf.Clamp(power * 1.25f, 12f, 90f)); ApplyForceAtPositionRpc(val, normalized * Mathf.Clamp(power * 26f, 250f, 1200f), val2, Mathf.Max(2f, radius * 0.5f)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ExplodePlayer: " + ex.Message)); } } } private static Vector3 LocalAimDirection(Character fallbackTarget) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f4: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)MainCamera.instance != (Object)null) { Vector3 forward = ((Component)MainCamera.instance).transform.forward; if (((Vector3)(ref forward)).sqrMagnitude > 0.01f) { return ((Vector3)(ref forward)).normalized; } } } catch { } Vector3 forward2; try { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { forward2 = ((Component)main).transform.forward; if (((Vector3)(ref forward2)).sqrMagnitude > 0.01f) { forward2 = ((Component)main).transform.forward; return ((Vector3)(ref forward2)).normalized; } } } catch { } try { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && ((Vector3)(ref localCharacter.data.lookDirection)).sqrMagnitude > 0.01f) { return ((Vector3)(ref localCharacter.data.lookDirection)).normalized; } } catch { } try { forward2 = ((Component)fallbackTarget).transform.forward; return ((Vector3)(ref forward2)).normalized; } catch { return Vector3.forward; } } private static void SpawnExplosionVfx(Character target, Vector3 center) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) bool flag = false; try { CharacterMovement val = target?.refs?.movement; if ((Object)(object)val != (Object)null && RocketExplodeRpcMethod != null) { RocketExplodeRpcMethod.Invoke(val, null); flag = true; } } catch (Exception e) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] local RocketExplodeRPC skipped: " + RootExceptionMessage(e))); } } try { PhotonView val2 = ViewOf(target); if ((Object)(object)val2 != (Object)null) { val2.RPC("RocketExplodeRPC", (RpcTarget)1, new object[0]); } } catch (Exception e2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)("[GameApi] RocketExplodeRPC skipped: " + RootExceptionMessage(e2))); } } if (flag) { return; } try { GameObject val3 = target?.refs?.movement?.explosionPrefab; if ((Object)(object)val3 != (Object)null) { Object.Instantiate(val3, center, Quaternion.identity); return; } } catch { } try { GameObject val4 = Resources.Load("SkeletonExplosion"); if (!((Object)(object)val4 == (Object)null)) { SkeletonExplosion component = Object.Instantiate(val4, center, Quaternion.identity).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)target != (Object)null) { component.Boom(target); } } } catch (Exception e3) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("[GameApi] explosion VFX fallback skipped: " + RootExceptionMessage(e3))); } } } private static void ApplyForceAtPositionRpc(Character c, Vector3 force, Vector3 point, float radius) { //IL_001f: 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) try { PhotonView val = ViewOf(c); if ((Object)(object)val != (Object)null) { val.RPC("RPCA_AddForceAtPosition", (RpcTarget)0, new object[3] { force, point, Mathf.Max(0.1f, radius) }); } } catch { } } private static void ApplyImpulse(Character c, Vector3 impulse) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) try { List list = c.refs?.ragdoll?.partList; if (list == null) { return; } for (int i = 0; i < list.Count; i++) { Rigidbody val = (((Object)(object)list[i] != (Object)null) ? list[i].Rig : null); if (!((Object)(object)val == (Object)null) && !val.isKinematic) { val.AddForce(impulse, (ForceMode)2); } } } catch { } } public static void ReviveAll() { if (!RequireHostAction("revive all")) { return; } RefreshPlayers(); foreach (Character playerChar in PlayerChars) { RevivePlayer(playerChar); } } public static void WarpAllToMe() { if (!RequireHostAction("bring all")) { return; } RefreshPlayers(); foreach (Character playerChar in PlayerChars) { if ((Object)(object)playerChar != (Object)null && !playerChar.IsLocal) { BringPlayer(playerChar); } } } public static void KillAll(bool excludeSelf) { if (!RequireHostAction("kill all")) { return; } RefreshPlayers(); int num = 0; foreach (Character playerChar in PlayerChars) { if ((Object)(object)playerChar == (Object)null) { continue; } if (excludeSelf) { try { if (playerChar.IsLocal) { continue; } } catch { } } KillPlayer(playerChar); num++; } } public static void RechargeSlot(int slot, float value) { try { Player localPlayer = Player.localPlayer; if (!((Object)(object)localPlayer == (Object)null) && localPlayer.itemSlots != null && slot >= 0 && slot < localPlayer.itemSlots.Length) { RechargeItemSlotData(localPlayer.itemSlots[slot], value); SyncInventory(localPlayer); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RechargeSlot: " + ex.Message)); } } } public static void RechargeSlotFor(Character target, int slot, float value) { try { if (IsLocal(target)) { RechargeSlot(slot, value); } else if (RequireHostForRemote(target, "inventory recharge")) { Player val = PlayerOf(target); if (!((Object)(object)val == (Object)null) && val.itemSlots != null && slot >= 0 && slot < val.itemSlots.Length) { RechargeItemSlotData(val.itemSlots[slot], value); SyncInventory(val, (RpcTarget)0); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RechargeSlotFor: " + ex.Message)); } } } private static void RechargeItemSlotData(ItemSlot slot, float value) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected I4, but got Unknown Dictionary dictionary = ((slot == null) ? null : slot.data?.data); if (dictionary == null) { return; } foreach (KeyValuePair item in dictionary) { int num = (int)item.Key; if (num == 12) { DataEntryValue value2 = item.Value; IntItemData val = (IntItemData)(object)((value2 is IntItemData) ? value2 : null); if (val != null) { val.Value = (int)value; continue; } } if (num == 10) { DataEntryValue value3 = item.Value; FloatItemData val2 = (FloatItemData)(object)((value3 is FloatItemData) ? value3 : null); if (val2 != null) { val2.Value = value; continue; } } if (num == 11) { DataEntryValue value4 = item.Value; FloatItemData val3 = (FloatItemData)(object)((value4 is FloatItemData) ? value4 : null); if (val3 != null) { val3.Value = value; continue; } } if (num == 2) { DataEntryValue value5 = item.Value; OptionableIntItemData val4 = (OptionableIntItemData)(object)((value5 is OptionableIntItemData) ? value5 : null); if (val4 != null) { val4.Value = (int)value; } } } } public static void RefreshLuggage() { //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_0069: 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) try { LuggageLabels.Clear(); LuggageObjects.Clear(); Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } List aLL_LUGGAGE = Luggage.ALL_LUGGAGE; if (aLL_LUGGAGE == null || aLL_LUGGAGE.Count == 0) { return; } Vector3 head = localCharacter.Head; List> list = new List>(); foreach (Luggage item in aLL_LUGGAGE) { if ((Object)(object)item == (Object)null) { continue; } try { float num = Vector3.Distance(head, item.Center()); if (num <= 300f) { list.Add(new KeyValuePair(item, num)); } } catch { } } list.Sort((KeyValuePair a, KeyValuePair b) => a.Value.CompareTo(b.Value)); foreach (KeyValuePair item2 in list) { LuggageObjects.Add(item2.Key); LuggageLabels.Add(string.Format("{0} [{1:F0}m]", item2.Key.displayName ?? "Container", item2.Value)); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RefreshLuggage: " + ex.Message)); } } } public static void OpenLuggage(int index) { try { if (!RequireHostAction("open container") || index < 0 || index >= LuggageObjects.Count) { return; } Luggage val = LuggageObjects[index]; if (!((Object)(object)val == (Object)null)) { PhotonView component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { component.RPC("OpenLuggageRPC", (RpcTarget)0, new object[1] { true }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] OpenLuggage: " + ex.Message)); } } } public static void OpenAllNearbyLuggage() { if (RequireHostAction("open all containers")) { for (int i = 0; i < LuggageObjects.Count; i++) { OpenLuggage(i); } } } public static void WarpToLuggage(int index) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) try { if (index >= 0 && index < LuggageObjects.Count) { Luggage val = LuggageObjects[index]; Character localCharacter = Character.localCharacter; if (!((Object)(object)val == (Object)null) && !((Object)(object)localCharacter == (Object)null)) { ((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val.Center() + new Vector3(0f, 2f, 0f), true }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpToLuggage: " + ex.Message)); } } } public static string SegmentLabel(int index, bool russian) { string[] array = (russian ? SegmentNamesRu : SegmentNamesEn); if (index < 0 || index >= array.Length) { return index.ToString(); } return array[index]; } public unsafe static string CurrentSegmentLabel(bool russian) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between I4 and Unknown try { Segment currentSegmentNumber = MapHandler.CurrentSegmentNumber; for (int i = 0; i < WarpSegments.Length; i++) { if ((int)WarpSegments[i] == (int)currentSegmentNumber) { return SegmentLabel(i, russian); } } return ((object)(*(Segment*)(¤tSegmentNumber))/*cast due to .constrained prefix*/).ToString(); } catch { return russian ? "неизвестно" : "unknown"; } } public static string SegmentBiomeLabel(int index, bool russian) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) try { if (index < 0 || index >= WarpSegments.Length) { return ""; } return ((object)MapHandler.GetBiomeForSegment((int)WarpSegments[index])/*cast due to .constrained prefix*/).ToString(); } catch { return ""; } } public static void WarpToSegmentIndex(int index) { try { if (RequireHostAction("warp to biome") && index >= 0 && index < WarpSegments.Length && ((int)WarpSegments[index] != 5 || !WarpLocalToPeakSpawn())) { MapHandler.JumpToSegment(WarpSegments[index]); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpToSegmentIndex: " + ex.Message)); } } } private static bool WarpLocalToPeakSpawn() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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) try { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead) { return false; } if (!TryFindPeakSpawn(out var position)) { return false; } ((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { position + Vector3.up * 1.5f, true }); return true; } catch (Exception e) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpLocalToPeakSpawn: " + RootExceptionMessage(e))); } return false; } } private static bool TryFindPeakSpawn(out Vector3 position) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_00bf: 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) position = Vector3.zero; try { if (MapHandler.Exists && (Object)(object)Singleton.Instance != (Object)null && (Object)(object)Singleton.Instance.respawnThePeak != (Object)null) { position = Singleton.Instance.respawnThePeak.position; return true; } } catch { } try { Transform val = null; float num = float.MinValue; Transform[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)null)) { string text = ((Object)((Component)val2).gameObject).name ?? ""; if ((text.IndexOf("peak", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("respawn", StringComparison.OrdinalIgnoreCase) >= 0) && val2.position.y > num) { val = val2; num = val2.position.y; } } } if ((Object)(object)val != (Object)null) { position = val.position; return true; } } catch { } return false; } public static void RefreshWorldObjects(string query, float radius) { //IL_002b: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) try { WorldObjectLabels.Clear(); WorldObjectPositions.Clear(); Character localCharacter = Character.localCharacter; Vector3 val = (((Object)(object)localCharacter != (Object)null) ? SafePosition(localCharacter) : Vector3.zero); string[] terms = ObjectSearchTerms(query); float num = Mathf.Clamp((radius <= 0f) ? 1200f : radius, 50f, 5000f); HashSet hashSet = new HashSet(); List list = new List(); Transform[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Transform val2 in array) { if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null || !((Component)val2).gameObject.activeInHierarchy) { continue; } GameObject val3 = InterestingRoot(val2); if ((Object)(object)val3 == (Object)null || !val3.activeInHierarchy) { continue; } int instanceID = ((Object)val3).GetInstanceID(); if (!hashSet.Contains(instanceID) && MatchesAnyTerm(WorldObjectSearchText(val3), terms)) { Vector3 position = val3.transform.position; float num2 = Vector3.Distance(val, position); if (!(num2 > num)) { hashSet.Add(instanceID); list.Add(new WorldObjectScanHit { Label = WorldObjectLabel(val3, num2), Position = position, Distance = num2 }); } } } list.Sort((WorldObjectScanHit a, WorldObjectScanHit b) => a.Distance.CompareTo(b.Distance)); int num3 = Mathf.Min(80, list.Count); for (int num4 = 0; num4 < num3; num4++) { WorldObjectLabels.Add(list[num4].Label); WorldObjectPositions.Add(list[num4].Position); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RefreshWorldObjects: " + ex.Message)); } } } public static Vector3 WorldObjectPosition(int index) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= WorldObjectPositions.Count) { return Vector3.zero; } return WorldObjectPositions[index]; } public static void WarpToWorldObject(int index) { //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_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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) try { if (index >= 0 && index < WorldObjectPositions.Count) { Vector3 val = WorldObjectPositions[index] + Vector3.up * 2f; TeleportToCoords(val.x, val.y, val.z); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] WarpToWorldObject: " + ex.Message)); } } } private static string[] ObjectSearchTerms(string query) { return (from x in (string.IsNullOrWhiteSpace(query) ? "bell belltower tower item luggage chest gloom campfire statue altar shrine biome spawn scout raven voice fog" : query).Split(new char[9] { ' ', ',', ';', '|', '/', '\\', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries) select x.Trim().ToLowerInvariant() into x where x.Length >= 2 select x).Distinct().ToArray(); } private static bool MatchesAnyTerm(string haystack, string[] terms) { if (string.IsNullOrWhiteSpace(haystack) || terms == null || terms.Length == 0) { return false; } for (int i = 0; i < terms.Length; i++) { if (haystack.IndexOf(terms[i], StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static GameObject InterestingRoot(Transform transform) { try { Item componentInParent = ((Component)transform).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)((Component)componentInParent).gameObject != (Object)null) { return ((Component)componentInParent).gameObject; } } catch { } try { Luggage componentInParent2 = ((Component)transform).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)((Component)componentInParent2).gameObject != (Object)null) { return ((Component)componentInParent2).gameObject; } } catch { } try { Biome componentInParent3 = ((Component)transform).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null && (Object)(object)((Component)componentInParent3).gameObject != (Object)null) { return ((Component)componentInParent3).gameObject; } } catch { } return ((Component)transform).gameObject; } private static string WorldObjectSearchText(GameObject root) { if ((Object)(object)root == (Object)null) { return ""; } List list = new List { ((Object)root).name }; try { Item component = root.GetComponent(); if ((Object)(object)component != (Object)null) { list.Add(component.GetName()); list.Add(((Object)component).name); if (component.UIData != null) { list.Add(component.UIData.itemName); } list.Add("item"); } } catch { } try { Luggage component2 = root.GetComponent(); if ((Object)(object)component2 != (Object)null) { list.Add(component2.displayName); list.Add("luggage chest container"); } } catch { } try { Biome component3 = root.GetComponent(); if ((Object)(object)component3 != (Object)null) { list.Add(((object)Unsafe.As(ref component3.biomeType)/*cast due to .constrained prefix*/).ToString()); list.Add("biome"); } } catch { } try { Component[] components = root.GetComponents(); foreach (Component val in components) { if ((Object)(object)val != (Object)null) { list.Add(((object)val).GetType().Name); } } } catch { } return string.Join(" ", list.Where((string x) => !string.IsNullOrWhiteSpace(x))).ToLowerInvariant(); } private static string WorldObjectLabel(GameObject root, float distance) { string value = (((Object)(object)root != (Object)null) ? ((Object)root).name : "Object"); try { Item component = root.GetComponent(); if ((Object)(object)component != (Object)null && !string.IsNullOrWhiteSpace(component.GetName())) { value = component.GetName(); } } catch { } try { Luggage component2 = root.GetComponent(); if ((Object)(object)component2 != (Object)null && !string.IsNullOrWhiteSpace(component2.displayName)) { value = component2.displayName; } } catch { } return $"{CleanObjectName(value)} [{distance:F0}m]"; } private static string CleanObjectName(string value) { if (string.IsNullOrWhiteSpace(value)) { return "Object"; } string text = value.Replace("(Clone)", "").Replace("_", " ").Trim(); if (text.Length <= 80) { return text; } return text.Substring(0, 80); } public static float ExpeditionTimeSeconds() { try { return RunTimeSeconds(RunManager.Instance); } catch { return 0f; } } public static float RunTimeSeconds(RunManager rm) { if ((Object)(object)rm == (Object)null) { return 0f; } try { return rm.TimeSinceRunStarted; } catch { try { return (RunTimeField != null) ? ((float)RunTimeField.GetValue(rm)) : 0f; } catch { return 0f; } } } public static void SetRunTimeLocal(RunManager rm, float seconds) { if ((Object)(object)rm == (Object)null) { return; } try { if (RunTimeField != null) { RunTimeField.SetValue(rm, Mathf.Max(0f, seconds)); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] SetRunTimeLocal: " + ex.Message)); } } } public static void SetExpeditionTime(float seconds) { try { if (!RequireHostAction("set run time")) { return; } RunManager instance = RunManager.Instance; if (!((Object)(object)instance == (Object)null)) { seconds = Mathf.Max(0f, seconds); SetRunTimeLocal(instance, seconds); if (PhotonNetwork.IsMasterClient) { ((MonoBehaviourPun)instance).photonView.RPC("RPC_SyncTime", (RpcTarget)0, new object[2] { seconds, true }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetExpeditionTime: " + ex.Message)); } } } public static float TimeOfDay() { try { return ((Object)(object)DayNightManager.instance != (Object)null) ? DayNightManager.instance.timeOfDay : 0f; } catch { return 0f; } } public static int DayCount() { try { return ((Object)(object)DayNightManager.instance != (Object)null) ? DayNightManager.instance.dayCount : 0; } catch { return 0; } } public static void SetTimeOfDay(float hour) { try { if (!RequireHostAction("set time of day")) { return; } DayNightManager instance = DayNightManager.instance; if ((Object)(object)instance == (Object)null) { return; } float num = Mathf.Repeat(hour, 24f); DayNightManager.SetTimeOfDay(num); instance.setTimeOfDay(num); instance.UpdateCycle(); try { FieldInfo field = typeof(DayNightManager).GetField("photonView", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(instance); PhotonView val = (PhotonView)((value is PhotonView) ? value : null); if (val != null) { val.RPC("RPCA_SyncTime", (RpcTarget)0, new object[2] { instance.dayCount, num }); } } } catch { } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetTimeOfDay: " + ex.Message)); } } } public static void ForceWin() { try { if (RequireHostAction("force win")) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { ((MonoBehaviourPun)localCharacter).photonView.RPC("RPCEndGame_ForceWin", (RpcTarget)0, new object[0]); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] ForceWin: " + ex.Message)); } } } public static void SpawnScoutmaster(Character target) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) try { RaycastHit val = default(RaycastHit); if (!RequireHostAction("spawn scoutmaster") || (Object)(object)target == (Object)null || !Physics.Raycast(((Component)target).transform.position + new Vector3(Random.Range(-10f, 10f), 25f, Random.Range(-10f, 10f)), Vector3.down, ref val, 100f)) { return; } Vector3 val2 = ((RaycastHit)(ref val)).point + Vector3.up; GameObject val3 = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val2, Quaternion.identity, (byte)0, (object[])null); if (!((Object)(object)val3 == (Object)null)) { Character component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.data.spawnPoint = ((Component)component).transform; } Scoutmaster component2 = val3.GetComponent(); if ((Object)(object)component2 != (Object)null) { TrySetScoutmasterTarget(val3, component2, target, 15f); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnScoutmaster: " + ex.Message)); } } } private static void TrySetScoutmasterTarget(GameObject scoutObject, Scoutmaster scoutmaster, Character target, float forceForSeconds) { try { if ((Object)(object)scoutmaster == (Object)null || (Object)(object)target == (Object)null) { return; } PhotonView photonView = ((MonoBehaviourPun)target).photonView; if (!((Object)(object)photonView == (Object)null) && photonView.ViewID > 0) { PhotonView val = (((Object)(object)scoutObject != (Object)null) ? scoutObject.GetComponent() : null); if (!((Object)(object)val == (Object)null)) { scoutmaster.currentTarget = target; val.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2] { photonView.ViewID, forceForSeconds }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[GameApi] Scoutmaster target skipped: " + ex.Message)); } } } private static int StatusCount() { try { return Mathf.Min(CharacterAfflictions.NumStatusTypes, StatusEn.Length); } catch { return StatusEn.Length; } } private static bool IsStatusIndex(int idx) { if (idx >= 0) { return idx < StatusCount(); } return false; } private static string StatusLabel(int idx) { if (idx < 0 || idx >= StatusEn.Length) { return idx.ToString(); } return StatusEn[idx]; } public static void FullStamina(Character c) { try { if (RequireHostForRemote(c, "refill stamina") && (Object)(object)c != (Object)null && (Object)(object)c.data != (Object)null) { c.data.currentStamina = 1f; c.data.extraStamina = Mathf.Max(c.data.extraStamina, 0f); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] FullStamina: " + ex.Message)); } } } public static void FullExtraStamina(Character c) { SetExtraStamina(c, 1f); } public static void SetExtraStamina(Character c, float amount) { try { Character val = c ?? Character.localCharacter; if (!((Object)(object)val == (Object)null) && RequireHostForRemote(val, "set extra stamina")) { float extraStamina = Mathf.Clamp01(amount); if (IsLocal(val)) { val.SetExtraStamina(extraStamina); } else if ((Object)(object)val.data != (Object)null) { val.data.extraStamina = extraStamina; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetExtraStamina: " + ex.Message)); } } } public static void SetStatus(Character c, int idx, float amount, bool track = true) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "set status")) { return; } CharacterAfflictions val2 = (((Object)(object)val != (Object)null && val.refs != null) ? val.refs.afflictions : null); if ((Object)(object)val2 == (Object)null || !IsStatusIndex(idx)) { return; } float num = Mathf.Clamp01(amount); STATUSTYPE val3 = (STATUSTYPE)idx; switch (idx) { case 13: SetPetrifyAmount(val, Mathf.RoundToInt(num * 100f), track); return; case 12: if (num <= 0.001f) { ClearArrows(val, track); } else { AddArrowPrank(val, Mathf.Clamp(Mathf.CeilToInt(num * 8f), 1, 8), track); } return; } PrepareLocalStatusWrite(val, val3, num); if (IsLocal(val)) { val2.SetStatus(val3, num, true); return; } float num2 = CurrentStatusValue(val, val3); float num3 = num - num2; if (Mathf.Abs(num3) > 0.0001f) { float[] array = new float[CharacterAfflictions.NumStatusTypes]; array[idx] = num3; PhotonView photonView = ((MonoBehaviourPun)val2).photonView; if ((Object)(object)photonView != (Object)null) { photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array }); } else { val2.SetStatus(val3, num, true); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetStatus: " + ex.Message)); } } } private static float CurrentStatusValue(Character c, STATUSTYPE type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) try { if ((int)type == 13 && (Object)(object)c != (Object)null && (Object)(object)c.data != (Object)null) { return Mathf.Clamp01((float)c.data.petrifyAmount / 100f); } CharacterAfflictions val = (((Object)(object)c != (Object)null && c.refs != null) ? c.refs.afflictions : null); return ((Object)(object)val != (Object)null) ? val.GetCurrentStatus(type) : 0f; } catch { return 0f; } } private static void PrepareLocalStatusWrite(Character target, STATUSTYPE type, float amount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected I4, but got Unknown if (IsLocal(target) && !(amount <= 0f)) { ModConfig.LockStatus = false; if (ModConfig.NoStatusEffects) { ModConfig.NoStatusEffects = false; } switch ((int)type) { case 0: ModConfig.NoInjury = false; break; case 1: ModConfig.NoHunger = false; break; case 2: ModConfig.NoCold = false; break; case 3: ModConfig.NoPoison = false; break; case 4: ModConfig.NoCrab = false; break; case 5: ModConfig.NoCurse = false; break; case 6: ModConfig.NoDrowsy = false; break; case 8: ModConfig.NoHot = false; break; case 9: ModConfig.NoThorns = false; break; case 10: ModConfig.NoSpores = false; break; case 11: ModConfig.NoWeb = false; break; case 12: ModConfig.NoArrows = false; break; case 13: ModConfig.NoPetrify = false; break; case 14: ModConfig.NoFlyTrap = false; break; case 7: break; } } } private static void PrepareLocalStatusBatch(Character target) { if (IsLocal(target)) { ModConfig.LockStatus = false; ModConfig.NoStatusEffects = false; ModConfig.NoInjury = false; ModConfig.NoHunger = false; ModConfig.NoCold = false; ModConfig.NoPoison = false; ModConfig.NoCrab = false; ModConfig.NoCurse = false; ModConfig.NoDrowsy = false; ModConfig.NoHot = false; ModConfig.NoThorns = false; ModConfig.NoSpores = false; ModConfig.NoWeb = false; ModConfig.NoArrows = false; ModConfig.NoPetrify = false; ModConfig.NoFlyTrap = false; } } public static void IncreaseStatus(Character c, int idx, float amount) { AdjustStatus(c, idx, Mathf.Max(0f, amount)); } public static void AdjustStatus(Character c, int idx, float delta) { try { Character val = c ?? Character.localCharacter; if (RequireHostForRemote(val, "adjust status") && !((Object)(object)(((Object)(object)val != (Object)null && val.refs != null) ? val.refs.afflictions : null) == (Object)null) && IsStatusIndex(idx)) { float amount = Mathf.Clamp01(CurrentStatusValue(val, (STATUSTYPE)idx) + delta); SetStatus(val, idx, amount, track: false); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] AdjustStatus: " + ex.Message)); } } } public static void IncreaseCommonStatuses(Character c, float amount) { if (RequireHostForRemote(c, "increase common statuses")) { int[] array = new int[14] { 0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14 }; for (int i = 0; i < array.Length; i++) { IncreaseStatus(c, array[i], amount); } } } public static void ClearAllStatus(Character c) { Character val = c ?? Character.localCharacter; if (RequireHostForRemote(val, "clear status")) { for (int i = 0; i < StatusCount(); i++) { SetStatus(val, i, 0f, track: false); } RemovePhysicalThorns(val, arrowsOnly: false, logFailures: false); SetPetrifyAmount(val, 0, track: false); } } public static void PrankAfflict(Character c) { Character val = c ?? Character.localCharacter; if (!((Object)(object)val == (Object)null) && RequireHostForRemote(val, "prank afflict")) { PrepareLocalStatusBatch(val); SetStatusAtLeast(val, 3, 0.1f); SetStatusAtLeast(val, 5, 0.1f); SetStatusAtLeast(val, 4, 0.1f); SetStatusAtLeast(val, 6, 0.1f); SetStatusAtLeast(val, 11, 0.1f); SetStatusAtLeast(val, 14, 0.1f); } } private static void SetStatusAtLeast(Character c, int idx, float amount) { try { float num = (((Object)(object)(((Object)(object)c != (Object)null && c.refs != null) ? c.refs.afflictions : null) != (Object)null && IsStatusIndex(idx)) ? CurrentStatusValue(c, (STATUSTYPE)idx) : 0f); SetStatus(c, idx, Mathf.Max(num, Mathf.Clamp01(amount)), track: false); } catch { SetStatus(c, idx, Mathf.Clamp01(amount), track: false); } } public static void PetrifyPlayer(Character c) { SetPetrifyAmount(c ?? Character.localCharacter, 100); } public static void ClearPetrify(Character c) { SetPetrifyAmount(c ?? Character.localCharacter, 0); } public static void SetPetrifyAmount(Character c, int amount, bool track = true) { try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || !RequireHostForRemote(val, "set petrify")) { return; } int num = Mathf.Clamp(amount, 0, 100); if (IsLocal(val)) { val.data.SetPetrify(num); return; } PhotonView photonView = ((MonoBehaviourPun)val.data).photonView; if ((Object)(object)photonView != (Object)null) { photonView.RPC("RPC_SyncPetrify", (RpcTarget)0, new object[1] { num }); } else { val.data.SetPetrify(num); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SetPetrifyAmount: " + ex.Message)); } } } public static void AddArrowPrank(Character c, int count = 1, bool track = true) { //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null) { return; } if (!IsLocal(val)) { AddAdminLog(SafeCharacterName(val) + ": arrows can only be added by that player's client"); ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] add arrows: target owner only"); } return; } CharacterAfflictions val2 = ((val.refs != null) ? val.refs.afflictions : null); if (!((Object)(object)val2 == (Object)null)) { int num = Mathf.Clamp(count, 1, 12); for (int i = 0; i < num; i++) { Vector3 val3 = Random.insideUnitSphere * 0.35f; val2.AddArrow(SafePosition(val) + Vector3.up * 0.8f + val3, Vector3.up); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] AddArrowPrank: " + ex.Message)); } } } public static void ClearArrows(Character c, bool track = true) { RemovePhysicalThorns(c ?? Character.localCharacter, arrowsOnly: true, track); } public static void ClearThorns(Character c, bool track = true) { RemovePhysicalThorns(c ?? Character.localCharacter, arrowsOnly: false, track, thornsOnly: true); } private static int RemovePhysicalThorns(Character c, bool arrowsOnly, bool logFailures, bool thornsOnly = false) { try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null) { return 0; } if (!RequireHostForRemote(val, arrowsOnly ? "clear arrows" : "clear thorns")) { return 0; } CharacterAfflictions val2 = ((val.refs != null) ? val.refs.afflictions : null); List list = (((Object)(object)val2 != (Object)null) ? val2.physicalThorns : null); if ((Object)(object)val2 == (Object)null || list == null) { return 0; } int num = 0; for (int i = 0; i < list.Count; i++) { ThornOnMe val3 = list[i]; if ((Object)(object)val3 == (Object)null || !val3.stuckIn || (arrowsOnly && !val3.isArrow) || (thornsOnly && !val3.isThorn)) { continue; } if (IsLocal(val)) { val2.RemoveThorn(val3, false); } else { PhotonView photonView = ((MonoBehaviourPun)val2).photonView; if ((Object)(object)photonView != (Object)null && photonView.Owner != null) { photonView.RPC("RemoveThornRPC", photonView.Owner, new object[2] { i, false }); } else if ((Object)(object)photonView != (Object)null) { photonView.RPC("RemoveThornRPC", (RpcTarget)0, new object[2] { i, false }); } } num++; } return num; } catch (Exception ex) { if (logFailures) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] RemovePhysicalThorns: " + ex.Message)); } } return 0; } } public static void PrankSpawnItems(Character c, int itemIndex, int count) { EnsureItemsLoaded(); Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || itemIndex < 0 || itemIndex >= Items.Count || !RequireHostForRemote(val, "prank spawn items")) { return; } int num = SlotCountFor(val); if (num > 0) { int num2 = Mathf.Clamp(count, 1, num); for (int i = 0; i < num2; i++) { SpawnToSlotFor(val, itemIndex, i); } } } public static int FindItemIndex(params string[] fragments) { EnsureItemsLoaded(); if (fragments == null || fragments.Length == 0) { return -1; } for (int i = 0; i < ItemNames.Count; i++) { string text = ItemSearchText(i); if (string.IsNullOrWhiteSpace(text)) { continue; } foreach (string text2 in fragments) { if (!string.IsNullOrWhiteSpace(text2) && text.Contains(text2.ToLowerInvariant())) { return i; } } } return -1; } public static void ScheduleKnifeFight() { if (!IsHost()) { AddAdminLog((Localization.Current == Lang.Russian) ? "Поножовщину может запустить только хост." : "Only the host can start Knife Fight."); return; } _knifeFightAt = Time.realtimeSinceStartup + 5f; _knifeFightCountdownSecond = -1; AddAdminLog((Localization.Current == Lang.Russian) ? "Поножовщина начнётся через 5 секунд." : "Knife Fight starts in 5 seconds."); } public static void TickScheduledActions() { if (_knifeFightAt < 0f) { return; } float num = _knifeFightAt - Time.realtimeSinceStartup; if (num > 0f) { int num2 = Mathf.CeilToInt(num); if (num2 != _knifeFightCountdownSecond) { _knifeFightCountdownSecond = num2; AdminNoticeText = ((Localization.Current == Lang.Russian) ? $"Поножовщина: {num2}" : $"Knife Fight: {num2}"); AdminNoticeUntil = Time.realtimeSinceStartup + 1.2f; } return; } _knifeFightAt = -1f; _knifeFightCountdownSecond = -1; if (!IsHost()) { return; } int num3 = FindRitualDaggerIndex(); if (num3 < 0) { AddAdminLog((Localization.Current == Lang.Russian) ? "Поножовщина: ритуальный кинжал не найден в базе предметов." : "Knife Fight: ritual dagger was not found in the item database."); return; } RefreshPlayers(); int num4 = 0; for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if ((Object)(object)val != (Object)null && SlotCountFor(val) >= 3 && SpawnToSlotFor(val, num3, 2)) { num4++; } } AddAdminLog((Localization.Current == Lang.Russian) ? $"Поножовщина началась: кинжал выдан игрокам ({num4})." : $"Knife Fight started: daggers supplied ({num4})."); } private static int FindRitualDaggerIndex() { EnsureItemsLoaded(); for (int i = 0; i < Items.Count; i++) { string text = ItemSearchText(i); if (text.IndexOf("ritual", StringComparison.OrdinalIgnoreCase) >= 0 && (text.IndexOf("dagger", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("knife", StringComparison.OrdinalIgnoreCase) >= 0)) { return i; } } return FindItemIndex("ritual dagger", "sacrificial dagger", "dagger"); } public static int FindGoldenItemIndex() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) EnsureItemsLoaded(); for (int i = 0; i < Items.Count; i++) { try { if ((Object)(object)Items[i] != (Object)null && ((Enum)Items[i].itemTags).HasFlag((Enum)(object)(ItemTags)64)) { return i; } } catch { } } return FindItemIndex("gold", "golden", "idol", "coin", "treasure", "valuable"); } public static int FindWebItemIndex() { int num = FindItemIndex("web", "spider", "silk", "cocoon"); if (num >= 0) { return num; } return FindItemIndexByComponent("Spider", "Web", "Silk"); } public static int FindBackpackItemIndex() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 EnsureItemsLoaded(); for (int i = 0; i < Items.Count; i++) { try { Item obj = Items[i]; Backpack val = (Backpack)(object)((obj is Backpack) ? obj : null); if (val != null && (int)val.backpackType == 1) { return i; } } catch { } } int num = FindItemIndex("backpack", "rucksack"); if (num >= 0) { return num; } return FindItemIndexByComponent("Backpack", "Pack"); } private static List FindCampfireBackpackItemIndices() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 EnsureItemsLoaded(); List list = new List(); for (int i = 0; i < Items.Count; i++) { try { Item obj = Items[i]; Backpack val = (Backpack)(object)((obj is Backpack) ? obj : null); if (val != null && ((int)val.backpackType == 1 || (int)val.backpackType == 2)) { list.Add(i); } } catch { } } if (list.Count == 0) { int num = FindBackpackItemIndex(); if (num >= 0) { list.Add(num); } } return list; } private static int FindHotDogItemIndex() { int num = FindItemIndex("hot dog", "hotdog", "hot-dog", "sausage"); if (num < 0) { return FindItemIndexByComponent("Hotdog", "HotDog", "Sausage"); } return num; } private static int FindMarshmallowItemIndex() { int num = FindItemIndex("marshmallow", "mallow"); if (num < 0) { return FindItemIndexByComponent("Marshmallow", "Mallow"); } return num; } public static int FindRandomFoodItemIndex() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) EnsureItemsLoaded(); List list = new List(); for (int i = 0; i < Items.Count; i++) { try { if (CanPocketItem(i)) { Item val = Items[i]; bool num = ((Enum)val.itemTags).HasFlag((Enum)(object)(ItemTags)2) || ((Enum)val.itemTags).HasFlag((Enum)(object)(ItemTags)4) || ((Enum)val.itemTags).HasFlag((Enum)(object)(ItemTags)8) || ((Enum)val.itemTags).HasFlag((Enum)(object)(ItemTags)32); string text = ItemSearchText(i); bool flag = text.Contains("food") || text.Contains("berry") || text.Contains("mushroom") || text.Contains("ration") || text.Contains("trail") || text.Contains("cookie") || text.Contains("lunch") || text.Contains("egg") || text.Contains("fruit"); if (num || flag) { list.Add(i); } } } catch { } } if (list.Count == 0) { return -1; } return list[Random.Range(0, list.Count)]; } public static void SpawnItemSet(Character c, string setId) { try { Character val = c ?? Character.localCharacter; if ((Object)(object)val == (Object)null || !RequireHostForRemote(val, "spawn item set")) { return; } string text = (setId ?? "").Trim().ToLowerInvariant(); int num = SlotCountFor(val); if (num <= 0) { return; } List list = new List(); switch (text) { default: return; case "food": { for (int i = 0; i < Mathf.Min(num, 4); i++) { list.Add(FindRandomFoodItemIndex()); } break; } case "rescue": list.Add(FindItemIndex("rope", "climbing rope")); list.Add(FindItemIndex("bandage", "medkit", "medicine", "cure", "heal")); list.Add(FindItemIndex("flare", "torch", "lantern", "light")); break; case "light": list.Add(FindItemIndex("lantern", "torch", "flare", "lamp")); list.Add(FindItemIndex("battery", "fuel", "oil")); list.Add(FindItemIndex("flare", "torch")); break; case "mobility": { int num2 = FindItemIndex("jetpack", "rocketpack", "fannypack", "backpack", "rucksack"); if (num2 >= 0 && CanBackSlotItem(num2)) { SpawnToBackSlotFor(val, num2); } list.Add(FindItemIndex("rope", "climbing rope")); list.Add(FindItemIndex("piton", "hook", "grappling")); break; } } int num3 = 0; int num4 = 0; for (int j = 0; j < list.Count; j++) { if (num4 >= num) { break; } int num5 = list[j]; if (num5 >= 0) { if (SpawnToSlotFor(val, num5, num4)) { num3++; } num4++; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] SpawnItemSet: " + ex.Message)); } } } public static void GiveEveryoneFood(int itemsPerPlayer = 2) { try { RefreshPlayers(); int num = Mathf.Clamp(itemsPerPlayer, 1, 6); int num2 = 0; for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if ((Object)(object)val == (Object)null) { continue; } int num3 = SlotCountFor(val); if (num3 <= 0) { continue; } for (int j = 0; j < Mathf.Min(num, num3); j++) { int num4 = FindRandomFoodItemIndex(); if (num4 >= 0 && SpawnToSlotFor(val, num4, j)) { num2++; } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] GiveEveryoneFood: " + ex.Message)); } } } public static void GiveEveryoneBackpacks() { try { int num = FindBackpackItemIndex(); if (num < 0) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] Backpack item not found."); } return; } RefreshPlayers(); int num2 = 0; for (int i = 0; i < PlayerChars.Count; i++) { Character val = PlayerChars[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.player == (Object)null) && val.player.backpackSlot != null && RequireHostForRemote(val, "give backpack")) { SetSlotItem((ItemSlot)(object)val.player.backpackSlot, Items[num]); SyncInventory(val.player, (RpcTarget)0); num2++; } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] GiveEveryoneBackpacks: " + ex.Message)); } } } public static void SpawnCampfireFoodForLobby() { //IL_004b: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) try { if (!RequireHostAction("spawn campfire food")) { return; } int num = FindHotDogItemIndex(); int num2 = FindMarshmallowItemIndex(); if (num < 0 && num2 < 0) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] Campfire food items not found."); } return; } int num3 = Mathf.Max(1, LobbyPlayerCount()); Vector3 center = FindCampfireSpawnCenter(); int num4 = 0; for (int i = 0; i < num3; i++) { int num5 = PickCampfireFoodIndex(num, num2); if (num5 >= 0 && SpawnWorldItem(num5, SpreadAround(center, i, num3, 1.25f), Quaternion.Euler(0f, Random.Range(0f, 360f), 0f))) { num4++; } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] SpawnCampfireFoodForLobby: " + ex.Message)); } } } public static void SpawnCampfireBackpacksForLobby() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00b7: Unknown result type (might be due to invalid IL or missing references) try { if (!RequireHostAction("spawn campfire backpacks")) { return; } List list = FindCampfireBackpackItemIndices(); if (list.Count == 0) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] Campfire backpack items not found."); } return; } int num = Mathf.Clamp(Mathf.CeilToInt((float)Mathf.Max(1, LobbyPlayerCount()) / 4f), 1, 8); Vector3 center = FindCampfireSpawnCenter() + new Vector3(0f, 0.15f, 0f); int num2 = 0; for (int i = 0; i < num; i++) { if (SpawnWorldItem(list[Random.Range(0, list.Count)], SpreadAround(center, i, num, 1.75f), Quaternion.Euler(0f, Random.Range(0f, 360f), 0f))) { num2++; } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] SpawnCampfireBackpacksForLobby: " + ex.Message)); } } } public static void SpawnCampfireSuppliesForLobby() { SpawnCampfireFoodForLobby(); SpawnCampfireBackpacksForLobby(); } private static int PickCampfireFoodIndex(int hotDog, int marshmallow) { if (hotDog >= 0 && marshmallow >= 0) { if (!(Random.value < 0.5f)) { return marshmallow; } return hotDog; } if (hotDog < 0) { return marshmallow; } return hotDog; } private static int RandomBackSlotItemIndex() { EnsureItemsLoaded(); List list = new List(); for (int i = 0; i < Items.Count; i++) { if (CanBackSlotItem(i)) { list.Add(i); } } if (list.Count == 0) { return -1; } return list[Random.Range(0, list.Count)]; } private static int LobbyPlayerCount() { try { RefreshPlayers(); if (PlayerChars.Count > 0) { return PlayerChars.Count; } } catch { } try { if (PhotonNetwork.CurrentRoom != null) { return PhotonNetwork.CurrentRoom.PlayerCount; } } catch { } return 1; } private static Vector3 FindCampfireSpawnCenter() { //IL_0019: 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_00fb: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) Vector3 result; try { Vector3 val = (((Object)(object)Character.localCharacter != (Object)null) ? SafePosition(Character.localCharacter) : Vector3.zero); Campfire[] array = Object.FindObjectsByType((FindObjectsSortMode)0); Campfire val2 = null; float num = float.MaxValue; foreach (Campfire val3 in array) { if (!((Object)(object)val3 == (Object)null)) { result = ((Component)val3).transform.position - val; float sqrMagnitude = ((Vector3)(ref result)).sqrMagnitude; if ((Object)(object)val2 == (Object)null || sqrMagnitude < num) { val2 = val3; num = sqrMagnitude; } } } if ((Object)(object)val2 != (Object)null) { result = ((Component)val2).transform.position + Vector3.up * 0.45f; goto IL_0101; } } catch { } try { if ((Object)(object)Character.localCharacter != (Object)null) { result = SafePosition(Character.localCharacter) + ((Component)Character.localCharacter).transform.forward * 2f + Vector3.up; goto IL_0101; } } catch { } return Vector3.up; IL_0101: return result; } private static Vector3 SpreadAround(Vector3 center, int index, int count, float radius) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0049: 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_0056: 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_006d: 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) float num = ((count <= 1) ? Random.Range(0f, (float)Math.PI * 2f) : ((float)Math.PI * 2f * (float)index / (float)count)); Vector3 val = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius; val += Random.insideUnitSphere * 0.25f; val.y = Mathf.Abs(val.y) * 0.25f; return center + val; } private static bool SpawnWorldItem(int itemIndex, Vector3 position, Quaternion rotation) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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) try { if (itemIndex < 0 || itemIndex >= Items.Count || (Object)(object)Items[itemIndex] == (Object)null || (Object)(object)((Component)Items[itemIndex]).gameObject == (Object)null) { return false; } if (!HasResourcePrefab(Items[itemIndex])) { return false; } if (!PhotonNetwork.IsMasterClient) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] World item spawn requires host."); } return false; } string name = ((Object)((Component)Items[itemIndex]).gameObject).name; GameObject val = PhotonNetwork.InstantiateItemRoom(name, position, rotation, true); if ((Object)(object)val == (Object)null) { val = PhotonNetwork.Instantiate("0_Items/" + name, position, rotation, (byte)0, (object[])null); } return (Object)(object)val != (Object)null; } catch (Exception e) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[GameApi] SpawnWorldItem: " + RootExceptionMessage(e))); } return false; } } public static void FillInventoryWithGold(Character c) { if (!RequireHostForRemote(c ?? Character.localCharacter, "fill inventory with gold")) { return; } int num = FindGoldenItemIndex(); if (num >= 0) { FillInventoryWith(c, num); return; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"[GameApi] Gold item not found."); } } public static void FillInventoryWithWebs(Character c) { if (RequireHostForRemote(c ?? Character.localCharacter, "fill inventory with webs")) { int num = FindWebItemIndex(); if (num >= 0) { FillInventoryWith(c, num); } else { SetStatusAtLeast(c ?? Character.localCharacter, 11, 0.18f); } } } public static void TieBalloons(Character c, int count) { try { Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "tie balloons")) { return; } CharacterBalloons val2 = val?.refs?.balloons; if (!((Object)(object)val2 == (Object)null)) { int num = Mathf.Clamp(count, 1, 8); int num2 = ((val2.balloonColors == null || val2.balloonColors.Length == 0) ? 1 : val2.balloonColors.Length); for (int i = 0; i < num; i++) { val2.TieNewBalloon(Random.Range(0, num2)); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] TieBalloons: " + ex.Message)); } } } public static void DropAllInventory(Character c, bool track = true) { //IL_0054: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) try { Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "drop inventory") || (Object)(object)val == (Object)null || (Object)(object)val.refs?.items == (Object)null || (Object)(object)val.player == (Object)null) { return; } Vector3 val2 = SafePosition(val) + Vector3.up * 0.8f; int num = 0; int num2 = SlotCountFor(val); for (int i = 0; i < num2; i++) { ItemSlot val3 = ((val.player.itemSlots != null && i < val.player.itemSlots.Length) ? val.player.itemSlots[i] : null); if (val3 != null && !val3.IsEmpty()) { if (!CanDropSlot(val3)) { ClearSlotFor(val, i); continue; } DropSlotByRpc(val, (byte)i, val2 + Vector3.up * (0.35f * (float)num)); num++; } } if (val.player.backpackSlot != null && !((ItemSlot)val.player.backpackSlot).IsEmpty()) { if (CanDropSlot((ItemSlot)(object)val.player.backpackSlot)) { DropSlotByRpc(val, 3, val2 + Vector3.up * (0.35f * (float)num)); num++; } else { ((ItemSlot)val.player.backpackSlot).EmptyOut(); SyncTargetInventory(val); } } if (val.player.tempFullSlot != null && !val.player.tempFullSlot.IsEmpty()) { if (CanDropSlot(val.player.tempFullSlot)) { DropSlotByRpc(val, 250, val2 + Vector3.up * (0.35f * (float)num)); num++; } else { val.player.tempFullSlot.EmptyOut(); SyncTargetInventory(val); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GameApi] DropAllInventory: " + ex.Message)); } } } private static bool CanDropSlot(ItemSlot slot) { try { if (slot == null || slot.IsEmpty()) { return false; } Item val = SlotPrefab(slot); if ((Object)(object)val != (Object)null && val.UIData != null && !val.UIData.canDrop) { return false; } return HasResourcePrefabName(slot.GetPrefabName()); } catch { return false; } } private static void DropSlotByRpc(Character target, byte slot, Vector3 spawnPosition) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) try { ((MonoBehaviourPun)target.refs.items).photonView.RPC("DropItemFromSlotRPC", (RpcTarget)0, new object[2] { slot, spawnPosition }); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[GameApi] DropSlotByRpc {slot}: {ex.Message}"); } } } private static string ItemSearchText(int index) { try { Item val = ((index >= 0 && index < Items.Count) ? Items[index] : null); string text = ((index >= 0 && index < ItemNames.Count) ? ItemNames[index] : ""); if ((Object)(object)val == (Object)null) { return (text ?? "").ToLowerInvariant(); } return string.Join(" ", text, ((Object)val).name, ((Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : "", (val.UIData != null) ? val.UIData.itemName : "", ((object)Unsafe.As(ref val.itemTags)/*cast due to .constrained prefix*/).ToString(), ((object)val).GetType().Name).ToLowerInvariant(); } catch { return ""; } } private static int FindItemIndexByComponent(params string[] fragments) { EnsureItemsLoaded(); for (int i = 0; i < Items.Count; i++) { Item val = Items[i]; if ((Object)(object)val == (Object)null) { continue; } try { Component[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { string text = (((Object)(object)componentsInChildren[j] != (Object)null) ? ((object)componentsInChildren[j]).GetType().Name.ToLowerInvariant() : ""); for (int k = 0; k < fragments.Length; k++) { if (!string.IsNullOrWhiteSpace(fragments[k]) && text.Contains(fragments[k].ToLowerInvariant())) { return i; } } } } catch { } } return -1; } public static void FillInventoryWith(Character c, int itemIndex) { EnsureItemsLoaded(); if (itemIndex < 0 || itemIndex >= Items.Count) { return; } Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "fill inventory")) { return; } int num = (((Object)(object)val != (Object)null) ? SlotCountFor(val) : SlotCount()); if (CanPocketItem(itemIndex)) { for (int i = 0; i < num; i++) { SpawnToSlotFor(val, itemIndex, i); } } int num2 = BackpackSlotCount(val); if (CanBackpackItem(itemIndex)) { for (int j = 0; j < num2; j++) { SpawnToBackpackSlotFor(val, itemIndex, j); } } if (CanBackSlotItem(itemIndex)) { SpawnToBackSlotFor(val, itemIndex); } if (IsScoutAmuletItem(Items[itemIndex])) { SpawnToTempSlotFor(val, itemIndex); } } public static void FillInventoryWithRandom(Character c) { EnsureItemsLoaded(); if (Items.Count == 0) { return; } Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "fill random inventory")) { return; } int num = (((Object)(object)val != (Object)null) ? SlotCountFor(val) : SlotCount()); if (num <= 0) { return; } for (int i = 0; i < num; i++) { int num2 = RandomItemIndexForSlot(backpack: false); if (num2 >= 0) { SpawnToSlotFor(val, num2, i); } } int num3 = BackpackSlotCount(val); for (int j = 0; j < num3; j++) { int num4 = RandomItemIndexForSlot(backpack: true); if (num4 >= 0) { SpawnToBackpackSlotFor(val, num4, j); } } int num5 = RandomBackSlotItemIndex(); if (num5 >= 0) { SpawnToBackSlotFor(val, num5); } } public static void ClearInventory(Character c) { Character val = c ?? Character.localCharacter; if (!RequireHostForRemote(val, "clear inventory")) { return; } int num = (((Object)(object)val != (Object)null) ? SlotCountFor(val) : SlotCount()); if (num > 0) { for (int i = 0; i < num; i++) { ClearSlotFor(val, i); } int num2 = BackpackSlotCount(val); for (int j = 0; j < num2; j++) { ClearBackpackSlotFor(val, j); } ClearTempSlotFor(val); ClearBackSlotFor(val); } } public static string PlayerDisplayName(Character c) { return SafeCharacterName(c); } public static string PlayerModVersion(Character c) { try { Player val = OwnerOf(c); if (((val != null) ? val.CustomProperties : null) == null) { return ""; } object value; return ((Dictionary)(object)val.CustomProperties).TryGetValue((object)"pmx_ver", out value) ? ((value as string) ?? "") : ""; } catch { return ""; } } public static float DistanceToLocal(Character c) { //IL_0021: 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) try { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)c == (Object)null) { return -1f; } return Vector3.Distance(SafePosition(localCharacter), SafePosition(c)); } catch { return -1f; } } public static bool IsDead(Character c) { try { return (Object)(object)c != (Object)null && (Object)(object)c.data != (Object)null && c.data.dead; } catch { return false; } } public static string PlayerDetails(Character c, bool russian) { if ((Object)(object)c == (Object)null) { if (!russian) { return "No player selected."; } return "Игрок не выбран."; } List list = new List(); string text = SafeCharacterName(c); bool flag = IsDead(c); bool flag2 = IsLocal(c); list.Add(text + ((!flag2) ? "" : (russian ? " (ты)" : " (you)"))); list.Add((!flag) ? (russian ? "Состояние: жив" : "State: alive") : (russian ? "Состояние: мёртв" : "State: dead")); float num = DistanceToLocal(c); if (!flag2 && num >= 0f) { list.Add((russian ? "Дистанция: " : "Distance: ") + num.ToString("0") + " m"); } string text2 = PlayerModVersion(c); list.Add((russian ? "PEAK-MX: " : "PEAK-MX: ") + ((!string.IsNullOrWhiteSpace(text2)) ? ("v" + text2) : (russian ? "нет данных" : "no data"))); try { if ((Object)(object)c.data != (Object)null) { list.Add((russian ? "Стамина: " : "Stamina: ") + Mathf.RoundToInt(Mathf.Clamp01(c.data.currentStamina) * 100f) + "% + " + Mathf.RoundToInt(Mathf.Max(0f, c.data.extraStamina) * 100f) + "%"); } } catch { } string text3 = StatusSummary(c, russian); if (!string.IsNullOrWhiteSpace(text3)) { list.Add((russian ? "Недуги: " : "Afflictions: ") + text3); } int num2 = SlotCountFor(c); if (num2 > 0) { list.Add(russian ? "Инвентарь:" : "Inventory:"); for (int i = 0; i < num2; i++) { list.Add(" " + (i + 1) + ". " + DescribeSlot(c, i)); } list.Add(" " + (russian ? "Спина: " : "Back: ") + DescribeBackSlot(c)); list.Add(" " + (russian ? "Амулет/временный: " : "Amulet/temp: ") + DescribeTempSlot(c)); } int num3 = BackpackSlotCount(c); if (num3 > 0) { list.Add(russian ? "Рюкзак:" : "Backpack:"); for (int j = 0; j < num3; j++) { list.Add(" B" + (j + 1) + ". " + DescribeBackpackSlot(c, j)); } } else { list.Add(russian ? "Рюкзак: нет / не синхронизирован" : "Backpack: none / not synced"); } if (IsMuted(c)) { list.Add(russian ? "Мут: включён" : "Mute: on"); } if (IsFrozen(c)) { list.Add(russian ? "Фриз: включён" : "Freeze: on"); } if (IsInventoryLocked(c)) { list.Add(russian ? "Инвентарь: запрещён" : "Inventory lock: on"); } if (IsSessionBanned(c)) { list.Add(russian ? "Бан: сессионный" : "Ban: session"); } return string.Join("\n", list.ToArray()); } private static string StatusSummary(Character c, bool russian) { try { if ((Object)(object)(((Object)(object)c != (Object)null && c.refs != null) ? c.refs.afflictions : null) == (Object)null) { return ""; } List list = new List(); string[] array = (russian ? StatusRu : StatusEn); for (int i = 0; i < StatusCount(); i++) { float num = CurrentStatusValue(c, (STATUSTYPE)i); if (!(num < 0.01f)) { string text = ((i >= 0 && i < array.Length) ? array[i] : i.ToString()); list.Add(text + " " + Mathf.RoundToInt(num * 100f) + "%"); } } return string.Join(", ", list.ToArray()); } catch { return ""; } } private static string SafeItemName(int itemIndex) { try { return (itemIndex >= 0 && itemIndex < ItemNames.Count) ? ItemNames[itemIndex] : itemIndex.ToString(); } catch { return itemIndex.ToString(); } } private static string SafeCharacterName(Character c) { try { if ((Object)(object)c == (Object)null) { return "Unknown"; } if (!string.IsNullOrWhiteSpace(c.characterName)) { return c.characterName; } Player obj = OwnerOf(c); string text = ((obj != null) ? obj.NickName : null); return string.IsNullOrWhiteSpace(text) ? "Unknown" : text; } catch { return "Unknown"; } } private static string SafeLuggageName(Luggage lug) { try { return ((Object)(object)lug != (Object)null && !string.IsNullOrWhiteSpace(lug.displayName)) ? lug.displayName : "Container"; } catch { return "Container"; } } static GameApi() { Segment[] array = new Segment[7]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); WarpSegments = (Segment[])(object)array; SegmentNamesEn = new string[7] { "Beach", "Tropics", "Alpine", "Caldera", "The Kiln", "Peak", "Void" }; SegmentNamesRu = new string[7] { "Пляж", "Тропики", "Альпы", "Кальдера", "Печь", "Пик", "Пустота" }; LuggageLabels = new List(); LuggageObjects = new List(); WorldObjectLabels = new List(); WorldObjectPositions = new List(); StatusEn = new string[15] { "Injury", "Hunger", "Cold", "Poison", "Crab", "Curse", "Drowsy", "Weight", "Hot", "Thorns", "Spores", "Web", "Arrows", "Petrify", "Flytrap" }; StatusRu = new string[15] { "Травма", "Голод", "Холод", "Яд", "Краб", "Проклятие", "Сонливость", "Вес", "Жара", "Шипы", "Споры", "Паутина", "Стрелы", "Окаменение", "Мухоловка" }; } } internal static class ItemEsp { private static readonly GUIContent LabelContent = new GUIContent(); private static GUIStyle _label; private static Texture2D _pixel; public static void Draw() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) try { if (!ModConfig.ItemEsp || (Event.current != null && (int)Event.current.type != 7)) { return; } Camera val = Camera.main ?? Camera.current; if ((Object)(object)val == (Object)null) { return; } Theme.EnsureBuilt(); EnsureStyle(); if (!EspPositions.TryObserver(val, out var position)) { return; } float num = Mathf.Max(1f, ModConfig.ItemEspDistance); float num2 = num * num; ushort selectedId = GameApi.ItemIdAt(ModConfig.ItemEspSelectedIndex); string search = (ModConfig.ItemEspSearch ?? "").Trim().ToLowerInvariant(); List aLL_ACTIVE_ITEMS = Item.ALL_ACTIVE_ITEMS; if (aLL_ACTIVE_ITEMS == null) { return; } for (int i = 0; i < aLL_ACTIVE_ITEMS.Count; i++) { Item item = aLL_ACTIVE_ITEMS[i]; if (ShouldDraw(item, selectedId, search) && EspPositions.TryItem(item, out var position2)) { Vector3 val2 = position2 - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num2)) { float num3 = Mathf.Sqrt(sqrMagnitude); DrawMarker(ProjectToScreenEdge(val, position2 + Vector3.up * 0.25f, out var offscreen), $"{ItemName(item)} {num3:0}m", num3, offscreen); } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[ItemEsp] " + ex.Message)); } } } private static bool ShouldDraw(Item item, ushort selectedId, string search) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null || !((Component)item).gameObject.activeInHierarchy) { return false; } try { if ((int)item.itemState != 0) { return false; } } catch { } if (selectedId != ushort.MaxValue && item.itemID != selectedId) { return false; } if (string.IsNullOrWhiteSpace(search)) { return true; } return (ItemName(item) + " " + ((Object)item).name + " " + (((Object)(object)((Component)item).gameObject != (Object)null) ? ((Object)((Component)item).gameObject).name : "") + " " + ((item.UIData != null) ? item.UIData.itemName : "") + " " + ((object)Unsafe.As(ref item.itemTags)/*cast due to .constrained prefix*/).ToString() + " " + ((object)item).GetType().Name).ToLowerInvariant().IndexOf(search, StringComparison.Ordinal) >= 0; } private static void DrawMarker(Vector2 center, string text, float distance, bool offscreen) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(1.15f - distance / Mathf.Max(50f, ModConfig.ItemEspDistance)); Color donate = Theme.Donate; donate.a = Mathf.Lerp(0.5f, 1f, num); Color color = default(Color); ((Color)(ref color))..ctor(0.02f, 0.025f, 0.03f, Mathf.Lerp(0.38f, 0.78f, num)); if (ModConfig.ItemEspLines) { DrawLine(new Vector2((float)Screen.width * 0.5f, (float)Screen.height - 18f), center, donate, 1.25f); } float num2 = (offscreen ? 16f : Mathf.Clamp(18f - distance * 0.015f, 7f, 18f)); DrawRect(new Rect(center.x - num2 * 0.5f, center.y - 1f, num2, 2f), donate); DrawRect(new Rect(center.x - 1f, center.y - num2 * 0.5f, 2f, num2), donate); LabelContent.text = text; Vector2 val = _label.CalcSize(LabelContent); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(Mathf.Clamp(center.x - val.x * 0.5f - 8f, 4f, (float)Screen.width - val.x - 16f), Mathf.Clamp(center.y - 30f, 4f, (float)Screen.height - 24f), val.x + 16f, 22f); DrawRect(val2, color); DrawRect(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).yMax - 2f, ((Rect)(ref val2)).width, 2f), donate); GUI.Label(val2, text, _label); } private static Vector2 ProjectToScreenEdge(Camera camera, Vector3 world, out bool offscreen) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = camera.WorldToViewportPoint(world); bool flag = val.z <= 0.01f; if (flag) { val.x = 1f - val.x; val.y = 1f - val.y; } offscreen = flag || val.x < 0f || val.x > 1f || val.y < 0f || val.y > 1f; if (offscreen) { val.x = Mathf.Clamp(val.x, 0.04f, 0.96f); val.y = Mathf.Clamp(val.y, 0.06f, 0.94f); } return new Vector2(val.x * (float)Screen.width, (1f - val.y) * (float)Screen.height); } private static string ItemName(Item item) { try { string name = item.GetName(); if (!string.IsNullOrWhiteSpace(name)) { return name; } } catch { } try { if (item.UIData != null && !string.IsNullOrWhiteSpace(item.UIData.itemName)) { return item.UIData.itemName; } } catch { } try { return ((Object)((Component)item).gameObject).name; } catch { return "Item"; } } private static void EnsureStyle() { //IL_0029: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if ((Object)(object)_pixel == (Object)null) { _pixel = Texture2D.whiteTexture; } if (_label == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 12, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; val.clipping = (TextClipping)1; _label = val; } } private static void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private static void DrawLine(Vector2 a, Vector2 b, Color color, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004a: 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_0069: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 matrix = GUI.matrix; Color color2 = GUI.color; float num = Mathf.Atan2(b.y - a.y, b.x - a.x) * 57.29578f; float num2 = Vector2.Distance(a, b); GUI.color = color; GUIUtility.RotateAroundPivot(num, a); GUI.DrawTexture(new Rect(a.x, a.y - width * 0.5f, num2, width), (Texture)(object)_pixel); GUI.matrix = matrix; GUI.color = color2; } } public enum Lang { English, Russian, Ukrainian, ChineseSimplified, ChineseTraditional, Japanese, Korean, Spanish, PortugueseBR, German, French, Italian, Polish, Turkish } public static class Localization { public static Lang Current = Lang.Russian; public static readonly (Lang lang, string name)[] Options = new(Lang, string)[14] { (Lang.English, "English"), (Lang.Russian, "Русский"), (Lang.Ukrainian, "Українська"), (Lang.ChineseSimplified, "简体中文"), (Lang.ChineseTraditional, "繁體中文"), (Lang.Japanese, "日本語"), (Lang.Korean, "한국어"), (Lang.Spanish, "Español"), (Lang.PortugueseBR, "Português (BR)"), (Lang.German, "Deutsch"), (Lang.French, "Français"), (Lang.Italian, "Italiano"), (Lang.Polish, "Polski"), (Lang.Turkish, "Türkçe") }; private static readonly string[] Keys = new string[24] { "tab.character", "tab.cheats", "tab.admin", "tab.inventory", "tab.world", "tab.badges", "tab.cosmetics", "tab.about", "tab.settings", "tab.anticheat", "feat.speed", "feat.jump", "feat.climb", "feat.vineclimb", "feat.ropeclimb", "feat.god", "feat.infstam", "feat.nofall", "feat.noweight", "feat.lockstatus", "feat.tpping", "feat.fly", "wip", "ui.language" }; private static readonly Dictionary Values = new Dictionary { [Lang.English] = new string[24] { "Character", "Cheats", "Admin", "Inventory", "World", "Badges", "Cosmetics", "About", "Settings", "Anti-cheat", "Speed", "Jump", "Climb speed", "Vine climb", "Rope climb", "God mode", "Infinite stamina", "No fall damage", "No weight", "Lock status (freeze afflictions)", "Teleport to ping", "Fly", "work-in-progress", "Language" }, [Lang.Russian] = new string[24] { "Персонаж", "Читы", "Админ", "Инвентарь", "Мир", "Ачивки", "Косметика", "О моде", "Настройки", "Античит", "Скорость", "Прыжок", "Скорость лазания", "Лазание по лозам", "Лазание по верёвкам", "Бессмертие", "Бесконечная стамина", "Без урона от падения", "Без веса", "Заморозка статусов", "Телепорт к пингу", "Полёт", "в разработке", "Язык" }, [Lang.Ukrainian] = new string[24] { "Персонаж", "Чити", "Адмін", "Інвентар", "Світ", "Ачивки", "Косметика", "Про мод", "Налаштування", "Античит", "Швидкість", "Стрибок", "Швидкість лазіння", "Лазіння по ліанах", "Лазіння по мотузках", "Безсмертя", "Нескінченна витривалість", "Без шкоди від падіння", "Без ваги", "Заморозка статусів", "Телепорт до пінгу", "Політ", "у розробці", "Мова" }, [Lang.ChineseSimplified] = new string[24] { "角色", "作弊", "管理", "物品栏", "世界", "成就", "外观", "关于", "设置", "反作弊", "速度", "跳跃", "攀爬速度", "藤蔓攀爬", "绳索攀爬", "无敌模式", "无限体力", "无坠落伤害", "无重量", "锁定状态", "传送到标记", "飞行", "开发中", "语言" }, [Lang.ChineseTraditional] = new string[24] { "角色", "作弊", "管理", "物品欄", "世界", "成就", "外觀", "關於", "設定", "反作弊", "速度", "跳躍", "攀爬速度", "藤蔓攀爬", "繩索攀爬", "無敵模式", "無限體力", "無墜落傷害", "無重量", "鎖定狀態", "傳送到標記", "飛行", "開發中", "語言" }, [Lang.Japanese] = new string[24] { "キャラクター", "チート", "管理", "インベントリ", "ワールド", "実績", "外見", "情報", "設定", "アンチチート", "スピード", "ジャンプ", "登坂速度", "ツル登り", "ロープ登り", "無敵モード", "無限スタミナ", "落下ダメージ無効", "重量なし", "ステータス固定", "ピンへテレポート", "飛行", "開発中", "言語" }, [Lang.Korean] = new string[24] { "캐릭터", "치트", "관리", "인벤토리", "월드", "업적", "외형", "정보", "설정", "안티치트", "속도", "점프", "등반 속도", "덩굴 등반", "밧줄 등반", "무적 모드", "무한 스태미나", "낙하 데미지 없음", "무게 없음", "상태 고정", "핑으로 순간이동", "비행", "개발 중", "언어" }, [Lang.Spanish] = new string[24] { "Personaje", "Trucos", "Admin", "Inventario", "Mundo", "Logros", "Cosméticos", "Acerca de", "Ajustes", "Antitrampas", "Velocidad", "Salto", "Velocidad de escalada", "Escalada de lianas", "Escalada de cuerdas", "Modo dios", "Resistencia infinita", "Sin daño por caída", "Sin peso", "Bloquear estado", "Teletransporte al ping", "Volar", "en desarrollo", "Idioma" }, [Lang.PortugueseBR] = new string[24] { "Personagem", "Trapaças", "Admin", "Inventário", "Mundo", "Conquistas", "Cosméticos", "Sobre", "Configurações", "Antitrapaça", "Velocidade", "Pulo", "Velocidade de escalada", "Escalada de cipó", "Escalada de corda", "Modo deus", "Estamina infinita", "Sem dano de queda", "Sem peso", "Travar status", "Teleportar para o ping", "Voar", "em desenvolvimento", "Idioma" }, [Lang.German] = new string[24] { "Charakter", "Cheats", "Admin", "Inventar", "Welt", "Erfolge", "Kosmetik", "Über", "Einstellungen", "Anti-Cheat", "Geschwindigkeit", "Sprung", "Klettergeschwindigkeit", "Rankenklettern", "Seilklettern", "Gottmodus", "Unendliche Ausdauer", "Kein Fallschaden", "Kein Gewicht", "Status einfrieren", "Zum Ping teleportieren", "Fliegen", "in Arbeit", "Sprache" }, [Lang.French] = new string[24] { "Personnage", "Triches", "Admin", "Inventaire", "Monde", "Succès", "Cosmétiques", "À propos", "Paramètres", "Anti-triche", "Vitesse", "Saut", "Vitesse d'escalade", "Escalade de lianes", "Escalade de corde", "Mode dieu", "Endurance infinie", "Aucun dégât de chute", "Sans poids", "Verrouiller le statut", "Téléportation au ping", "Voler", "en cours", "Langue" }, [Lang.Italian] = new string[24] { "Personaggio", "Trucchi", "Admin", "Inventario", "Mondo", "Obiettivi", "Cosmetici", "Info", "Impostazioni", "Anti-cheat", "Velocità", "Salto", "Velocità di arrampicata", "Arrampicata su liane", "Arrampicata su corda", "Modalità dio", "Stamina infinita", "Nessun danno da caduta", "Senza peso", "Blocca stato", "Teletrasporto al ping", "Vola", "in lavorazione", "Lingua" }, [Lang.Polish] = new string[24] { "Postać", "Cheaty", "Admin", "Ekwipunek", "Świat", "Osiągnięcia", "Kosmetyki", "O modzie", "Ustawienia", "Antycheat", "Prędkość", "Skok", "Prędkość wspinania", "Wspinaczka po pnączach", "Wspinaczka po linie", "Tryb boga", "Nieskończona wytrzymałość", "Brak obrażeń od upadku", "Bez wagi", "Zablokuj status", "Teleport do pingu", "Latanie", "w trakcie prac", "Język" }, [Lang.Turkish] = new string[24] { "Karakter", "Hileler", "Admin", "Envanter", "Dünya", "Başarımlar", "Kozmetikler", "Hakkında", "Ayarlar", "Anti-hile", "Hız", "Zıplama", "Tırmanma hızı", "Sarmaşık tırmanışı", "Halat tırmanışı", "Tanrı modu", "Sınırsız dayanıklılık", "Düşme hasarı yok", "Ağırlık yok", "Durumu kilitle", "Ping'e ışınlan", "Uçuş", "geliştiriliyor", "Dil" } }; private static readonly Dictionary Index = BuildIndex(); private static readonly Dictionary> Desc = new Dictionary> { [Lang.English] = new Dictionary { ["feat.speed"] = "Increases your movement speed by the chosen multiplier.", ["feat.jump"] = "Increases your jump force/height by the chosen multiplier.", ["feat.climb"] = "Increases climbing speed by the chosen multiplier.", ["feat.vineclimb"] = "Climb vines faster by the chosen multiplier.", ["feat.ropeclimb"] = "Climb ropes faster by the chosen multiplier.", ["feat.god"] = "Invincibility — you take no damage from anything.", ["feat.infstam"] = "Your stamina never runs out.", ["feat.nofall"] = "Removes all fall damage.", ["feat.noweight"] = "Carried items no longer slow you down.", ["feat.lockstatus"] = "Freezes all status effects (hunger, cold, poison, weight...) at their current values.", ["feat.tpping"] = "Teleports you to your ping marker.", ["feat.fly"] = "Free-fly noclip movement through the world." }, [Lang.Russian] = new Dictionary { ["feat.speed"] = "Увеличивает скорость передвижения на выбранный множитель.", ["feat.jump"] = "Увеличивает силу и высоту прыжка на выбранный множитель.", ["feat.climb"] = "Увеличивает скорость лазания на выбранный множитель.", ["feat.vineclimb"] = "Быстрее лазать по лозам на выбранный множитель.", ["feat.ropeclimb"] = "Быстрее лазать по верёвкам на выбранный множитель.", ["feat.god"] = "Неуязвимость — вы не получаете никакого урона.", ["feat.infstam"] = "Стамина никогда не заканчивается.", ["feat.nofall"] = "Полностью убирает урон от падения.", ["feat.noweight"] = "Переносимые предметы больше не замедляют вас.", ["feat.lockstatus"] = "Замораживает все статусы (голод, холод, яд, вес...) на текущих значениях.", ["feat.tpping"] = "Телепортирует к метке пинга.", ["feat.fly"] = "Свободный полёт сквозь геометрию." } }; private static Dictionary BuildIndex() { Dictionary dictionary = new Dictionary(); for (int i = 0; i < Keys.Length; i++) { dictionary[Keys[i]] = i; } return dictionary; } public static string T(string key) { if (!Index.TryGetValue(key, out var value)) { return key; } if (Values.TryGetValue(Current, out var value2) && value < value2.Length && !string.IsNullOrEmpty(value2[value])) { return value2[value]; } return Values[Lang.English][value]; } public static string Pick(Lang lang, string ru, string en, string zhCn = null, string zhTw = null, string uk = null, string ja = null, string ko = null, string es = null, string ptBr = null, string de = null, string fr = null, string it = null, string pl = null, string tr = null) { return lang switch { Lang.Russian => ru, Lang.Ukrainian => uk ?? en, Lang.ChineseSimplified => zhCn ?? en, Lang.ChineseTraditional => zhTw ?? zhCn ?? en, Lang.Japanese => ja ?? en, Lang.Korean => ko ?? en, Lang.Spanish => es ?? en, Lang.PortugueseBR => ptBr ?? en, Lang.German => de ?? en, Lang.French => fr ?? en, Lang.Italian => it ?? en, Lang.Polish => pl ?? en, Lang.Turkish => tr ?? en, _ => en, }; } public static string D(string key) { Lang key2 = (Desc.ContainsKey(Current) ? Current : Lang.English); if (Desc[key2].TryGetValue(key, out var value)) { return value; } if (!Desc[Lang.English].TryGetValue(key, out var value2)) { return ""; } return value2; } public static string RequiredOsFont(Lang lang) { return lang switch { Lang.ChineseSimplified => "Microsoft YaHei", Lang.ChineseTraditional => "Microsoft JhengHei", Lang.Japanese => "Yu Gothic", Lang.Korean => "Malgun Gothic", _ => null, }; } } internal static class ManyPlayers { public static bool Enabled { get { if (ModConfig.ManyPlayersEnabled != null) { return ModConfig.ManyPlayersEnabled.Value; } return false; } } public static int MaxPlayers => Mathf.Clamp(ModConfig.ManyPlayersMaxPlayers?.Value ?? 4, 1, 30); public static string StatusText(Lang lang) { if (!Enabled) { return Localization.Pick(lang, "Выключено", "Disabled", "已关闭", "已關閉", "Вимкнено", "無効", "꺼짐", "Desactivado", "Desativado", "Deaktiviert", "Désactivé", "Disattivato", "Wyłączone", "Kapalı"); } string text; if (!PhotonNetwork.InRoom) { text = MaxPlayers.ToString(); } else { Room currentRoom = PhotonNetwork.CurrentRoom; text = $"{((currentRoom != null) ? currentRoom.PlayerCount : 0)}/{MaxPlayers}"; } string text2 = text; return Localization.Pick(lang, "Включено, лимит: " + text2, "Enabled, limit: " + text2, "已启用,人数上限: " + text2, "已啟用,人數上限: " + text2, "Увімкнено, ліміт: " + text2, "有効、上限: " + text2, "켜짐, 제한: " + text2, "Activado, límite: " + text2, "Ativado, limite: " + text2, "Aktiviert, Limit: " + text2, "Activé, limite : " + text2, "Attivo, limite: " + text2, "Włączone, limit: " + text2, "Açık, limit: " + text2); } public static string StatusText(bool russian) { return StatusText(russian ? Lang.Russian : Lang.English); } public static void LogLobby(string message) { if (ModConfig.ManyPlayersLobbyDetails != null && ModConfig.ManyPlayersLobbyDetails.Value) { string text = "[PEAK-MX multiplayer] " + message; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)text); } GameApi.AddAdminLog(text); } } public static byte VoiceGroupFor(Character character) { try { PhotonView obj = (((Object)(object)character != (Object)null) ? ((Component)character).GetComponent() : null); int num = ((obj != null) ? obj.OwnerActorNr : 0); if (num <= 0) { num = (((Object)(object)character != (Object)null) ? ((Object)character).GetInstanceID() : 0); } return (byte)(Mathf.Abs(num) % 4); } catch { return 0; } } public static void EnsureComponentArrayCapacity(object instance, string fieldName, int minCount) { if (instance == null || minCount <= 0) { return; } try { FieldInfo fieldInfo = AccessTools.Field(instance.GetType(), fieldName); if (fieldInfo == null || !(fieldInfo.GetValue(instance) is Array array) || array.Length >= minCount) { return; } Type elementType = array.GetType().GetElementType(); if (elementType == null || !typeof(Component).IsAssignableFrom(elementType)) { return; } Component val = null; for (int num = array.Length - 1; num >= 0; num--) { object? value = array.GetValue(num); val = (Component)((value is Component) ? value : null); if ((Object)(object)val != (Object)null) { break; } } if (!((Object)(object)val == (Object)null)) { Array array2 = Array.CreateInstance(elementType, minCount); Array.Copy(array, array2, array.Length); Transform parent = val.transform.parent; for (int i = array.Length; i < minCount; i++) { GameObject val2 = Object.Instantiate(val.gameObject, parent); ((Object)val2).name = ((Object)val.gameObject).name + "_mx_" + i; val2.SetActive(false); array2.SetValue(val2.GetComponent(elementType), i); } fieldInfo.SetValue(instance, array2); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[PEAK-MX multiplayer] UI expand skipped: " + ex.Message)); } } } public static bool IsIndexInsideArray(object instance, string fieldName, int index) { try { return !(AccessTools.Field(instance.GetType(), fieldName)?.GetValue(instance) is Array array) || (index >= 0 && index < array.Length); } catch { return true; } } public static bool BlockNonHostKiosk() { if (!Enabled || ModConfig.ManyPlayersHostOnlyKiosk == null || !ModConfig.ManyPlayersHostOnlyKiosk.Value) { return false; } if (PhotonNetwork.IsMasterClient) { return false; } LogLobby("Non-host kiosk action blocked."); return true; } } [HarmonyPatch(typeof(NetworkingUtilities), "get_MAX_PLAYERS")] internal static class ManyPlayersMaxPlayersPatch { private static bool Prefix(ref int __result) { if (!ManyPlayers.Enabled) { return true; } __result = ManyPlayers.MaxPlayers; return false; } } [HarmonyPatch(typeof(NetworkingUtilities), "HostRoomOptions")] internal static class ManyPlayersHostRoomOptionsPatch { private static bool Prefix(ref RoomOptions __result) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (!ManyPlayers.Enabled) { return true; } __result = new RoomOptions { IsVisible = false, MaxPlayers = (byte)ManyPlayers.MaxPlayers, PublishUserId = true }; return false; } } [HarmonyPatch(typeof(AirportCheckInKiosk), "StartGame", new Type[] { typeof(int) })] internal static class ManyPlayersStartGamePatch { private static bool Prefix() { return !ManyPlayers.BlockNonHostKiosk(); } } [HarmonyPatch(typeof(AirportCheckInKiosk), "LoadIslandMaster", new Type[] { typeof(int), typeof(byte[]) })] internal static class ManyPlayersLoadIslandPatch { private static bool Prefix() { return !ManyPlayers.BlockNonHostKiosk(); } } [HarmonyPatch(typeof(PlayerConnectionLog), "OnPlayerEnteredRoom", new Type[] { typeof(Player) })] internal static class ManyPlayersJoinLogPatch { private static void Postfix(Player __0) { if (ManyPlayers.Enabled) { string arg = (string.IsNullOrEmpty((__0 != null) ? __0.NickName : null) ? "unknown" : __0.NickName); Room currentRoom = PhotonNetwork.CurrentRoom; int num = ((currentRoom != null) ? currentRoom.PlayerCount : 0); ManyPlayers.LogLobby($"Joined: {arg} ({num}/{ManyPlayers.MaxPlayers})"); } } } [HarmonyPatch(typeof(PlayerConnectionLog), "OnPlayerLeftRoom", new Type[] { typeof(Player) })] internal static class ManyPlayersLeftLogPatch { private static void Postfix(Player __0) { if (ManyPlayers.Enabled) { string arg = (string.IsNullOrEmpty((__0 != null) ? __0.NickName : null) ? "unknown" : __0.NickName); Room currentRoom = PhotonNetwork.CurrentRoom; int num = ((currentRoom != null) ? currentRoom.PlayerCount : 0); ManyPlayers.LogLobby($"Left: {arg} ({num}/{ManyPlayers.MaxPlayers})"); } } } [HarmonyPatch(typeof(PlayerHandler), "AssignMixerGroup", new Type[] { typeof(Character) })] internal static class ManyPlayersVoiceGroupPatch { private static bool Prefix(Character __0, ref byte __result) { if (!ManyPlayers.Enabled || ModConfig.ManyPlayersVoiceFix == null || !ModConfig.ManyPlayersVoiceFix.Value) { return true; } __result = ManyPlayers.VoiceGroupFor(__0); return false; } } [HarmonyPatch(typeof(UIPlayerNames), "Init")] internal static class ManyPlayersNameInitPatch { private static void Prefix(UIPlayerNames __instance) { if (ManyPlayers.Enabled && ModConfig.ManyPlayersUiFix != null && ModConfig.ManyPlayersUiFix.Value) { ManyPlayers.EnsureComponentArrayCapacity(__instance, "playerNameText", ManyPlayers.MaxPlayers); } } } [HarmonyPatch(typeof(UIPlayerNames), "DisableName", new Type[] { typeof(int) })] internal static class ManyPlayersDisableNamePatch { private static bool Prefix(UIPlayerNames __instance, int __0) { if (!ManyPlayers.Enabled || ModConfig.ManyPlayersUiFix == null || !ModConfig.ManyPlayersUiFix.Value) { return true; } return ManyPlayers.IsIndexInsideArray(__instance, "playerNameText", __0); } } [HarmonyPatch(typeof(WaitingForPlayersUI), "Update")] internal static class ManyPlayersWaitingUiPatch { private static void Prefix(WaitingForPlayersUI __instance) { if (ManyPlayers.Enabled && ModConfig.ManyPlayersUiFix != null && ModConfig.ManyPlayersUiFix.Value) { ManyPlayers.EnsureComponentArrayCapacity(__instance, "scoutImages", ManyPlayers.MaxPlayers); } } } public static class Menu { [Flags] private enum ResizeEdge { None = 0, Left = 1, Right = 2, Top = 4, Bottom = 8 } private struct ThemeColorPreset { public readonly string RuName; public readonly string EnName; public readonly string AccentHex; public readonly string ActionHex; public ThemeColorPreset(string ruName, string enName, string accentHex, string actionHex) { RuName = ruName; EnName = enName; AccentHex = accentHex; ActionHex = actionHex; } } private struct ToggleTileSpec { public string Label; public string Tip; public Func Get; public Action Set; public bool Enabled; public ToggleTileSpec(string label, string tip, Func get, Action set, bool enabled = true) { Label = label; Tip = tip; Get = get; Set = set; Enabled = enabled; } } private struct ActionTileSpec { public string Label; public string Tip; public Action Run; public int Style; public ActionTileSpec(string label, string tip, Action run, int style = 0) { Label = label; Tip = tip; Run = run; Style = style; } } [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawWindow; public static WindowFunction <1>__DrawNoticeWindowModern; } private const string UrlSteam = "https://steamcommunity.com/id/everyng/"; private const string UrlTelegram = "https://t.me/maxkir041"; private const string UrlThunderstore = "https://thunderstore.io/c/peak/p/maxkir041/PEAK_MX/"; private const string UrlNexus = "https://www.nexusmods.com/peak/mods/179"; private const string UrlDonate = "https://www.donationalerts.com/r/maxkir041"; private const string UrlGitHub = "https://github.com/maxkir041/PEAK-MX"; private const string EmbeddedDonateQrPngBase64 = "iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAAAAADuvYBWAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAA4bSURBVHja7Z19bFbVGcDft28LNGV8DRZkM5QxMMYSZxW3MdC8urLsgw+zqDi3OoRtycJWs4Qt6DTZktIlJMYiMZkr8pEYcImj4GI2HDBlLpFq3ULNQkVoQ2QmbWw7C+1K3/fd3/c5JM89p+e+99729/vvPHnOc849v/feW3Iv52YycdFcClLwUrW+pNFm9GlT+9TrAx8qWdMc19JXZGDKgXSkA9IB6YB0QDogHZAOSAekA9IB6YB0QDogHVQqJ9sB/VQGnsmVZdw331RTdmeTK30winFe36BecxzGHayVkc5OGXnag/STasalFXqVVlX60bujWPs5Yc702fH8/hyGHUzM1C7FtgYqQ9zTAelIB6QD0gHpgHRAOiAdkA5IB6QD0gHpMGFCvERx+T2Huvd6+DWdHpWROx0ePf5NT3lNzWiIx07xhEOnWxZ5kP7eWoeRh2smfshPt8vIWVV6fasIPKXPfqs+lfFcLNJHXJb+uA/p6WI1V2/u6YB0QDrSAemAdEA6IB2QDkgHpAPSAemAdPBOyh6t9sc07oAMfDqL9EhYdbOMrPBRdocMtMhA/ssi8JcFMqVnMdIjYbsMHPZSdvOyYPt9Q3pmp5TOPR2QDkgHpAPSAemAdEA6IB2QDkgHpAPSAelTm0n3/9NLPlJKSE8Tnfqla7kMzJWBUz6uf3ORnmR2bQm2r03zUfXuI9zTAemAdEA6IB2QDkgHpAPSAemAdKQD0gHpgHRIL0l+nv7Lj5I7t6f0lEdkYH82PdLvHXao6+ETLpnudhk5uyTY7q+VGfVv2I8zXbSr9APe2yQjh9aJwEyj0z5r6TUuS1/tQ3pFTXJOMDGV/mh+bTUeOo1Gcbzc0wHpgHRAOiAd6YB0QDogHZAOSAekA9IB6RAT13m0+npMUzmmp1y4YF9lnXiK3WXU+HxdsF16xai6PjlrEI30DfE4L5rjdoj2eSOldZUIrDRSxqqC7be2yow2IX3cnMl4rixrsCG2Mz051M0Q0s2UO4LNAtdu7umAdEA60gHpgHRAOiAdkA5IB6QD0gHpgHSIgEQ/Wh3wUaS/TJP9T4qkN8c18s16yiIZMCb7BR9FakU71+xwQXzIYQXiWvtsYj5MVAzxcsrZOiWhEOLK1b1s4pPd3eTQqZCUeyn3dP6QA6QD0gHpgHRAOiAdkA5IB6QD0gHpgHSwpbLo8MPw0icb28ctiglZ+1KpPKegcbyVIZ5in14dbPcv0PsMi28SHDM2WWh+XASWGEUu+jhko+zySKpeVDMMWp6QkaNRbHMyNMeQnpwbjbEXzH1epJ8T24/s3eqj6qnFwXbXCplx6xHu6YB0QDogHZAOSAekA9JBl15iDaae9CxrwOUdkA5IB6QD0iEdxPc8veM++z5PysD6zZPKxr59asofxT+3dv3DQfqInjNdtOeH6CM+xJFZJ/sMLNKLyD7txh4fedHOmVMT71BkfvCwCFwyXqXJv2p9fC784uci0LXSvshAu5qybZeU7jJ7hz5Zp1WaEUGPXC5TFqUhTrhyXWZncE8HpCMdkA5IB6QD0gHpgHRAOiAdkA5IB6TDBKk8bIS+I55AXzjjUPd+8QDz3LsORdqte5Re8rIqh9WMb33KvsimpEi/zmvvg7OD7dfWOtTVtx9x4awMzP1ssF0o1yPqHrETxeh5mWFsTaF/zuNt4yWKxu0yIj9o8niLzDh+gwhUL5VnerouTHVJndgMObPR+A5Y7cM9nT/kAOmAdEA6IB2QDsmVzk4UU1A6O1FweQekA9IB6YB0SAnXebQ6OOihbn//JF+4Xg9rdKU8w/aGkF4rA63247zjUKQpo/aZq164WiMxfKBTXSQHnn9CPeB5MnDbgNpHbvEx5DTX0yVrGo0iHVqXgjnwSCkh1Hv56RRE1WYj46g6E/Nn36d1GeSeDkhHOiAdkA5IB6QD0gHpgHRAOiAdkA5IhwkT6v+ny6eexnvTBYciGR99HN7gLhUzPg4nGuTI2YoySTceHq+RgR07xTpW6kUcvlSRqVYzWn9mXfSFrTLStiXYvjZNPxydTocDNrbraDwgAkuNn2zWi/STPrYfeSOS7Udi40zOtsdodSQT6eCeDkgHpAPSAelIB6QD0gHpgHRAOiAdkA5IB6RDWaicXIdTaHDo9OKLiT2eS/dEIn3MCInv9mS+Nubh8rBuzL7PA+32fU7pKd21wXbP8igWdsaYw1X16DeC7bGZ0ZzpVWpKtsrDOF6KeKIquaOITmPRTI17On/IAdIB6YB0QDogHZAOSAekA9IB6YB0QDrYYr5EcazPR93Dk2uZ9vsoskXN6Nsbk/TX9viouzUeObluGfnxKfsq+d+JwCYvh7NZXFYfvV8kDBl7tDT+Siu6r0VGjteKwHJderpZlqAqGgsXisDbfmYi+gxxTwekIx2QDkgHpAPSAemAdEA6IB2QDkgHpMOEmWyPVt/3lBMFH8jA0gr7uS6LS/qOpWVZpD+1y0ibDMj3AwrmrhJqnxA0XVNTjNcsNn5bBJqNgS/foFU9eFBGitm4zvQt5ZFuRL5UZ1+lUezu4PJGUqOa0aUvUjP3dEA6IB2QDkgHpAPSAemAdEA60gHpgHRAOqQWt0er+uNlucV9aTxj3cfLRMLl2FIsxDNuJjMel/SWFjVluCbYfmWD2mXJBeuJ9NbqOdPUjLwMLFS77GlSU9qnqePIy2xlXq36T72qPHeyeT9n+uTi4fK8E5L5q3Yv/eJJtcY8I/KH+UqXWSe5pwPSkQ5IB6QD0gHpgHRAOiAdkA5IB6QD0gHpYE3l7cmZiz6VRyIZ97nn1JQzuVhW5Mpdes7X1Yx7dknpnXrZ019RfzpqjfX6az6VF9UUfbL1Z7SM/Vvtq8aGOTW5jk/qbzGtsteVyWS0n3nJQ41M0c8y5TKTmwoPe85wT+cPOUA6IB2QDkgHpAPSAemAdEA6IB2QDkgHW1w2JbjapufsjeuAdk9yYc96WJMwT2dPrw62+xfIjLnvisBTB+2ntuSUCDzWrvZplbua1OrjdIsdPMZCfNRlXDym//gTkfDJCtll4zMysth+TXpl4LYBGelRi9T6ONOvw+K4iog+BYc+Lh9vmie3AemKZk1C1KjRth8Z4p4OSEc6IB2QDkgHpAPSAemAdEA6IB2QDkiHCRPq0WpXeebSVZ4+//NwOB8OOEytTrQvDflYtY8+EoEbZ2tdsl50zf1YBF79r32Rh/SUQ2qf+u0i8Pwp+5nkfyQjD4p12t3ksEoFcVnd+UQk587xhmD72stOZ7o937TvUgwhvU6cLL1myiYp3WX6mybTxbxqE/d0QDrSAemAdEA6IB3SI73EGkw96VnWgMs7IB2QDkgHpEM68PRodTQxBzSa3KJjMS1BrsqH9I0y0F4dyeyNcarULp3VahGDdjXjq50+qlaXx/laGdj2rI+yO0pBihFNf6Sk0BPm/NKKdBtd8jKl3kjp0aqOJOdqvk3OjXs6f8gB0gHpgHRAOiAdkA5IB6QD0gHpgHRAOiAdVCpZAifyMvDbB1IkveDQSf4HiWzBx1Ry9l0Wy4FL0fyIO2Rgj7H9SIgXSexXaWSmntM3z1ZXptLL9d1HkaKPgQvRnBoViSoz4arc0/lDDpAOSAekA9IB6YB0QDogHZAOSAekA9LBlsqdcY18831qytMy8P0bg+1+h+82nHhLzzEWZYe6x+IF+4U88m8ZaVg5yX9uzXJ/hMuSjUafsx52omhzmey4KNLqUqQgijQbGUdFxnCIqn0laxL0utQNXHe5pwPSAemAdEA6IB2QjnRAOiAdkA5IB6QD0iGhpGsnitG3Yxr43fSs0eB5F+lHI5nLBvsuP9ksAleNF0taayc+jEn+MRH49Up1kRwGbqiTkVv0TsbAs0S7a42L9LtnR+D8mEOfBhk4bOasDzY97USxXko3Mm5dLJbaYRSnd6PWefg4Lvd0/pADpAPSAemAdEA6JFd6iTWYetKzrAGXd0A6IB2QDkiHdBDiJYriiEPdGvsuV1zmfyWSVYmm6oiPIlc9rHQI6SfWOsxt2HouxRCfrmiUgSb5WY1648WErH3VgzPVlGkOazLTh3SjSN/8YLu60Yf0BLFdKO09aKQcsK9615Zg+5pZ9YVcatbodn0FuKfzhxwgHZAOSAekA9IB6YB0QDogHZAOSAekA9JBJV3P0++KpOr27WrKghQrHlqSKukj04Ptlx7yUHTLoyJwfrlMyZ8QgTs6Izm+ywuD7XeMvSka96tF9DeDBtJ1pmdjKppNzPFFMhPu6fwhB0gHpAPSAemAdEiudLYfmYLS2X6EyzsgHZAOSAekQ0pI9KPV30RR9M9vpMnP4zKwU7QPnEuz9Io+Gflhi9qp9bsioP8L9MMWH7Ptsd/q5c6L9sOYe2I0iyM815LqM31+2TrFNlvu6YB0QDogHZAOSAekA9IB6YB0pAPSAemAdEgpCXq0+vdoiqwuy+Q/+ZeMTF+pdvrgA/uB3iyP9FuOO9Sttu5RXGOE9IEXiXbBLDJWJX4EetUqGdhVkJHPiHavMfDGIyLw+6IIdKxRZ9L4PRF4UO9jHN9aB+mLFsV17q+ZEUHRm26y73OPj4HvlYGOEJ0aHAYSfYa4pwPSkQ5IB6QD0gHpgHRAOiAdkA5IB6QD0mHCXO/R6lBSJ3vtqkMno8+sMm2dZyzjbB9FIpI+J7G/0Jf1z3nUrxKB94zD6V5Wlsm2GwMXxGX1c9vUInsOqilGkVlS8bbkGGwuBSmYKSMi5ZBetV50KeWNlO5SBJwNccQF66rDIar22U+Wezp/yAHSAemAdEA6IB2QDkgHpAPSAemAdEA6IB1U/g8haNnaidoBbwAAAABJRU5ErkJggg=="; private static readonly string[] Tabs = new string[9] { "tab.character", "tab.cheats", "tab.admin", "tab.inventory", "tab.world", "tab.badges", "tab.cosmetics", "tab.about", "tab.anticheat" }; private static readonly string[][] SimpleSectionKeyMap = new string[9][] { new string[2] { "character.redesign.move", "character.redesign.status" }, new string[5] { "cheats.redesign.core", "cheats.redesign.esp", "cheats.redesign.status", "cheats.redesign.move", "cheats.redesign.pranks" }, new string[4] { "admin.players", "admin.protection", "admin.many_players", "admin.lists" }, new string[3] { "inventory.redesign.spawn", "inventory.redesign.backpack", "inventory.redesign.entities" }, new string[5] { "world.time", "world.modifiers", "world.navigation", "world.finish", "world.luggage" }, Array.Empty(), Array.Empty(), new string[4] { "about.main", "about.controls", "about.links", "about.support" }, new string[3] { "anticheat.detection", "anticheat.mods", "anticheat.events" } }; private const float HeaderHeight = 62f; private const float WindowPadding = 12f; private const float ResizeGrip = 8f; private const float MinWindowWidth = 540f; private const float MinWindowHeight = 500f; private static Rect _rect = new Rect(80f, 80f, 680f, 580f); private static Rect _lastSavedRect = new Rect(float.NaN, float.NaN, float.NaN, float.NaN); private static bool _windowRectLoaded; private static Rect _noticeRect = new Rect(40f, 40f, 360f, 0f); private static int _tab; private static Vector2 _scroll; private static bool _noticeDismissed; private static string _itemSearch = ""; private static int _selItem = -1; private static string _smartSpawnResult = ""; private static int _selSlot = 0; private static int _selBackpackSlot = 0; private static Vector2 _itemScroll; private static Vector2 _itemEspScroll; private static string _itemEspSearch = ""; private static int _invTarget = -1; private static bool _excludeSelf = true; private static string _tpX = "0"; private static string _tpY = "0"; private static string _tpZ = "0"; private static Vector2 _luggageScroll; private static int _selLuggage = -1; private static string _worldObjectSearch = "bell tower item luggage gloom campfire statue"; private static float _worldObjectRange = 1200f; private static int _selWorldObject = -1; private static Vector2 _worldObjectScroll; private static int _selStatus; private static float _statusAmount = 0.5f; private static float _statusCustomDeltaPercent = 25f; private static int _statusTarget = -1; private static int _prankTarget = -1; private static int _adminTarget = -1; private static int _mxAhgTargetActor = -1; private static Vector2 _adminScroll; private static bool _targetPickerOpen; private static bool _inventoryTargetPickerOpen; private static float _timeOfDay = 9f; private static bool _timeOfDayDirty; private static int _timePreset = -1; private static Vector2 _badgeScroll; private static bool[] _badgeUnlockedCache; private static ACHIEVEMENTTYPE[] _badgeTypeCache; private static float _badgeCacheTime = -999f; private static Vector2 _cosmeticScroll; private static int _cosmeticCategory; private static readonly Dictionary _sectionOpen = new Dictionary(); private static readonly Dictionary _numberText = new Dictionary(); private static readonly HashSet _favoriteItemIds = new HashSet(); private static string _favoriteItemSource; private static ResizeEdge _resizeEdge; private static Rect _resizeStartRect; private static Vector2 _resizeStartMouse; private static Rect _contentRect; private static string _hoverTip; private static string _lastTip; private static float _lastTipUntil; private static Vector2 _tipScroll; private static bool _closeRequested; private static bool _waitingForMenuKey; private static int _quickActionCaptureSlot = -1; private static int _quickActionPickerSlot = -1; private static bool _itemFavoritesOnly; private static int _itemCategory; private static int _itemEspCategory; private static string _nicknameInput = ""; private static float _compatCopiedUntil; private static float _quickActionCopiedUntil; private static float _petrifyAmount = 50f; private static int _themeVersion = -1; private static string _accentHexText; private static string _actionHexText; private static readonly int[] _simpleSection = new int[Tabs.Length]; private static Lang _simpleSectionLabelLanguage = (Lang)(-1); private static string[][] _simpleSectionLabelMap; private static bool _favoritesOpen; private static string _favoriteActionSearch = ""; private static readonly ThemeColorPreset[] ThemeColorPresets = new ThemeColorPreset[5] { new ThemeColorPreset("Классика", "Classic", "#41D58A", "#599FF4"), new ThemeColorPreset("Лед", "Ice", "#48DDE8", "#7AA8FF"), new ThemeColorPreset("Фиолет", "Violet", "#A977FF", "#FF6BCB"), new ThemeColorPreset("Янтарь", "Amber", "#FFB84A", "#FF6F3C"), new ThemeColorPreset("Роза", "Rose", "#FF6B88", "#9D7BFF") }; private static Font _langFont; private static Lang _langFontFor = (Lang)(-1); private static Font _origFont; private static bool _origFontSaved; private static readonly Color BadgeLocked = new Color(0.85f, 0.27f, 0.27f); private static Texture2D _frameOn; private static Texture2D _frameOff; private static Texture2D _tileBg; private static bool _langOpen; private static readonly Color BadgeLockedModern = new Color(0.85f, 0.27f, 0.27f); private static Texture2D _badgeTileOn; private static Texture2D _badgeTileOff; private static Texture2D _badgeTileBg; private static Texture2D _badgeStripeOn; private static Texture2D _badgeStripeOff; private static Texture2D _lineTex; private static Texture2D _sliderFillTex; private static Texture2D _headerTex; private static Texture2D _accentTex; private static Texture2D _brandIconTex; private static GUIStyle _brandIconText; private static GUIStyle _itemIconText; private static GUIStyle _itemTileLabel; private static GUIStyle _itemTileLabelActive; private static byte[] _qrBytes; private static Texture2D _qrTex; private static MethodInfo _loadImage; private static bool _loadImageResolved; private static int _entitySelection; private static int _entityTarget = -1; private static int _entityPlacement; private static int _entityAmount = 1; private static string _entitySearch = ""; private static string _entityFilterSearch; private static Lang _entityFilterLanguage; private static readonly List _visibleEntities = new List(); private static Vector2 _entityScroll; private static EntitySpawnResult? _entityResult; private static bool Ru => Localization.Current == Lang.Russian; private static bool ZhCn => Localization.Current == Lang.ChineseSimplified; private static bool ZhTw => Localization.Current == Lang.ChineseTraditional; private static bool UseModernUi => true; public static bool IsCapturingHotkey { get { if (!_waitingForMenuKey) { return _quickActionCaptureSlot >= 0; } return true; } } private static bool AdvancedUi { get { if (ModConfig.AdvancedUi != null) { return ModConfig.AdvancedUi.Value; } return false; } } private static string L(string key) { return Localization.T(key); } private static string Tx(string ru, string en, string zhCn = null, string zhTw = null, string uk = null, string ja = null, string ko = null, string es = null, string ptBr = null, string de = null, string fr = null, string it = null, string pl = null, string tr = null) { string text = Localization.Pick(Localization.Current, ru, en, zhCn, zhTw, uk, ja, ko, es, ptBr, de, fr, it, pl, tr); if (!string.Equals(text, en, StringComparison.Ordinal)) { return text; } string text2 = KnownTx(en); if (!string.IsNullOrEmpty(text2)) { return text2; } return text; } private static string KnownTx(string en) { return Localization.Current switch { Lang.Ukrainian => en switch { "Many players" => "Багато гравців", "Enable larger lobbies" => "Увімкнути великі лобі", "Max players" => "Макс. гравців", "Host-only start" => "Старт лише хостом", "Join/leave log" => "Журнал входів/виходів", "Voice group fix" => "Фікс голосових груп", "Player UI fix" => "Фікс UI гравців", "Give food" => "Роздати їжу", "Give backpacks" => "Роздати рюкзаки", "No falling ragdoll" => "Без ragdoll від падіння", "Global voice hearing" => "Голос на всю мапу", "Player ESP" => "ESP гравців", "ESP distance" => "Дистанція ESP", "No status effects" => "Без ефектів статусу", "No injury" => "Без травм", "No hunger" => "Без голоду", "No cold" => "Без холоду", "No poison" => "Без отрути", "No curse" => "Без прокляття", "No drowsy" => "Без сонливості", "No hot" => "Без спеки", "Fly & teleport" => "Політ і телепорт", "Long interaction" => "Далека взаємодія", "Distance" => "Дистанція", "Cinematic camera" => "Кінематографічна камера", "Camera speed" => "Швидкість камери", "Noclip through geometry" => "Прохід крізь геометрію", "Speed" => "Швидкість", "Accel" => "Прискорення", "Coords:" => "Коорд.:", "TP" => "ТП", "Pranks" => "Розіграші", "Pile on afflictions" => "Накласти недуги", "Cure" => "Вилікувати", "Push" => "Штовхнути", "Explode" => "Підірвати", "Petrify" => "Окаменити", "Clear petrify" => "Зняти окаменіння", "Add arrow" => "Додати стрілу", "5 arrows" => "5 стріл", "Remove arrows" => "Витягти стріли", "Stuff with selected item" => "Забити вибраним предметом", "Fill with gold" => "Забити золотом", "Fill with webs" => "Забити павутиною", "Random items" => "Випадкові предмети", "Clear inventory" => "Очистити інвентар", "7 balloons" => "7 кульок", "Drop items" => "Викинути речі", "Plugin DLL check" => "Перевірка DLL модів", "Enable DLL check" => "Увімкнути перевірку DLL", "Kick mismatches" => "Кікати невідповідних", "Refresh signature" => "Оновити підпис", "Copy report" => "Скопіювати звіт", "Your set: " => "Твій набір: ", "Error: " => "Помилка: ", _ => null, }, Lang.Japanese => en switch { "Many players" => "大人数", "Enable larger lobbies" => "大人数ロビーを有効化", "Max players" => "最大プレイヤー", "Host-only start" => "ホストのみ開始", "Join/leave log" => "参加/退出ログ", "Voice group fix" => "ボイスグループ修正", "Player UI fix" => "プレイヤーUI修正", "Give food" => "食料を配る", "Give backpacks" => "バックパックを配る", "No falling ragdoll" => "落下ラグドールなし", "Global voice hearing" => "全体ボイス受信", "Player ESP" => "プレイヤーESP", "ESP distance" => "ESP距離", "No status effects" => "状態異常なし", "No injury" => "負傷なし", "No hunger" => "空腹なし", "No cold" => "寒さなし", "No poison" => "毒なし", "No curse" => "呪いなし", "No drowsy" => "眠気なし", "No hot" => "暑さなし", "Fly & teleport" => "飛行とテレポート", "Long interaction" => "長距離インタラクト", "Distance" => "距離", "Cinematic camera" => "シネマカメラ", "Camera speed" => "カメラ速度", "Noclip through geometry" => "地形をすり抜ける", "Speed" => "速度", "Accel" => "加速", "Coords:" => "座標:", "TP" => "TP", "Pranks" => "いたずら", "Pile on afflictions" => "状態異常を付与", "Cure" => "治療", "Push" => "押す", "Explode" => "爆発", "Petrify" => "石化", "Clear petrify" => "石化解除", "Add arrow" => "矢を追加", "5 arrows" => "矢5本", "Remove arrows" => "矢を抜く", "Stuff with selected item" => "選択アイテムで満たす", "Fill with gold" => "金で満たす", "Fill with webs" => "クモ糸で満たす", "Random items" => "ランダムアイテム", "Clear inventory" => "インベントリ消去", "7 balloons" => "風船7個", "Drop items" => "アイテムを落とす", "Plugin DLL check" => "プラグインDLL検査", "Enable DLL check" => "DLL検査を有効化", "Kick mismatches" => "不一致をキック", "Refresh signature" => "署名を更新", "Copy report" => "レポートをコピー", "Your set: " => "自分のセット: ", "Error: " => "エラー: ", _ => null, }, Lang.Korean => en switch { "Many players" => "다인 플레이", "Enable larger lobbies" => "대형 로비 켜기", "Max players" => "최대 플레이어", "Host-only start" => "호스트만 시작", "Join/leave log" => "입장/퇴장 로그", "Voice group fix" => "음성 그룹 수정", "Player UI fix" => "플레이어 UI 수정", "Give food" => "음식 지급", "Give backpacks" => "배낭 지급", "No falling ragdoll" => "낙하 래그돌 없음", "Global voice hearing" => "전체 맵 음성 듣기", "Player ESP" => "플레이어 ESP", "ESP distance" => "ESP 거리", "No status effects" => "상태 효과 없음", "No injury" => "부상 없음", "No hunger" => "허기 없음", "No cold" => "추위 없음", "No poison" => "독 없음", "No curse" => "저주 없음", "No drowsy" => "졸림 없음", "No hot" => "더위 없음", "Fly & teleport" => "비행 및 순간이동", "Long interaction" => "긴 상호작용", "Distance" => "거리", "Cinematic camera" => "시네마틱 카메라", "Camera speed" => "카메라 속도", "Noclip through geometry" => "지형 통과", "Speed" => "속도", "Accel" => "가속", "Coords:" => "좌표:", "TP" => "TP", "Pranks" => "장난", "Pile on afflictions" => "상태 이상 부여", "Cure" => "치료", "Push" => "밀기", "Explode" => "폭발", "Petrify" => "석화", "Clear petrify" => "석화 해제", "Add arrow" => "화살 추가", "5 arrows" => "화살 5개", "Remove arrows" => "화살 제거", "Stuff with selected item" => "선택 아이템으로 채우기", "Fill with gold" => "금으로 채우기", "Fill with webs" => "거미줄로 채우기", "Random items" => "무작위 아이템", "Clear inventory" => "인벤토리 비우기", "7 balloons" => "풍선 7개", "Drop items" => "아이템 떨어뜨리기", "Plugin DLL check" => "플러그인 DLL 검사", "Enable DLL check" => "DLL 검사 켜기", "Kick mismatches" => "불일치 킥", "Refresh signature" => "서명 새로고침", "Copy report" => "보고서 복사", "Your set: " => "내 세트: ", "Error: " => "오류: ", _ => null, }, Lang.Spanish => en switch { "Many players" => "Muchos jugadores", "Enable larger lobbies" => "Activar lobbies grandes", "Max players" => "Máx. jugadores", "Host-only start" => "Inicio solo host", "Join/leave log" => "Registro entradas/salidas", "Voice group fix" => "Arreglo de voz", "Player UI fix" => "Arreglo de UI", "Give food" => "Dar comida", "Give backpacks" => "Dar mochilas", "No falling ragdoll" => "Sin ragdoll al caer", "Global voice hearing" => "Voz en todo el mapa", "Player ESP" => "ESP de jugadores", "ESP distance" => "Distancia ESP", "No status effects" => "Sin estados", "No injury" => "Sin heridas", "No hunger" => "Sin hambre", "No cold" => "Sin frío", "No poison" => "Sin veneno", "No curse" => "Sin maldición", "No drowsy" => "Sin sueño", "No hot" => "Sin calor", "Fly & teleport" => "Vuelo y teletransporte", "Long interaction" => "Interacción lejana", "Distance" => "Distancia", "Cinematic camera" => "Cámara cinematográfica", "Camera speed" => "Velocidad cámara", "Noclip through geometry" => "Atravesar geometría", "Speed" => "Velocidad", "Accel" => "Aceleración", "Coords:" => "Coords:", "TP" => "TP", "Pranks" => "Bromas", "Pile on afflictions" => "Aplicar estados", "Cure" => "Curar", "Push" => "Empujar", "Explode" => "Explotar", "Petrify" => "Petrificar", "Clear petrify" => "Quitar petrificación", "Add arrow" => "Añadir flecha", "5 arrows" => "5 flechas", "Remove arrows" => "Quitar flechas", "Stuff with selected item" => "Llenar con objeto elegido", "Fill with gold" => "Llenar con oro", "Fill with webs" => "Llenar con telarañas", "Random items" => "Objetos aleatorios", "Clear inventory" => "Vaciar inventario", "7 balloons" => "7 globos", "Drop items" => "Soltar objetos", "Plugin DLL check" => "Comprobar DLL de mods", "Enable DLL check" => "Activar comprobación DLL", "Kick mismatches" => "Expulsar diferencias", "Refresh signature" => "Actualizar firma", "Copy report" => "Copiar informe", "Your set: " => "Tu conjunto: ", "Error: " => "Error: ", _ => null, }, Lang.PortugueseBR => en switch { "Many players" => "Muitos jogadores", "Enable larger lobbies" => "Ativar lobbies grandes", "Max players" => "Máx. jogadores", "Host-only start" => "Início só host", "Join/leave log" => "Log entrar/sair", "Voice group fix" => "Correção de voz", "Player UI fix" => "Correção da UI", "Give food" => "Dar comida", "Give backpacks" => "Dar mochilas", "No falling ragdoll" => "Sem ragdoll ao cair", "Global voice hearing" => "Voz no mapa todo", "Player ESP" => "ESP de jogadores", "ESP distance" => "Distância ESP", "No status effects" => "Sem status", "No injury" => "Sem ferimentos", "No hunger" => "Sem fome", "No cold" => "Sem frio", "No poison" => "Sem veneno", "No curse" => "Sem maldição", "No drowsy" => "Sem sono", "No hot" => "Sem calor", "Fly & teleport" => "Voo e teleporte", "Long interaction" => "Interação longa", "Distance" => "Distância", "Cinematic camera" => "Câmera cinematográfica", "Camera speed" => "Velocidade câmera", "Noclip through geometry" => "Atravessar geometria", "Speed" => "Velocidade", "Accel" => "Aceleração", "Coords:" => "Coords:", "TP" => "TP", "Pranks" => "Pegadinhas", "Pile on afflictions" => "Aplicar aflições", "Cure" => "Curar", "Push" => "Empurrar", "Explode" => "Explodir", "Petrify" => "Petrificar", "Clear petrify" => "Remover petrificação", "Add arrow" => "Adicionar flecha", "5 arrows" => "5 flechas", "Remove arrows" => "Remover flechas", "Stuff with selected item" => "Encher com item escolhido", "Fill with gold" => "Encher com ouro", "Fill with webs" => "Encher com teias", "Random items" => "Itens aleatórios", "Clear inventory" => "Limpar inventário", "7 balloons" => "7 balões", "Drop items" => "Soltar itens", "Plugin DLL check" => "Verificação DLL de mods", "Enable DLL check" => "Ativar verificação DLL", "Kick mismatches" => "Expulsar divergentes", "Refresh signature" => "Atualizar assinatura", "Copy report" => "Copiar relatório", "Your set: " => "Seu conjunto: ", "Error: " => "Erro: ", _ => null, }, Lang.German => en switch { "Many players" => "Viele Spieler", "Enable larger lobbies" => "Große Lobbys aktivieren", "Max players" => "Max. Spieler", "Host-only start" => "Start nur Host", "Join/leave log" => "Beitritt/Verlassen-Log", "Voice group fix" => "Sprachgruppen-Fix", "Player UI fix" => "Spieler-UI-Fix", "Give food" => "Essen geben", "Give backpacks" => "Rucksäcke geben", "No falling ragdoll" => "Kein Fall-Ragdoll", "Global voice hearing" => "Stimme überall hören", "Player ESP" => "Spieler-ESP", "ESP distance" => "ESP-Distanz", "No status effects" => "Keine Statuseffekte", "No injury" => "Keine Verletzung", "No hunger" => "Kein Hunger", "No cold" => "Keine Kälte", "No poison" => "Kein Gift", "No curse" => "Kein Fluch", "No drowsy" => "Keine Müdigkeit", "No hot" => "Keine Hitze", "Fly & teleport" => "Flug und Teleport", "Long interaction" => "Weite Interaktion", "Distance" => "Distanz", "Cinematic camera" => "Filmische Kamera", "Camera speed" => "Kameratempo", "Noclip through geometry" => "Durch Geometrie noclippen", "Speed" => "Tempo", "Accel" => "Beschl.", "Coords:" => "Koord.:", "TP" => "TP", "Pranks" => "Streiche", "Pile on afflictions" => "Leiden stapeln", "Cure" => "Heilen", "Push" => "Schubsen", "Explode" => "Explodieren", "Petrify" => "Versteinern", "Clear petrify" => "Versteinerung entfernen", "Add arrow" => "Pfeil hinzufügen", "5 arrows" => "5 Pfeile", "Remove arrows" => "Pfeile entfernen", "Stuff with selected item" => "Mit gewähltem Item füllen", "Fill with gold" => "Mit Gold füllen", "Fill with webs" => "Mit Netzen füllen", "Random items" => "Zufällige Items", "Clear inventory" => "Inventar leeren", "7 balloons" => "7 Ballons", "Drop items" => "Items fallen lassen", "Plugin DLL check" => "Plugin-DLL-Prüfung", "Enable DLL check" => "DLL-Prüfung aktivieren", "Kick mismatches" => "Abweichungen kicken", "Refresh signature" => "Signatur aktualisieren", "Copy report" => "Bericht kopieren", "Your set: " => "Dein Satz: ", "Error: " => "Fehler: ", _ => null, }, Lang.French => en switch { "Many players" => "Beaucoup de joueurs", "Enable larger lobbies" => "Activer les grands salons", "Max players" => "Joueurs max", "Host-only start" => "Départ par l'hôte", "Join/leave log" => "Journal entrées/sorties", "Voice group fix" => "Correctif voix", "Player UI fix" => "Correctif UI joueurs", "Give food" => "Donner nourriture", "Give backpacks" => "Donner sacs", "No falling ragdoll" => "Pas de ragdoll en chute", "Global voice hearing" => "Voix sur toute la carte", "Player ESP" => "ESP joueurs", "ESP distance" => "Distance ESP", "No status effects" => "Sans statuts", "No injury" => "Sans blessure", "No hunger" => "Sans faim", "No cold" => "Sans froid", "No poison" => "Sans poison", "No curse" => "Sans malédiction", "No drowsy" => "Sans somnolence", "No hot" => "Sans chaleur", "Fly & teleport" => "Vol et téléportation", "Long interaction" => "Interaction longue", "Distance" => "Distance", "Cinematic camera" => "Caméra cinématique", "Camera speed" => "Vitesse caméra", "Noclip through geometry" => "Traverser la géométrie", "Speed" => "Vitesse", "Accel" => "Accél.", "Coords:" => "Coord.:", "TP" => "TP", "Pranks" => "Farces", "Pile on afflictions" => "Ajouter des afflictions", "Cure" => "Soigner", "Push" => "Pousser", "Explode" => "Exploser", "Petrify" => "Pétrifier", "Clear petrify" => "Retirer pétrification", "Add arrow" => "Ajouter flèche", "5 arrows" => "5 flèches", "Remove arrows" => "Retirer flèches", "Stuff with selected item" => "Remplir avec l'objet choisi", "Fill with gold" => "Remplir d'or", "Fill with webs" => "Remplir de toiles", "Random items" => "Objets aléatoires", "Clear inventory" => "Vider inventaire", "7 balloons" => "7 ballons", "Drop items" => "Lâcher objets", "Plugin DLL check" => "Vérification DLL mods", "Enable DLL check" => "Activer vérification DLL", "Kick mismatches" => "Expulser différences", "Refresh signature" => "Actualiser signature", "Copy report" => "Copier rapport", "Your set: " => "Ton ensemble : ", "Error: " => "Erreur : ", _ => null, }, Lang.Italian => en switch { "Many players" => "Molti giocatori", "Enable larger lobbies" => "Attiva lobby grandi", "Max players" => "Giocatori max", "Host-only start" => "Avvio solo host", "Join/leave log" => "Log entrate/uscite", "Voice group fix" => "Fix gruppi voce", "Player UI fix" => "Fix UI giocatori", "Give food" => "Dai cibo", "Give backpacks" => "Dai zaini", "No falling ragdoll" => "Niente ragdoll caduta", "Global voice hearing" => "Voce su tutta la mappa", "Player ESP" => "ESP giocatori", "ESP distance" => "Distanza ESP", "No status effects" => "Nessun effetto stato", "No injury" => "Nessuna ferita", "No hunger" => "Niente fame", "No cold" => "Niente freddo", "No poison" => "Niente veleno", "No curse" => "Niente maledizione", "No drowsy" => "Niente sonnolenza", "No hot" => "Niente caldo", "Fly & teleport" => "Volo e teletrasporto", "Long interaction" => "Interazione lunga", "Distance" => "Distanza", "Cinematic camera" => "Camera cinematica", "Camera speed" => "Velocità camera", "Noclip through geometry" => "Attraversa geometria", "Speed" => "Velocità", "Accel" => "Accel.", "Coords:" => "Coord.:", "TP" => "TP", "Pranks" => "Scherzi", "Pile on afflictions" => "Aggiungi afflizioni", "Cure" => "Cura", "Push" => "Spingi", "Explode" => "Esplodi", "Petrify" => "Pietrifica", "Clear petrify" => "Rimuovi pietrificazione", "Add arrow" => "Aggiungi freccia", "5 arrows" => "5 frecce", "Remove arrows" => "Rimuovi frecce", "Stuff with selected item" => "Riempi con oggetto scelto", "Fill with gold" => "Riempi d'oro", "Fill with webs" => "Riempi di ragnatele", "Random items" => "Oggetti casuali", "Clear inventory" => "Svuota inventario", "7 balloons" => "7 palloncini", "Drop items" => "Lascia oggetti", "Plugin DLL check" => "Controllo DLL mod", "Enable DLL check" => "Attiva controllo DLL", "Kick mismatches" => "Espelli differenze", "Refresh signature" => "Aggiorna firma", "Copy report" => "Copia report", "Your set: " => "Il tuo set: ", "Error: " => "Errore: ", _ => null, }, Lang.Polish => en switch { "Many players" => "Wielu graczy", "Enable larger lobbies" => "Włącz większe lobby", "Max players" => "Maks. graczy", "Host-only start" => "Start tylko host", "Join/leave log" => "Log wejść/wyjść", "Voice group fix" => "Naprawa grup głosu", "Player UI fix" => "Naprawa UI graczy", "Give food" => "Daj jedzenie", "Give backpacks" => "Daj plecaki", "No falling ragdoll" => "Bez ragdoll po upadku", "Global voice hearing" => "Głos na całej mapie", "Player ESP" => "ESP graczy", "ESP distance" => "Dystans ESP", "No status effects" => "Bez efektów statusu", "No injury" => "Bez obrażeń", "No hunger" => "Bez głodu", "No cold" => "Bez zimna", "No poison" => "Bez trucizny", "No curse" => "Bez klątwy", "No drowsy" => "Bez senności", "No hot" => "Bez gorąca", "Fly & teleport" => "Lot i teleport", "Long interaction" => "Daleka interakcja", "Distance" => "Dystans", "Cinematic camera" => "Kamera filmowa", "Camera speed" => "Prędkość kamery", "Noclip through geometry" => "Przenikanie przez geometrię", "Speed" => "Prędkość", "Accel" => "Przysp.", "Coords:" => "Współrz.:", "TP" => "TP", "Pranks" => "Żarty", "Pile on afflictions" => "Nałóż dolegliwości", "Cure" => "Ulecz", "Push" => "Popchnij", "Explode" => "Wysadź", "Petrify" => "Skamień", "Clear petrify" => "Usuń skamienienie", "Add arrow" => "Dodaj strzałę", "5 arrows" => "5 strzał", "Remove arrows" => "Usuń strzały", "Stuff with selected item" => "Wypełnij wybranym przedmiotem", "Fill with gold" => "Wypełnij złotem", "Fill with webs" => "Wypełnij pajęczyną", "Random items" => "Losowe przedmioty", "Clear inventory" => "Wyczyść ekwipunek", "7 balloons" => "7 balonów", "Drop items" => "Upuść przedmioty", "Plugin DLL check" => "Kontrola DLL modów", "Enable DLL check" => "Włącz kontrolę DLL", "Kick mismatches" => "Wyrzucaj różnice", "Refresh signature" => "Odśwież podpis", "Copy report" => "Kopiuj raport", "Your set: " => "Twój zestaw: ", "Error: " => "Błąd: ", _ => null, }, Lang.Turkish => en switch { "Many players" => "Çok oyuncu", "Enable larger lobbies" => "Büyük lobileri aç", "Max players" => "Maks. oyuncu", "Host-only start" => "Sadece host başlatır", "Join/leave log" => "Giriş/çıkış kaydı", "Voice group fix" => "Ses grubu düzeltmesi", "Player UI fix" => "Oyuncu UI düzeltmesi", "Give food" => "Yemek ver", "Give backpacks" => "Sırt çantası ver", "No falling ragdoll" => "Düşüş ragdoll yok", "Global voice hearing" => "Harita geneli ses", "Player ESP" => "Oyuncu ESP", "ESP distance" => "ESP mesafesi", "No status effects" => "Durum etkisi yok", "No injury" => "Yaralanma yok", "No hunger" => "Açlık yok", "No cold" => "Soğuk yok", "No poison" => "Zehir yok", "No curse" => "Lanet yok", "No drowsy" => "Uykululuk yok", "No hot" => "Sıcak yok", "Fly & teleport" => "Uçuş ve ışınlanma", "Long interaction" => "Uzak etkileşim", "Distance" => "Mesafe", "Cinematic camera" => "Sinematik kamera", "Camera speed" => "Kamera hızı", "Noclip through geometry" => "Geometriden geç", "Speed" => "Hız", "Accel" => "İvme", "Coords:" => "Koord.:", "TP" => "TP", "Pranks" => "Şakalar", "Pile on afflictions" => "Durum etkisi ekle", "Cure" => "İyileştir", "Push" => "İt", "Explode" => "Patlat", "Petrify" => "Taşa çevir", "Clear petrify" => "Taşlaşmayı kaldır", "Add arrow" => "Ok ekle", "5 arrows" => "5 ok", "Remove arrows" => "Okları çıkar", "Stuff with selected item" => "Seçili eşyayla doldur", "Fill with gold" => "Altınla doldur", "Fill with webs" => "Ağla doldur", "Random items" => "Rastgele eşyalar", "Clear inventory" => "Envanteri temizle", "7 balloons" => "7 balon", "Drop items" => "Eşyaları düşür", "Plugin DLL check" => "Mod DLL kontrolü", "Enable DLL check" => "DLL kontrolünü aç", "Kick mismatches" => "Uyumsuzları at", "Refresh signature" => "İmzayı yenile", "Copy report" => "Raporu kopyala", "Your set: " => "Senin setin: ", "Error: " => "Hata: ", _ => null, }, _ => null, }; } private static bool IsAntiCheatAllowedTab(int index) { if (index < 0 || index >= Tabs.Length) { return false; } if (!(Tabs[index] == "tab.about")) { return Tabs[index] == "tab.anticheat"; } return true; } private static void EnsureAntiCheatTabAllowed() { if (AntiCheat.ClientToolsLocked) { _favoritesOpen = false; if (!IsAntiCheatAllowedTab(_tab)) { _tab = Array.IndexOf(Tabs, "tab.anticheat"); } if (_tab < 0) { _tab = Array.IndexOf(Tabs, "tab.about"); } if (_tab < 0) { _tab = 0; } } } private static void ApplyFont() { if (!_origFontSaved) { _origFont = GUI.skin.font; _origFontSaved = true; } if (_langFontFor != Localization.Current) { _langFontFor = Localization.Current; string text = Localization.RequiredOsFont(Localization.Current); try { _langFont = (string.IsNullOrEmpty(text) ? null : Font.CreateDynamicFontFromOSFont(text, 14)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[Font] " + ex.Message)); } _langFont = null; } } GUI.skin.font = (((Object)(object)_langFont != (Object)null) ? _langFont : _origFont); } private static float UiScale() { try { if (ModConfig.UiScale != null) { return Mathf.Clamp(ModConfig.UiScale.Value, 0.6f, 2f); } } catch { } return 1f; } private static float VirtualScreenWidth() { return Mathf.Max(1f, (float)Screen.width / UiScale()); } private static float VirtualScreenHeight() { return Mathf.Max(1f, (float)Screen.height / UiScale()); } private static void BeginScaledGui(out Matrix4x4 previous) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) previous = GUI.matrix; float num = UiScale(); if (Mathf.Abs(num - 1f) > 0.001f) { GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num, num, 1f)); } } private static void EndScaledGui(Matrix4x4 previous) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GUI.matrix = previous; } public static void Draw() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0056: Expected O, but got Unknown BeginScaledGui(out var previous); try { EnsureWindowRectLoaded(); Theme.EnsureBuilt(); SyncThemeTextureCache(); ApplyFont(); ClampWindowToScreen(); _hoverTip = null; HandleWindowResize(Event.current); Rect rect = _rect; object obj = <>O.<0>__DrawWindow; if (obj == null) { WindowFunction val = DrawWindow; <>O.<0>__DrawWindow = val; obj = (object)val; } _rect = GUI.Window(44048, rect, (WindowFunction)obj, GUIContent.none, Theme.Window); ClampWindowToScreen(); PersistWindowRect(); DrawTooltipOverlay(); } finally { EndScaledGui(previous); } } public static void DrawAdminNotice() { //IL_00ea: 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_00a3: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(GameApi.AdminNoticeText) || Time.realtimeSinceStartup > GameApi.AdminNoticeUntil) { return; } BeginScaledGui(out var previous); try { Theme.EnsureBuilt(); ApplyFont(); float num = Mathf.Min(430f, VirtualScreenWidth() - 32f); Rect val = default(Rect); ((Rect)(ref val))..ctor(VirtualScreenWidth() - num - 18f, 18f, num, 64f); GUI.Box(val, GUIContent.none, Theme.Card); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 8f, ((Rect)(ref val)).width - 24f, ((Rect)(ref val)).height - 16f)); GUILayout.Label(Ru ? "Античит" : "Anti-cheat", Theme.DonateText, Array.Empty()); GUILayout.Label(GameApi.AdminNoticeText, Theme.LabelDim, Array.Empty()); GUILayout.EndArea(); } finally { EndScaledGui(previous); } } public static bool ConsumeCloseRequest() { bool closeRequested = _closeRequested; _closeRequested = false; return closeRequested; } private static void DrawWindow(int id) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) EnsureAntiCheatTabAllowed(); if (UseModernUi) { DrawWindowModern(id); return; } if ((Object)(object)_headerTex == (Object)null) { _headerTex = Theme.GradientTex(Theme.HeaderBg, Theme.HeaderDim, Mathf.RoundToInt(62f)); } if ((Object)(object)_accentTex == (Object)null) { _accentTex = Theme.Tex(Theme.Accent); } GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 62f), (Texture)(object)_headerTex); GUI.DrawTexture(new Rect(0f, 62f, ((Rect)(ref _rect)).width, 2f), (Texture)(object)_accentTex); if (Event.current != null) { float num = Mathf.Clamp(((Rect)(ref _rect)).width * 0.22f, 136f, 176f); float num2 = 74f; float num3 = ((Rect)(ref _rect)).height - num2 - 12f; float num4 = 12f + num + 12f; float num5 = ((Rect)(ref _rect)).width - num4 - 12f; GUILayout.BeginArea(new Rect(16f, 10f, ((Rect)(ref _rect)).width - 32f, 44f)); GUILayout.BeginHorizontal(Array.Empty()); DrawBrandMark(32f); GUILayout.Space(8f); GUILayout.BeginVertical(Array.Empty()); GUILayout.Label("PEAK-MX", Theme.Title, Array.Empty()); GUILayout.Label("v1.1.2 | " + L(Tabs[_tab]), Theme.Subtitle, Array.Empty()); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", Theme.CloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(34f), GUILayout.Height(26f) })) { _closeRequested = true; } GUILayout.EndHorizontal(); GUILayout.EndArea(); Rect val = default(Rect); ((Rect)(ref val))..ctor(12f, num2, num, num3); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num4, num2, num5, num3); GUI.Box(val, GUIContent.none, Theme.Panel9); GUI.Box(val2, GUIContent.none, Theme.Card); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 20f, ((Rect)(ref val)).height - 20f)); for (int i = 0; i < Tabs.Length; i++) { GUIStyle val3 = ((i == _tab) ? Theme.NavItemActive : Theme.NavItem); bool flag = (GUI.enabled = !AntiCheat.ClientToolsLocked || IsAntiCheatAllowedTab(i)); if (GUILayout.Button(L(Tabs[i]), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }) && flag) { _tab = i; } GUI.enabled = true; } GUILayout.FlexibleSpace(); GUILayout.Label(Ru ? "Тяни за край, чтобы менять размер" : "Drag any edge to resize", Theme.LabelDim, Array.Empty()); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 10f, ((Rect)(ref val2)).width - 24f, ((Rect)(ref val2)).height - 20f)); _scroll = BeginVerticalScroll(_scroll); GUILayout.Space(2f); switch (_tab) { case 0: DrawCharacter(); break; case 1: DrawCheats(); break; case 2: DrawAdminModern(); break; case 3: DrawInventory(); break; case 4: DrawWorld(); break; case 5: DrawBadges(); break; case 6: DrawCosmetics(); break; case 7: DrawAbout(); break; case 8: DrawAntiCheatModern(); break; } GUILayout.Space(4f); GUILayout.EndScrollView(); GUILayout.EndArea(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 62f)); return; } GUILayout.Space(9f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(16f); GUILayout.BeginVertical(Array.Empty()); GUILayout.Label("PEAK-MX", Theme.Title, Array.Empty()); GUILayout.Label("v1.1.2 • by maxkir041", Theme.Subtitle, Array.Empty()); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(14f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); GUILayout.Space(6f); for (int j = 0; j < Tabs.Length; j++) { GUIStyle val4 = ((j == _tab) ? Theme.NavItemActive : Theme.NavItem); bool flag3 = (GUI.enabled = !AntiCheat.ClientToolsLocked || IsAntiCheatAllowedTab(j)); if (GUILayout.Button(L(Tabs[j]), val4, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && flag3) { _tab = j; } GUI.enabled = true; } GUILayout.EndVertical(); GUILayout.Space(8f); GUILayout.BeginVertical(Array.Empty()); _scroll = BeginVerticalScroll(_scroll); GUILayout.Space(4f); switch (_tab) { case 0: DrawCharacter(); break; case 1: DrawCheats(); break; case 2: DrawAdminModern(); break; case 3: DrawInventory(); break; case 4: DrawWorld(); break; case 5: DrawBadges(); break; case 6: DrawCosmetics(); break; case 7: DrawAbout(); break; case 8: DrawAntiCheatModern(); break; } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); HLine(); string tooltip = GUI.tooltip; GUILayout.Label((!string.IsNullOrEmpty(tooltip)) ? tooltip : (Ru ? "ⓘ Наведи курсор на чит, чтобы увидеть описание" : "ⓘ Hover a cheat to see its description"), Theme.TipText, Array.Empty()); GUILayout.Label(Ru ? "❤\ufe0f Мод бесплатный — поддержать можно во вкладке «О моде»" : "❤\ufe0f This mod is free — you can support it in the About tab", Theme.DonateText, Array.Empty()); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 62f)); } private static void DrawCharacter() { if (UseModernUi && Event.current != null) { DrawCharacterModern(); } else if (Event.current != null) { if (BeginSection("character.move", L("tab.character"), defaultOpen: true)) { ModConfig.SpeedMod = Toggle("feat.speed", ModConfig.SpeedMod); if (ModConfig.SpeedMod) { ModConfig.SpeedAmount = Slider("x", ModConfig.SpeedAmount, 0.5f, 5f); } ModConfig.JumpMod = Toggle("feat.jump", ModConfig.JumpMod); if (ModConfig.JumpMod) { ModConfig.JumpAmount = Slider("x", ModConfig.JumpAmount, 1f, 5f); } EndSection(); } if (BeginSection("character.climb", Ru ? "Лазание" : "Climbing", defaultOpen: false)) { ModConfig.ClimbMod = Toggle("feat.climb", ModConfig.ClimbMod); if (ModConfig.ClimbMod) { ModConfig.ClimbAmount = Slider("x", ModConfig.ClimbAmount, 1f, 5f); } ModConfig.VineClimbMod = Toggle("feat.vineclimb", ModConfig.VineClimbMod); if (ModConfig.VineClimbMod) { ModConfig.VineClimbAmount = Slider("x", ModConfig.VineClimbAmount, 1f, 5f); } ModConfig.RopeClimbMod = Toggle("feat.ropeclimb", ModConfig.RopeClimbMod); if (ModConfig.RopeClimbMod) { ModConfig.RopeClimbAmount = Slider("x", ModConfig.RopeClimbAmount, 1f, 5f); } EndSection(); } if (BeginSection("character.status", Ru ? "Стамина и недуги" : "Stamina & afflictions", defaultOpen: false)) { Character c = TargetPicker(ref _statusTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Полная стамина" : "Full stamina", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.FullStamina(c); } if (GUILayout.Button(Ru ? "Снять все недуги" : "Clear afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c); } GUILayout.EndHorizontal(); string[] array = (Ru ? GameApi.StatusRu : GameApi.StatusEn); _selStatus = GUILayout.SelectionGrid(_selStatus, array, 3, Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); _statusAmount = Slider(Ru ? "Сила" : "Amount", _statusAmount, 0f, 1f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наложить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.SetStatus(c, _selStatus, _statusAmount); } if (GUILayout.Button(Ru ? "Убрать этот" : "Remove this", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(32f) })) { GameApi.SetStatus(c, _selStatus, 0f); } GUILayout.EndHorizontal(); EndSection(); } } else { GUILayout.Label(L("tab.character"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); ModConfig.SpeedMod = Toggle("feat.speed", ModConfig.SpeedMod); if (ModConfig.SpeedMod) { ModConfig.SpeedAmount = Slider("x", ModConfig.SpeedAmount, 0.5f, 5f); } ModConfig.JumpMod = Toggle("feat.jump", ModConfig.JumpMod); if (ModConfig.JumpMod) { ModConfig.JumpAmount = Slider("x", ModConfig.JumpAmount, 1f, 5f); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Лазание" : "Climbing", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); ModConfig.ClimbMod = Toggle("feat.climb", ModConfig.ClimbMod); if (ModConfig.ClimbMod) { ModConfig.ClimbAmount = Slider("x", ModConfig.ClimbAmount, 1f, 5f); } ModConfig.VineClimbMod = Toggle("feat.vineclimb", ModConfig.VineClimbMod); if (ModConfig.VineClimbMod) { ModConfig.VineClimbAmount = Slider("x", ModConfig.VineClimbAmount, 1f, 5f); } ModConfig.RopeClimbMod = Toggle("feat.ropeclimb", ModConfig.RopeClimbMod); if (ModConfig.RopeClimbMod) { ModConfig.RopeClimbAmount = Slider("x", ModConfig.RopeClimbAmount, 1f, 5f); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Стамина и недуги" : "Stamina & afflictions", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); Character c2 = TargetPicker(ref _statusTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Полная стамина" : "Full stamina", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.FullStamina(c2); } if (GUILayout.Button(Ru ? "Снять все недуги" : "Clear afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c2); } GUILayout.EndHorizontal(); string[] array2 = (Ru ? GameApi.StatusRu : GameApi.StatusEn); _selStatus = GUILayout.SelectionGrid(_selStatus, array2, 3, Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); _statusAmount = Slider(Ru ? "Сила" : "Amount", _statusAmount, 0f, 1f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наложить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.SetStatus(c2, _selStatus, _statusAmount); } if (GUILayout.Button(Ru ? "Убрать этот" : "Remove this", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(32f) })) { GameApi.SetStatus(c2, _selStatus, 0f); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } } private static void DrawCheats() { if (UseModernUi && Event.current != null) { DrawCheatsModern(); return; } if (Event.current != null) { if (BeginSection("cheats.core", L("tab.cheats"), defaultOpen: true)) { ModConfig.GodMode = Toggle("feat.god", ModConfig.GodMode); ModConfig.InfiniteStamina = Toggle("feat.infstam", ModConfig.InfiniteStamina); ModConfig.NoFallDamage = Toggle("feat.nofall", ModConfig.NoFallDamage); ModConfig.NoWeight = Toggle("feat.noweight", ModConfig.NoWeight); ModConfig.LockStatus = Toggle("feat.lockstatus", ModConfig.LockStatus); EndSection(); } if (BeginSection("cheats.fly", Ru ? "Полет и телепорт" : "Fly & teleport", defaultOpen: false)) { ModConfig.TeleportToPing = Toggle("feat.tpping", ModConfig.TeleportToPing); ModConfig.Fly = Toggle("feat.fly", ModConfig.Fly); if (ModConfig.Fly) { ModConfig.Noclip = ToggleRaw(Ru ? "Ноклип" : "Noclip", Ru ? "Отключает локальные коллайдеры во время полёта, чтобы можно было проходить сквозь стены." : "Disables local colliders while flying so you can move through walls.", ModConfig.Noclip); ModConfig.FlySpeed = Slider(Ru ? "Скорость" : "Speed", ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Ru ? "Ускорение" : "Accel", ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Коорд.:" : "Coords:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); if (GUILayout.Button(Ru ? "ТП" : "TP", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(54f), GUILayout.Height(26f) }) && (float.TryParse(_tpX, out var result) & float.TryParse(_tpY, out var result2) & float.TryParse(_tpZ, out var result3))) { GameApi.TeleportToCoords(result, result2, result3); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.actions", Ru ? "Действия" : "Actions", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Воскресить себя" : "Revive self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ReviveSelf(); } if (GUILayout.Button(Ru ? "Убить себя" : "Kill self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.KillSelf(); } if (GUILayout.Button(Ru ? "К точке спавна" : "Warp to spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.WarpToSpawn(); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.players", Ru ? "Игроки" : "Players", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить список" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } if (GUILayout.Button(Ru ? "Воскресить всех" : "Revive all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.ReviveAll(); } if (GUILayout.Button(Ru ? "Притянуть всех" : "Warp all to me", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.WarpAllToMe(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Убить всех" : "Kill all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.KillAll(_excludeSelf); } _excludeSelf = GUILayout.Toggle(_excludeSelf, Ru ? " Не трогать себя" : " Exclude me", Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); GUILayout.EndHorizontal(); if (GameApi.PlayerChars.Count == 0) { GUILayout.Label(Ru ? "Список пуст - нажми «Обновить» в лобби" : "Empty - press Refresh in a lobby", Theme.LabelDim, Array.Empty()); } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val = GameApi.PlayerChars[i]; if ((Object)(object)val == (Object)null) { continue; } bool flag = false; try { flag = val.IsLocal; } catch { } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?") + ((!flag) ? "" : (Ru ? " (ты)" : " (you)")), Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); if (!flag) { if (GUILayout.Button("TP", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { GameApi.WarpToPlayer(val); } if (GUILayout.Button(Ru ? "Спавн" : "Spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { GameApi.WarpPlayerToSpawn(val); } if (GUILayout.Button(Ru ? "Притянуть" : "Bring", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { GameApi.BringPlayer(val); } if (GUILayout.Button(Ru ? "Убить" : "Kill", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { GameApi.KillPlayer(val); } if (GUILayout.Button(Ru ? "Ожив." : "Revive", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { GameApi.RevivePlayer(val); } } if (GUILayout.Button(Ru ? "Скаут" : "Scout", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { GameApi.SpawnScoutmaster(val); } GUILayout.EndHorizontal(); } EndSection(); } if (BeginSection("cheats.pranks", Ru ? "Приколы" : "Pranks", defaultOpen: false)) { Character c = TargetPicker(ref _prankTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наслать все недуги" : "Pile on afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PrankAfflict(c); } if (GUILayout.Button(Ru ? "Вылечить" : "Cure", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c); } GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Забить инвентарь выбранным предметом" : "Stuff inventory with selected item", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.FillInventoryWith(c, _selItem); } GUILayout.Label(Ru ? "Предмет берётся из вкладки «Инвентарь». Физические шарики есть в новой версии вкладки." : "The item comes from the Inventory tab. Physical balloons are available in the newer tab.", Theme.LabelDim, Array.Empty()); EndSection(); } return; } GUILayout.Label(L("tab.cheats"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); ModConfig.GodMode = Toggle("feat.god", ModConfig.GodMode); ModConfig.InfiniteStamina = Toggle("feat.infstam", ModConfig.InfiniteStamina); ModConfig.NoFallDamage = Toggle("feat.nofall", ModConfig.NoFallDamage); ModConfig.NoWeight = Toggle("feat.noweight", ModConfig.NoWeight); ModConfig.LockStatus = Toggle("feat.lockstatus", ModConfig.LockStatus); GUILayout.EndVertical(); GUILayout.Label(Ru ? "Полёт и телепорт" : "Fly & teleport", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); ModConfig.TeleportToPing = Toggle("feat.tpping", ModConfig.TeleportToPing); ModConfig.Fly = Toggle("feat.fly", ModConfig.Fly); if (ModConfig.Fly) { ModConfig.FlySpeed = Slider(Ru ? "Скорость" : "Speed", ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Ru ? "Ускорение" : "Accel", ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Действия" : "Actions", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Воскресить себя" : "Revive self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ReviveSelf(); } if (GUILayout.Button(Ru ? "Убить себя" : "Kill self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.KillSelf(); } if (GUILayout.Button(Ru ? "К точке спавна" : "Warp to spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.WarpToSpawn(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Коорд.:" : "Coords:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); if (GUILayout.Button(Ru ? "ТП" : "TP", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(54f), GUILayout.Height(26f) }) && (float.TryParse(_tpX, out var result4) & float.TryParse(_tpY, out var result5) & float.TryParse(_tpZ, out var result6))) { GameApi.TeleportToCoords(result4, result5, result6); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Label(Ru ? "Игроки" : "Players", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить список" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } if (GUILayout.Button(Ru ? "Воскресить всех" : "Revive all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.ReviveAll(); } if (GUILayout.Button(Ru ? "Притянуть всех" : "Warp all to me", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.WarpAllToMe(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Убить всех" : "Kill all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.KillAll(_excludeSelf); } _excludeSelf = GUILayout.Toggle(_excludeSelf, Ru ? " Не трогать себя" : " Exclude me", Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); GUILayout.EndHorizontal(); if (GameApi.PlayerChars.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» в лобби" : "Empty — press Refresh in a lobby", Theme.LabelDim, Array.Empty()); } for (int j = 0; j < GameApi.PlayerChars.Count; j++) { Character val2 = GameApi.PlayerChars[j]; if ((Object)(object)val2 == (Object)null) { continue; } bool flag2 = false; try { flag2 = val2.IsLocal; } catch { } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(((j < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[j] : "?") + ((!flag2) ? "" : (Ru ? " (ты)" : " (you)")), Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); if (!flag2) { if (GUILayout.Button("TP", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { GameApi.WarpToPlayer(val2); } if (GUILayout.Button(Ru ? "Притянуть" : "Bring", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { GameApi.BringPlayer(val2); } if (GUILayout.Button(Ru ? "Убить" : "Kill", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { GameApi.KillPlayer(val2); } if (GUILayout.Button(Ru ? "Ожив." : "Revive", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { GameApi.RevivePlayer(val2); } } if (GUILayout.Button(Ru ? "Скаут" : "Scout", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { GameApi.SpawnScoutmaster(val2); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Приколы \ud83d\ude08" : "Pranks \ud83d\ude08", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); Character c2 = TargetPicker(ref _prankTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наслать все недуги" : "Pile on afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PrankAfflict(c2); } if (GUILayout.Button(Ru ? "Вылечить" : "Cure", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c2); } GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "\ud83c\udf92 Забить инвентарь выбранным предметом" : "\ud83c\udf92 Stuff inventory with selected item", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.FillInventoryWith(c2, _selItem); } GUILayout.Label(Ru ? "Предмет берётся из вкладки «Инвентарь». Физические шарики на игроке — добавлю отдельно." : "Item comes from the Inventory tab. Physical balloons on a player will come separately.", Theme.LabelDim, Array.Empty()); GUILayout.EndVertical(); } private static void DrawInventory() { //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0a76: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) if (UseModernUi && Event.current != null) { DrawInventoryModern(); return; } if (Event.current != null) { if (BeginSection("inventory.spawn", Ru ? "Спавн предметов" : "Item spawner", defaultOpen: true)) { if (GameApi.ItemNames.Count <= 0) { if (GUILayout.Button(Ru ? "Загрузить список предметов" : "Load item list", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.EnsureItemsLoaded(); } } else { GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character val = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Кому:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(Ru ? "Себе" : "Me", (_invTarget < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = -1; } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val2 = GameApi.PlayerChars[i]; bool flag = false; try { flag = (Object)(object)val2 != (Object)null && val2.IsLocal; } catch { } if (!flag && GUILayout.Button((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?", (_invTarget == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = i; } } if (GUILayout.Button(Ru ? "Обн." : "Sync", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(52f), GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } GUILayout.EndHorizontal(); int num = (((Object)(object)val != (Object)null) ? GameApi.SlotCountFor(val) : GameApi.SlotCount()); if (num <= 0) { num = 3; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int j = 0; j < num; j++) { if (GUILayout.Button((j + 1).ToString(), (_selSlot == j) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = j; } } GUILayout.EndHorizontal(); _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(170f)); string text = (_itemSearch ?? "").Trim().ToLowerInvariant(); for (int k = 0; k < GameApi.ItemNames.Count; k++) { string text2 = GameApi.ItemNames[k]; if ((text.Length <= 0 || text2.ToLowerInvariant().IndexOf(text) >= 0) && DrawItemListRow(k, text2, _selItem == k)) { _selItem = k; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Заспавнить в слот" : "Spawn to slot", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && _selItem >= 0) { if ((Object)(object)val != (Object)null) { GameApi.SpawnToSlotFor(val, _selItem, _selSlot); } else { GameApi.SpawnToSlot(_selItem, _selSlot); } } if (GUILayout.Button(Ru ? "Очистить слот" : "Clear slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(28f) })) { if ((Object)(object)val != (Object)null) { GameApi.ClearSlotFor(val, _selSlot); } else { GameApi.ClearSlot(_selSlot); } } GUILayout.EndHorizontal(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } if ((Object)(object)val != (Object)null) { GUILayout.Label((Ru ? "Редактируешь инвентарь игрока: " : "Editing player's inventory: ") + ((_invTarget < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[_invTarget] : "?"), Theme.LabelDim, Array.Empty()); } } EndSection(); } if (!BeginSection("inventory.recharge", Ru ? "Перезарядка предметов" : "Item recharge", defaultOpen: false)) { return; } ModConfig.RechargeValue = NumberField(Ru ? "Заряд" : "Charge", ModConfig.RechargeValue, 0f, 999f); GUILayout.BeginHorizontal(Array.Empty()); for (int l = 0; l < Mathf.Min(3, GameApi.SlotCount()); l++) { int num2 = l; if (GUILayout.Button((Ru ? "Слот " : "Slot ") + (num2 + 1), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RechargeSlot(num2, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить выбранный слот" : "Recharge selected slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeSlot(_selSlot, ModConfig.RechargeValue); } if (GUILayout.Button(Ru ? "Зарядить все" : "Recharge all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int m = 0; m < GameApi.SlotCount(); m++) { GameApi.RechargeSlot(m, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); EndSection(); return; } GUILayout.Label(Ru ? "Спавн предметов" : "Item spawner", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); if (GameApi.ItemNames.Count == 0) { if (GUILayout.Button(Ru ? "\ud83d\udce6 Загрузить список предметов" : "\ud83d\udce6 Load item list", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.EnsureItemsLoaded(); } } else { GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character val3 = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Кому:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(Ru ? "Себе" : "Me", (_invTarget < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = -1; } for (int n = 0; n < GameApi.PlayerChars.Count; n++) { Character val4 = GameApi.PlayerChars[n]; bool flag2 = false; try { flag2 = (Object)(object)val4 != (Object)null && val4.IsLocal; } catch { } if (!flag2 && GUILayout.Button((n < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[n] : "?", (_invTarget == n) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = n; } } if (GUILayout.Button(Ru ? "Обн." : "Sync", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(52f), GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } TipLast(Ru ? "Обновить список игроков для просмотра и редактирования их инвентаря." : "Refresh the player list for viewing and editing inventories."); GUILayout.EndHorizontal(); int num3 = (((Object)(object)val3 != (Object)null) ? GameApi.SlotCountFor(val3) : GameApi.SlotCount()); if (num3 <= 0) { num3 = 3; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int num4 = 0; num4 < num3; num4++) { if (GUILayout.Button((num4 + 1).ToString(), (_selSlot == num4) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = num4; } } GUILayout.EndHorizontal(); _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(170f)); string text3 = (_itemSearch ?? "").Trim().ToLowerInvariant(); for (int num5 = 0; num5 < GameApi.ItemNames.Count; num5++) { string text4 = GameApi.ItemNames[num5]; if ((text3.Length <= 0 || text4.ToLowerInvariant().IndexOf(text3) >= 0) && DrawItemListRow(num5, text4, _selItem == num5)) { _selItem = num5; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Заспавнить в слот" : "Spawn to slot", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && _selItem >= 0) { if ((Object)(object)val3 != (Object)null) { GameApi.SpawnToSlotFor(val3, _selItem, _selSlot); } else { GameApi.SpawnToSlot(_selItem, _selSlot); } } if (GUILayout.Button(Ru ? "Очистить слот" : "Clear slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(28f) })) { if ((Object)(object)val3 != (Object)null) { GameApi.ClearSlotFor(val3, _selSlot); } else { GameApi.ClearSlot(_selSlot); } } GUILayout.EndHorizontal(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } if ((Object)(object)val3 != (Object)null) { GUILayout.Label((Ru ? "⚠ Меняешь инвентарь игрока: " : "⚠ Editing player's inventory: ") + ((_invTarget < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[_invTarget] : "?"), Theme.LabelDim, Array.Empty()); } } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Перезарядка предметов" : "Item recharge", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); ModConfig.RechargeValue = Slider(Ru ? "Заряд" : "Charge", ModConfig.RechargeValue, 0f, 999f); GUILayout.BeginHorizontal(Array.Empty()); for (int num6 = 0; num6 < Mathf.Min(3, GameApi.SlotCount()); num6++) { int num7 = num6; if (GUILayout.Button((Ru ? "Слот " : "Slot ") + (num7 + 1), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RechargeSlot(num7, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить выбранный слот" : "Recharge selected slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeSlot(_selSlot, ModConfig.RechargeValue); } if (GUILayout.Button(Ru ? "Зарядить все" : "Recharge all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int num8 = 0; num8 < GameApi.SlotCount(); num8++) { GameApi.RechargeSlot(num8, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private static void DrawWorld() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Invalid comparison between Unknown and I4 //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b57: Unknown result type (might be due to invalid IL or missing references) //IL_0b5c: Unknown result type (might be due to invalid IL or missing references) if (UseModernUi && Event.current != null) { DrawWorldModern(); return; } if (Event.current != null) { float num = GameApi.ExpeditionTimeSeconds(); float timeOfDayNow = GameApi.TimeOfDay(); int num2 = GameApi.DayCount(); if ((int)Event.current.type == 7) { SyncTimeOfDayInput(timeOfDayNow); } if (BeginSection("world.time", Ru ? "Время и забег" : "Time & run", defaultOpen: true)) { GUILayout.Label((Ru ? "Время забега: " : "Run time: ") + FormatRunTime(num), Theme.LabelDim, Array.Empty()); GUILayout.Label((Ru ? "День: " : "Day: ") + num2 + " " + (Ru ? "Час: " : "Hour: ") + timeOfDayNow.ToString("0.0"), Theme.LabelDim, Array.Empty()); bool flag = Toggle(Ru ? "Держать время забега" : "Hold run timer", ModConfig.OverrideExpeditionTime); if (flag != ModConfig.OverrideExpeditionTime) { if (flag && ModConfig.ExpeditionTimeSeconds <= 0f) { ModConfig.ExpeditionTimeSeconds = num; } ModConfig.OverrideExpeditionTime = flag; } ModConfig.ExpeditionTimeSeconds = NumberField(Ru ? "Секунды забега" : "Run seconds", ModConfig.ExpeditionTimeSeconds, 0f, 7200f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "-60 сек" : "-60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds = Mathf.Max(0f, ModConfig.ExpeditionTimeSeconds - 60f); GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } if (GUILayout.Button(Ru ? "Применить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } if (GUILayout.Button(Ru ? "+60 сек" : "+60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds += 60f; GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } GUILayout.EndHorizontal(); float num3 = NumberField(TimeOfDayLabel(), _timeOfDay, 0f, 24f); if (Mathf.Abs(num3 - _timeOfDay) > 0.001f) { _timeOfDay = num3; _timePreset = PresetForHour(_timeOfDay); _timeOfDayDirty = true; } GUILayout.BeginHorizontal(Array.Empty()); TimePresetButton(Ru ? "Рассвет" : "Dawn", 6f, 0, Ru ? "Выбрать рассвет." : "Choose dawn."); TimePresetButton(Ru ? "День" : "Day", 12f, 1, Ru ? "Выбрать день." : "Choose daytime."); TimePresetButton(Ru ? "Закат" : "Dusk", 19f, 2, Ru ? "Выбрать закат." : "Choose dusk."); TimePresetButton(Ru ? "Ночь" : "Night", 23f, 3, Ru ? "Выбрать ночь." : "Choose night."); GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Применить время суток" : "Apply time of day", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ApplySelectedTimeOfDay(); } EndSection(); } if (BeginSection("world.finish", Ru ? "Финиш" : "Finish", defaultOpen: false)) { GUILayout.Label(Ru ? "Мгновенно завершает текущий забег победой." : "Instantly ends the current run as a win.", Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Ru ? "Мгновенно пройти" : "Force win", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ForceWin(); } EndSection(); } if (!BeginSection("world.luggage", Ru ? "Контейнеры рядом" : "Nearby containers", defaultOpen: false)) { return; } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить (300 м)" : "Refresh (300 m)", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshLuggage(); _selLuggage = -1; } if (GUILayout.Button(Ru ? "Открыть все рядом" : "Open all nearby", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.OpenAllNearbyLuggage(); } GUILayout.EndHorizontal(); if (GameApi.LuggageLabels.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» в катке." : "Empty — press Refresh during a run.", Theme.LabelDim, Array.Empty()); } else { _luggageScroll = BeginVerticalScroll(_luggageScroll, GUILayout.Height(150f)); for (int i = 0; i < GameApi.LuggageLabels.Count; i++) { if (GUILayout.Button(GameApi.LuggageLabels[i], (_selLuggage == i) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { _selLuggage = i; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Открыть выбранный" : "Open selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.OpenLuggage(_selLuggage); } if (GUILayout.Button(Ru ? "Телепорт к нему" : "Warp to it", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.WarpToLuggage(_selLuggage); } GUILayout.EndHorizontal(); } EndSection(); return; } GUILayout.Label(Ru ? "Время и забег" : "Time & run", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); float num4 = GameApi.ExpeditionTimeSeconds(); float timeOfDayNow2 = GameApi.TimeOfDay(); int num5 = GameApi.DayCount(); if ((int)Event.current.type == 7) { SyncTimeOfDayInput(timeOfDayNow2); } GUILayout.Label((Ru ? "Время забега: " : "Run time: ") + FormatRunTime(num4), Theme.LabelDim, Array.Empty()); GUILayout.Label((Ru ? "День: " : "Day: ") + num5 + " " + (Ru ? "Час: " : "Hour: ") + timeOfDayNow2.ToString("0.0"), Theme.LabelDim, Array.Empty()); bool flag2 = Toggle(Ru ? "Держать время забега" : "Hold run timer", ModConfig.OverrideExpeditionTime); if (flag2 != ModConfig.OverrideExpeditionTime) { ModConfig.OverrideExpeditionTime = flag2; if (flag2) { ModConfig.ExpeditionTimeSeconds = num4; } } ModConfig.ExpeditionTimeSeconds = Slider(Ru ? "Секунды забега" : "Run seconds", ModConfig.ExpeditionTimeSeconds, 0f, 7200f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "-60 сек" : "-60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds = Mathf.Max(0f, ModConfig.ExpeditionTimeSeconds - 60f); GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } if (GUILayout.Button(Ru ? "Применить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } if (GUILayout.Button(Ru ? "+60 сек" : "+60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds += 60f; GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } GUILayout.EndHorizontal(); float num6 = Slider(TimeOfDayLabel(), _timeOfDay, 0f, 24f); if (Mathf.Abs(num6 - _timeOfDay) > 0.001f) { _timeOfDay = num6; _timePreset = PresetForHour(_timeOfDay); _timeOfDayDirty = true; } GUILayout.BeginHorizontal(Array.Empty()); TimePresetButton(Ru ? "Рассвет" : "Dawn", 6f, 0, Ru ? "Выбрать рассвет." : "Choose dawn."); TimePresetButton(Ru ? "День" : "Day", 12f, 1, Ru ? "Выбрать день." : "Choose daytime."); TimePresetButton(Ru ? "Закат" : "Dusk", 19f, 2, Ru ? "Выбрать закат." : "Choose dusk."); TimePresetButton(Ru ? "Ночь" : "Night", 23f, 3, Ru ? "Выбрать ночь." : "Choose night."); GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Применить время суток" : "Apply time of day", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ApplySelectedTimeOfDay(); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Финиш" : "Finish", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.Label(Ru ? "Мгновенно завершает текущий забег победой." : "Instantly ends the current run as a win.", Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Ru ? "Мгновенно пройти" : "Force win", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ForceWin(); } GUILayout.EndVertical(); GUILayout.Label(Ru ? "Контейнеры рядом" : "Nearby containers", Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить (300 м)" : "Refresh (300 m)", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshLuggage(); _selLuggage = -1; } if (GUILayout.Button(Ru ? "Открыть все рядом" : "Open all nearby", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.OpenAllNearbyLuggage(); } GUILayout.EndHorizontal(); if (GameApi.LuggageLabels.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» в катке." : "Empty — press Refresh during a run.", Theme.LabelDim, Array.Empty()); } else { _luggageScroll = BeginVerticalScroll(_luggageScroll, GUILayout.Height(150f)); for (int j = 0; j < GameApi.LuggageLabels.Count; j++) { if (GUILayout.Button(GameApi.LuggageLabels[j], (_selLuggage == j) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { _selLuggage = j; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Открыть выбранный" : "Open selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.OpenLuggage(_selLuggage); } if (GUILayout.Button(Ru ? "Телепорт к нему" : "Warp to it", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.WarpToLuggage(_selLuggage); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } private static string FormatRunTime(float seconds) { int num = Mathf.Max(0, Mathf.FloorToInt(seconds)); int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; if (num2 <= 0) { return $"{num3:00}:{num4:00}"; } return $"{num2:00}:{num3:00}:{num4:00}"; } private static string TimeOfDayLabel() { if (!Ru) { return "Time of day"; } return "Время суток"; } private static void SyncTimeOfDayInput(float timeOfDayNow) { if (!_timeOfDayDirty) { _timeOfDay = Mathf.Repeat(timeOfDayNow, 24f); _timePreset = PresetForHour(_timeOfDay); SetNumberText(TimeOfDayLabel(), 0f, 24f, _timeOfDay); } } private static int PresetForHour(float hour) { hour = Mathf.Repeat(hour, 24f); if (Mathf.Abs(Mathf.DeltaAngle(hour * 15f, 90f)) <= 0.75f) { return 0; } if (Mathf.Abs(Mathf.DeltaAngle(hour * 15f, 180f)) <= 0.75f) { return 1; } if (Mathf.Abs(Mathf.DeltaAngle(hour * 15f, 285f)) <= 0.75f) { return 2; } if (Mathf.Abs(Mathf.DeltaAngle(hour * 15f, 345f)) <= 0.75f) { return 3; } return -1; } private static void TimePresetButton(string label, float hour, int preset, string tip) { bool flag = _timePreset == preset || PresetForHour(_timeOfDay) == preset; if (GUILayout.Button(label, flag ? Theme.ChipActive : Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _timeOfDay = hour; _timePreset = preset; _timeOfDayDirty = true; SetNumberText(TimeOfDayLabel(), 0f, 24f, _timeOfDay); } TipLast(tip); } private static void ApplySelectedTimeOfDay() { _timeOfDay = Mathf.Repeat(_timeOfDay, 24f); GameApi.SetTimeOfDay(_timeOfDay); _timeOfDayDirty = false; _timePreset = PresetForHour(_timeOfDay); SetNumberText(TimeOfDayLabel(), 0f, 24f, _timeOfDay); } private static void DrawBadges() { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Invalid comparison between Unknown and I4 //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Expected O, but got Unknown //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) if (UseModernUi) { DrawBadgesModern(); return; } ACHIEVEMENTTYPE[] allTypes = SteamAch.AllTypes; int num = allTypes.Length; bool[] array = new bool[num]; int num2 = 0; for (int i = 0; i < num; i++) { if (array[i] = SteamAch.IsUnlocked(allTypes[i])) { num2++; } } GUILayout.Label(L("tab.badges"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Получено: " : "Unlocked: ") + num2 + " / " + num, Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Ru ? "Выдать все" : "Unlock all", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SteamAch.UnlockAll(); } if (GUILayout.Button(Ru ? "Отозвать все" : "Revoke all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SteamAch.RevokeAll(); } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Клик по иконке — выдать / отозвать. Зелёная = получена, красная = нет." : "Click an icon to unlock / revoke. Green = unlocked, red = locked.", Theme.LabelDim, Array.Empty()); if ((Object)(object)_tileBg == (Object)null) { _tileBg = Theme.RoundedTex(Theme.Panel, 8); } if ((Object)(object)_frameOn == (Object)null) { _frameOn = Theme.RoundedTex(Theme.Accent, 8); } if ((Object)(object)_frameOff == (Object)null) { _frameOff = Theme.RoundedTex(BadgeLocked, 8); } float num3 = Mathf.Max(1f, ((Rect)(ref _rect)).width - 270f); int num4 = Mathf.Max(3, Mathf.FloorToInt((num3 + 6f) / 86f)); float num5 = Mathf.Clamp(((Rect)(ref _rect)).height - 240f, 160f, 420f); _badgeScroll = BeginVerticalScroll(_badgeScroll, GUILayout.Height(num5)); for (int j = 0; j < num; j++) { if (j % num4 == 0) { GUILayout.BeginHorizontal(Array.Empty()); } ACHIEVEMENTTYPE t = allTypes[j]; bool flag = array[j]; Rect rect = GUILayoutUtility.GetRect(80f, 80f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(80f) }); if ((int)Event.current.type == 7) { GUI.DrawTexture(rect, (Texture)(object)(flag ? _frameOn : _frameOff)); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + 3f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width - 6f, ((Rect)(ref rect)).height - 6f), (Texture)(object)_tileBg); Texture2D val = SteamAch.Icon(t); float num6 = ((Rect)(ref rect)).x + 10f; float num7 = ((Rect)(ref rect)).y + 10f; if ((Object)(object)val != (Object)null) { GUI.DrawTexture(new Rect(num6, num7, 60f, 60f), (Texture)(object)val); } else { GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 80f, 80f), "…", Theme.LabelDim); } } string text = SteamAch.DisplayName(t); string text2 = SteamAch.Desc(t); if (!string.IsNullOrEmpty(text2)) { text = text + "\n" + text2; } if (GUI.Button(rect, new GUIContent("", text), GUIStyle.none)) { SteamAch.Toggle(t); } GUILayout.Space(6f); if (j % num4 == num4 - 1 || j == num - 1) { GUILayout.EndHorizontal(); } if (j % num4 == num4 - 1) { GUILayout.Space(6f); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static void DrawCosmetics() { GUILayout.Label(L("tab.cosmetics"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); if (GUILayout.Button(Ru ? "Разблокировать всю косметику" : "Unlock all cosmetics", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { SteamAch.UnlockAllCosmetics(); } GUILayout.Label(Ru ? "Косметика в PEAK открывается через достижения и стат максимальной высоты. Кнопка выдаёт все ачивки и поднимает этот стат — после этого наряды доступны в настройке персонажа." : "Cosmetics in PEAK unlock via achievements and the max height stat. This grants all achievements and raises that stat, so outfits become available in character customization.", Theme.LabelDim, Array.Empty()); GUILayout.EndVertical(); } private static void DrawAbout() { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null) { GUILayout.Label("PEAK-MX v1.1.2", Theme.Section, Array.Empty()); GUILayout.Label(Ru ? "Автор: maxkir041" : "Author: maxkir041", Theme.Label, Array.Empty()); DrawTesterThanks(); GUILayout.Space(6f); GUILayout.Label(L("ui.language"), Theme.Section, Array.Empty()); DrawLanguagePicker(); DrawMenuKeyBinding(); DrawQuickActionSettings(); DrawUiScaleSettings(); DrawUpdateChecker(); DrawThemeColorSettings(); DrawWindowSettings(); DrawCompatibilityPanel(); GUILayout.Space(6f); GUILayout.Label(Ru ? "Окно" : "Window", Theme.Section, Array.Empty()); GUILayout.Label(Ru ? "Перетаскивай меню за шапку и тяни за любую грань или угол, как обычное окно." : "Drag the menu by its header and resize it by any edge or corner, like a regular app window.", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Стандартный размер" : "Default size", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _rect = DefaultWindowRect(); } if (GUILayout.Button(Ru ? "По центру" : "Center", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(100f), GUILayout.Height(28f) })) { CenterWindow(); } GUILayout.EndHorizontal(); GUILayout.Label((Ru ? "Текущий размер: " : "Current size: ") + Mathf.RoundToInt(((Rect)(ref _rect)).width) + " x " + Mathf.RoundToInt(((Rect)(ref _rect)).height), Theme.LabelDim, Array.Empty()); GUILayout.Space(6f); GUILayout.Label(Ru ? "Ссылки:" : "Links:", Theme.Section, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("GitHub", "https://github.com/maxkir041/PEAK-MX"); LinkButton("Thunderstore", "https://thunderstore.io/c/peak/p/maxkir041/PEAK_MX/"); LinkButton("Nexus", "https://www.nexusmods.com/peak/mods/179"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("Steam", "https://steamcommunity.com/id/everyng/"); LinkButton("Telegram", "https://t.me/maxkir041"); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label(SupportText(), Theme.DonateText, Array.Empty()); if (GUILayout.Button(DonateTextLabel(), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) })) { OpenUrl("https://www.donationalerts.com/r/maxkir041"); } GUILayout.Space(6f); DrawQr(150f); GUILayout.Label(QrHintText(), Theme.LabelDim, Array.Empty()); DrawDonationSupportPanel(compact: false); GUILayout.Space(6f); bool value = ModConfig.ShowDonateNotice.Value; bool flag = GUILayout.Toggle(value, ReminderToggleText(), Theme.Label, Array.Empty()); if (flag != value) { ModConfig.ShowDonateNotice.Value = flag; } GUILayout.Space(6f); GUILayout.Label(Ru ? "Неофициальный фанатский мод. Не связан с разработчиками PEAK. Сторонние библиотеки остаются под своими лицензиями." : "Unofficial fan-made mod. Not affiliated with PEAK's developers. Third-party libraries keep their own licenses.", Theme.LabelDim, Array.Empty()); return; } GUILayout.Label("PEAK-MX v1.1.2", Theme.Section, Array.Empty()); GUILayout.Label(Ru ? "Автор: maxkir041" : "Author: maxkir041", Theme.Label, Array.Empty()); GUILayout.Space(6f); GUILayout.Label(L("ui.language"), Theme.Section, Array.Empty()); DrawLanguagePicker(); DrawMenuKeyBinding(); DrawQuickActionSettings(); DrawUiScaleSettings(); DrawUpdateChecker(); DrawThemeColorSettings(); DrawWindowSettings(); DrawCompatibilityPanel(); GUILayout.Space(6f); GUILayout.Label(Ru ? "Размер меню" : "Menu size", Theme.Section, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); float value2 = ModConfig.UiScale.Value; if (GUILayout.Button("−", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(40f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = Mathf.Clamp(value2 - 0.1f, 0.6f, 2f); } GUILayout.Label((value2 * 100f).ToString("0") + "%", Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (GUILayout.Button("+", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(40f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = Mathf.Clamp(value2 + 0.1f, 0.6f, 2f); } if (GUILayout.Button(Ru ? "Сброс" : "Reset", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = 1f; } GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.Label(Ru ? "Ссылки:" : "Links:", Theme.Section, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("GitHub", "https://github.com/maxkir041/PEAK-MX"); LinkButton("Thunderstore", "https://thunderstore.io/c/peak/p/maxkir041/PEAK_MX/"); LinkButton("Nexus", "https://www.nexusmods.com/peak/mods/179"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("Steam", "https://steamcommunity.com/id/everyng/"); LinkButton("Telegram", "https://t.me/maxkir041"); GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label(SupportText(), Theme.DonateText, Array.Empty()); if (GUILayout.Button(DonateTextLabel(), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) })) { OpenUrl("https://www.donationalerts.com/r/maxkir041"); } GUILayout.Space(6f); DrawQr(150f); GUILayout.Label(QrHintText(), Theme.LabelDim, Array.Empty()); DrawDonationSupportPanel(compact: false); GUILayout.Space(6f); bool value3 = ModConfig.ShowDonateNotice.Value; bool flag2 = GUILayout.Toggle(value3, ReminderToggleText(), Theme.Label, Array.Empty()); if (flag2 != value3) { ModConfig.ShowDonateNotice.Value = flag2; } GUILayout.Space(6f); GUILayout.Label(Ru ? "Неофициальный фанатский мод. Не связан с разработчиками PEAK. Сторонние библиотеки — под своими лицензиями." : "Unofficial fan-made mod. Not affiliated with PEAK's developers. Third-party libraries keep their own licenses.", Theme.LabelDim, Array.Empty()); } private static void DrawLanguagePicker() { string text = ""; (Lang, string)[] options = Localization.Options; for (int i = 0; i < options.Length; i++) { var (lang, text2) = options[i]; if (lang == Localization.Current) { text = text2; } } if (GUILayout.Button(text + (_langOpen ? " ▲" : " ▼"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(210f), GUILayout.Height(28f) })) { _langOpen = !_langOpen; } if (!_langOpen) { return; } GUILayout.BeginVertical(Theme.Card, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(210f) }); options = Localization.Options; for (int i = 0; i < options.Length; i++) { (Lang, string) tuple2 = options[i]; var (lang2, _) = tuple2; if (GUILayout.Button(tuple2.Item2, (lang2 == Localization.Current) ? Theme.NavItemActive : Theme.NavItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })) { Localization.Current = lang2; ModConfig.Language.Value = (int)lang2; _langOpen = false; } } GUILayout.EndVertical(); } private static void DrawMenuKeyBinding() { //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) CaptureMenuKeyEvent(); GUILayout.Space(6f); GUILayout.Label(Ru ? "Клавиша меню" : "Menu key", Theme.Section, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Текущая: " : "Current: ") + ((object)ModConfig.MenuToggleKey.Value/*cast due to .constrained prefix*/).ToString(), Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); if (GUILayout.Button((!_waitingForMenuKey) ? (Ru ? "Изменить" : "Change") : (Ru ? "Нажми клавишу..." : "Press a key..."), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _waitingForMenuKey = true; } if (GUILayout.Button(Ru ? "Сброс" : "Reset", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(28f) })) { ModConfig.MenuToggleKey.Value = (KeyCode)277; _waitingForMenuKey = false; } GUILayout.EndHorizontal(); GUILayout.Label((!_waitingForMenuKey) ? (Ru ? "Клавиша применяется сразу и сохраняется в конфиге." : "The key applies immediately and is saved to config.") : (Ru ? "Нажми новую клавишу. Esc отменяет." : "Press the new key. Esc cancels."), Theme.LabelDim, Array.Empty()); } private unsafe static void DrawQuickActionSettings() { //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_0121: Unknown result type (might be due to invalid IL or missing references) CaptureQuickActionKeyEvent(); if (ModConfig.QuickActionKeys == null || ModConfig.QuickActionIds == null || !BeginSection("about.quick_actions", Ru ? "Быстрые клавиши" : "Quick actions", defaultOpen: false)) { return; } GUILayout.Label(Ru ? "Назначь клавишу на часто используемую функцию. Срабатывает только когда меню закрыто." : "Bind a key to a frequently used action. It only fires while the menu is closed.", Theme.LabelDim, Array.Empty()); for (int i = 0; i < 8; i++) { string id = QuickActions.NormalizeId(ModConfig.QuickActionIds[i].Value); KeyCode value = ModConfig.QuickActionKeys[i].Value; bool flag = _quickActionPickerSlot == i; bool flag2 = _quickActionCaptureSlot == i; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("#" + (i + 1), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) }); if (GUILayout.Button(QuickActions.Label(id, Ru), flag ? Theme.ChipActive : Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _quickActionPickerSlot = (flag ? (-1) : i); } TipLast(QuickActions.Tip(id, Ru)); if (GUILayout.Button((!flag2) ? (((int)value != 0) ? ((object)(*(KeyCode*)(&value))/*cast due to .constrained prefix*/).ToString() : (Ru ? "Нет" : "None")) : (Ru ? "Нажми..." : "Press..."), flag2 ? Theme.DonateBtn : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(28f) })) { _quickActionCaptureSlot = i; _waitingForMenuKey = false; } TipLast(Ru ? "Назначить клавишу. Esc отменяет, Backspace/Delete очищает." : "Bind a key. Esc cancels, Backspace/Delete clears."); if (GUILayout.Button("X", Theme.CloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(34f), GUILayout.Height(28f) })) { ModConfig.QuickActionKeys[i].Value = (KeyCode)0; ModConfig.QuickActionIds[i].Value = "none"; if (_quickActionPickerSlot == i) { _quickActionPickerSlot = -1; } if (_quickActionCaptureSlot == i) { _quickActionCaptureSlot = -1; } } GUILayout.EndHorizontal(); if (flag) { DrawQuickActionPicker(i); } } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Скопировать список" : "Copy list", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GUIUtility.systemCopyBuffer = BuildQuickActionList(); _quickActionCopiedUntil = Time.realtimeSinceStartup + 2f; } if (GUILayout.Button(Ru ? "Сбросить по умолчанию" : "Reset defaults", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ResetQuickActions(); } GUILayout.EndHorizontal(); if (Time.realtimeSinceStartup < _quickActionCopiedUntil) { GUILayout.Label(Ru ? "Список скопирован." : "List copied.", Theme.LabelDim, Array.Empty()); } EndSection(); } private static void DrawQuickActionPicker(int slot) { GUILayout.BeginVertical(Theme.Panel9, Array.Empty()); for (int i = 0; i < QuickActions.Actions.Length; i++) { if (i % 2 == 0) { GUILayout.BeginHorizontal(Array.Empty()); } QuickActions.Definition definition = QuickActions.Actions[i]; bool flag = string.Equals(ModConfig.QuickActionIds[slot].Value, definition.Id, StringComparison.OrdinalIgnoreCase); if (GUILayout.Button(Ru ? definition.Ru : definition.En, flag ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { QuickActions.SetSlotAction(slot, definition.Id); _quickActionPickerSlot = -1; } TipLast(Ru ? definition.TipRu : definition.TipEn); if (i % 2 == 1 || i == QuickActions.Actions.Length - 1) { GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); } private static void CaptureQuickActionKeyEvent() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_0066: 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) Event current = Event.current; if (_quickActionCaptureSlot >= 0 && current != null && (int)current.type == 4) { int quickActionCaptureSlot = _quickActionCaptureSlot; if ((int)current.keyCode == 27) { _quickActionCaptureSlot = -1; current.Use(); } else if ((int)current.keyCode == 8 || (int)current.keyCode == 127) { ModConfig.QuickActionKeys[quickActionCaptureSlot].Value = (KeyCode)0; _quickActionCaptureSlot = -1; current.Use(); } else if ((int)current.keyCode != 0) { ModConfig.QuickActionKeys[quickActionCaptureSlot].Value = current.keyCode; _quickActionCaptureSlot = -1; GUI.FocusControl((string)null); current.Use(); } } } private static string BuildQuickActionList() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 8; i++) { stringBuilder.Append(i + 1).Append(". ").Append(ModConfig.QuickActionKeys[i].Value) .Append(" -> ") .Append(QuickActions.Label(ModConfig.QuickActionIds[i].Value, Ru)) .AppendLine(); } return stringBuilder.ToString(); } private static void ResetQuickActions() { KeyCode[] array = new KeyCode[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array2 = (KeyCode[])(object)array; string[] array3 = new string[8] { "toggle_fly", "full_stamina", "anti_stuck", "none", "none", "none", "none", "none" }; for (int i = 0; i < 8; i++) { ModConfig.QuickActionKeys[i].Value = array2[i]; ModConfig.QuickActionIds[i].Value = array3[i]; } _quickActionCaptureSlot = -1; _quickActionPickerSlot = -1; } private static void DrawWindowSettings() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("about.window_editor", Ru ? "Окно и интерфейс" : "Window & interface", defaultOpen: false)) { GUILayout.Label((Ru ? "Размер: " : "Size: ") + Mathf.RoundToInt(((Rect)(ref _rect)).width) + " x " + Mathf.RoundToInt(((Rect)(ref _rect)).height), Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Стандартный размер" : "Default size", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _rect = DefaultWindowRect(); } if (GUILayout.Button(Ru ? "По центру" : "Center", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { CenterWindow(); } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Масштаб и цвета выше сохраняются в конфиге. Окно можно тянуть за шапку и менять размер за края." : "Scale and colors above are saved in the config. Drag the header and resize by the edges.", Theme.LabelDim, Array.Empty()); EndSection(); } } private static void DrawCompatibilityPanel() { if (BeginSection("about.compatibility", Ru ? "Диагностика и совместимость" : "Diagnostics & compatibility", defaultOpen: false)) { GUILayout.Label(Ru ? "Быстрая проверка методов и полей игры, от которых зависят функции PEAK-MX после обновлений PEAK." : "Quick check of game methods and fields used by PEAK-MX after PEAK updates.", Theme.LabelDim, Array.Empty()); List list = CompatibilityDiagnostics.Rows(Ru); for (int i = 0; i < list.Count; i++) { CompatibilityDiagnostics.Row row = list[i]; GUILayout.Label((row.Ok ? "[OK] " : "[!] ") + row.Name + ": " + row.Detail, row.Ok ? Theme.LabelDim : Theme.DonateText, Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить игроки/предметы" : "Refresh players/items", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RefreshPlayers(); GameApi.LoadItems(); MxAhgHost.RefreshLocal(); } if (GUILayout.Button(Ru ? "Скопировать отчет" : "Copy report", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GUIUtility.systemCopyBuffer = CompatibilityDiagnostics.BuildReport(Ru); _compatCopiedUntil = Time.realtimeSinceStartup + 2f; } GUILayout.EndHorizontal(); if (Time.realtimeSinceStartup < _compatCopiedUntil) { GUILayout.Label(Ru ? "Отчет скопирован." : "Report copied.", Theme.LabelDim, Array.Empty()); } EndSection(); } } private static void DrawUiScaleSettings() { GUILayout.Space(6f); GUILayout.Label(Ru ? "Масштаб меню" : "Menu scale", Theme.Section, Array.Empty()); float num = UiScale(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("-", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(40f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = Mathf.Clamp(num - 0.1f, 0.6f, 2f); } GUILayout.Label((UiScale() * 100f).ToString("0") + "%", Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) }); if (GUILayout.Button("+", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(40f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = Mathf.Clamp(num + 0.1f, 0.6f, 2f); } if (GUILayout.Button(Ru ? "Сброс" : "Reset", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(28f) })) { ModConfig.UiScale.Value = 1f; } GUILayout.EndHorizontal(); } private static void DrawUpdateChecker() { GUILayout.Label(Ru ? "Обновления" : "Updates", Theme.Section, Array.Empty()); GUILayout.Label((Ru ? "Установлена версия: " : "Installed version: ") + "1.1.2", Theme.LabelDim, Array.Empty()); GUILayout.Label((!UpdateChecker.IsChecking) ? (UpdateChecker.Error ?? (UpdateChecker.UpdateAvailable ? ((Ru ? "Доступна версия: " : "Available version: ") + UpdateChecker.LatestVersion) : ((!UpdateChecker.HasChecked) ? "" : (Ru ? "Новых версий нет." : "No newer release.")))) : (Ru ? "Проверка..." : "Checking..."), Theme.Label, Array.Empty()); if (GUILayout.Button(Ru ? "Проверить" : "Check", Theme.LinkBtn, Array.Empty())) { UpdateChecker.CheckAsync(force: true); } LinkButton("GitHub Releases", "https://github.com/maxkir041/PEAK-MX/releases"); } private static void DrawThemeColorSettings() { GUILayout.Space(6f); GUILayout.Label(Ru ? "Акцентные цвета" : "Accent colors", Theme.Section, Array.Empty()); GUILayout.Label(Ru ? "Меняет цвет выделения, полос, переключателей и основных кнопок. Сохраняется в конфиге." : "Changes highlights, stripes, switches, and primary buttons. Saved in config.", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); ThemeColorPreset[] themeColorPresets = ThemeColorPresets; for (int i = 0; i < themeColorPresets.Length; i++) { ThemeColorPreset themeColorPreset = themeColorPresets[i]; if (GUILayout.Button(Ru ? themeColorPreset.RuName : themeColorPreset.EnName, Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { ApplyThemePalette(themeColorPreset.AccentHex, themeColorPreset.ActionHex); } } if (GUILayout.Button(Ru ? "Сброс" : "Reset", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(26f) })) { ApplyThemePalette("#41D58A", "#599FF4"); } GUILayout.EndHorizontal(); DrawColorEditor(Ru ? "Акцент" : "Accent", ModConfig.AccentColorHex, "#41D58A", ref _accentHexText); DrawColorEditor(Ru ? "Кнопки" : "Buttons", ModConfig.ActionColorHex, "#599FF4", ref _actionHexText); } private static string ClipInput(string value, int max) { if (value == null) { return ""; } if (value.Length > max) { return value.Substring(0, max); } return value; } private static string ClipUi(string value, int max) { if (string.IsNullOrWhiteSpace(value)) { return ""; } string text = value.Trim(); if (text.Length > max) { return text.Substring(0, Math.Max(1, max - 1)) + "..."; } return text; } private static void DrawColorEditor(string label, ConfigEntry entry, string fallbackHex, ref string hexText) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) string text = Theme.NormalizeHex(entry?.Value, fallbackHex); Color val = Theme.ColorFromHex(text, Theme.ColorFromHex(fallbackHex, Theme.Accent)); if (string.IsNullOrEmpty(hexText)) { hexText = text; } GUILayout.BeginVertical(Theme.Panel9, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); DrawColorSwatch(val, 34f, 22f); string text2 = GUILayout.TextField(hexText, Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(92f), GUILayout.Height(28f) }); hexText = ((text2.Length > 7) ? text2.Substring(0, 7) : text2); string text3 = Theme.NormalizeHex(hexText, null); bool flag = false; if (!string.IsNullOrEmpty(text3) && !string.Equals(text3, text, StringComparison.OrdinalIgnoreCase)) { val = Theme.ColorFromHex(text3, val); flag = true; } GUILayout.FlexibleSpace(); if (GUILayout.Button(Ru ? "Сброс" : "Reset", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(28f) })) { val = Theme.ColorFromHex(fallbackHex, val); flag = true; } GUILayout.EndHorizontal(); float num = Mathf.Round(Slider(label + " R", val.r * 255f, 0f, 255f)); float num2 = Mathf.Round(Slider(label + " G", val.g * 255f, 0f, 255f)); float num3 = Mathf.Round(Slider(label + " B", val.b * 255f, 0f, 255f)); Color val2 = default(Color); ((Color)(ref val2))..ctor(num / 255f, num2 / 255f, num3 / 255f, 1f); if (Theme.ColorToHex(val2) != Theme.ColorToHex(val)) { val = val2; flag = true; } if (flag) { ApplyThemeColor(entry, val, ref hexText); } GUILayout.EndVertical(); } private static void DrawColorSwatch(Color color, float width, float height) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(width, height, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) }); Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } private static void ApplyThemePalette(string accentHex, string actionHex) { if (ModConfig.AccentColorHex != null) { ModConfig.AccentColorHex.Value = Theme.NormalizeHex(accentHex, "#41D58A"); } if (ModConfig.ActionColorHex != null) { ModConfig.ActionColorHex.Value = Theme.NormalizeHex(actionHex, "#599FF4"); } _accentHexText = ModConfig.AccentColorHex?.Value; _actionHexText = ModConfig.ActionColorHex?.Value; Theme.EnsureBuilt(); SyncThemeTextureCache(force: true); } private static void ApplyThemeColor(ConfigEntry entry, Color color, ref string hexText) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = Theme.ColorToHex(color); if (entry != null && !string.Equals(entry.Value, text, StringComparison.OrdinalIgnoreCase)) { entry.Value = text; } hexText = text; Theme.EnsureBuilt(); SyncThemeTextureCache(force: true); } private static void CaptureMenuKeyEvent() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0032: 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) Event current = Event.current; if (_waitingForMenuKey && current != null && (int)current.type == 4) { if ((int)current.keyCode == 27) { _waitingForMenuKey = false; current.Use(); } else if ((int)current.keyCode != 0) { ModConfig.MenuToggleKey.Value = current.keyCode; _waitingForMenuKey = false; GUI.FocusControl((string)null); current.Use(); } } } private static string SupportText() { return Localization.Current switch { Lang.Russian => "PEAK-MX остаётся бесплатным. Ваша поддержка помогает мне уделять больше времени разработке и быстрее выпускать обновления и исправления. Спасибо, что помогаете моду становиться лучше!", Lang.Ukrainian => "PEAK-MX залишається безкоштовним. Ваша підтримка допомагає мені приділяти більше часу розробці та швидше випускати оновлення й виправлення. Дякую, що допомагаєте робити мод кращим!", Lang.Spanish => "PEAK-MX sigue siendo gratuito. Tu apoyo me permite dedicar más tiempo al desarrollo y publicar actualizaciones y correcciones más rápido. ¡Gracias por ayudar a mejorar el mod!", Lang.PortugueseBR => "PEAK-MX continua gratuito. Seu apoio me ajuda a dedicar mais tempo ao desenvolvimento e lançar atualizações e correções mais rápido. Obrigado por ajudar a melhorar o mod!", Lang.German => "PEAK-MX bleibt kostenlos. Deine Unterstützung hilft mir, mehr Zeit in die Entwicklung zu investieren und Updates und Fehlerbehebungen schneller zu veröffentlichen. Danke, dass du den Mod besser machst!", Lang.French => "PEAK-MX reste gratuit. Votre soutien me permet de consacrer plus de temps au développement et de publier les mises à jour et les correctifs plus rapidement. Merci de faire progresser le mod !", Lang.Italian => "PEAK-MX resta gratuito. Il tuo supporto mi aiuta a dedicare più tempo allo sviluppo e a pubblicare aggiornamenti e correzioni più rapidamente. Grazie per aiutarmi a migliorare il mod!", Lang.Polish => "PEAK-MX pozostaje darmowy. Twoje wsparcie pozwala mi poświęcać więcej czasu na rozwój oraz szybciej wydawać aktualizacje i poprawki. Dziękuję za pomoc w ulepszaniu moda!", Lang.Turkish => "PEAK-MX ücretsiz kalmaya devam ediyor. Desteğiniz, geliştirmeye daha fazla zaman ayırmama ve güncellemeler ile hata düzeltmelerini daha hızlı yayınlamama yardımcı oluyor. Modu geliştirmeme yardımcı olduğunuz için teşekkürler!", Lang.ChineseSimplified => "PEAK-MX 依然免费。你的支持让我能投入更多时间开发,更快推出更新和修复补丁。感谢你帮助这个模组变得更好!", Lang.ChineseTraditional => "PEAK-MX 依然免費。你的支持讓我能投入更多時間開發,更快推出更新和修正檔。感謝你幫助這個模組變得更好!", Lang.Japanese => "PEAK-MX は引き続き無料です。ご支援のおかげで開発により多くの時間を使い、更新や不具合修正をより早く届けられます。MOD の改善を支えてくださり、ありがとうございます!", Lang.Korean => "PEAK-MX는 계속 무료입니다. 후원해 주시면 개발에 더 많은 시간을 쏟고 업데이트와 버그 수정을 더 빠르게 제공할 수 있습니다. 모드가 더 좋아질 수 있도록 도와주셔서 감사합니다!", _ => "PEAK-MX remains free. Your support helps me spend more time on development and release updates and fixes sooner. Thank you for helping make the mod better!", }; } private static string DonateTextLabel() { switch (Localization.Current) { case Lang.Russian: return "Поддержать"; case Lang.Ukrainian: return "Підтримати"; case Lang.Spanish: return "Apoyar"; case Lang.PortugueseBR: return "Apoiar"; case Lang.German: return "Unterstuetzen"; case Lang.French: return "Soutenir"; case Lang.Italian: return "Supporta"; case Lang.Polish: return "Wesprzyj"; case Lang.Turkish: return "Destekle"; case Lang.ChineseSimplified: case Lang.ChineseTraditional: return "支持"; case Lang.Japanese: return "支援する"; case Lang.Korean: return "후원"; default: return "Support"; } } private static string CloseTextLabel() { switch (Localization.Current) { case Lang.Russian: return "Закрыть"; case Lang.Ukrainian: return "Закрити"; case Lang.Spanish: return "Cerrar"; case Lang.PortugueseBR: return "Fechar"; case Lang.German: return "Schliessen"; case Lang.French: return "Fermer"; case Lang.Italian: return "Chiudi"; case Lang.Polish: return "Zamknij"; case Lang.Turkish: return "Kapat"; case Lang.ChineseSimplified: case Lang.ChineseTraditional: return "关闭"; case Lang.Japanese: return "閉じる"; case Lang.Korean: return "닫기"; default: return "Close"; } } private static string ReminderToggleText() { return Localization.Current switch { Lang.Russian => " Показывать напоминание при запуске", Lang.Ukrainian => " Показувати нагадування при запуску", Lang.Spanish => " Mostrar recordatorio al iniciar", Lang.PortugueseBR => " Mostrar lembrete ao iniciar", Lang.German => " Erinnerung beim Start zeigen", Lang.French => " Afficher le rappel au lancement", Lang.Italian => " Mostra promemoria all'avvio", Lang.Polish => " Pokazuj przypomnienie przy starcie", Lang.Turkish => " Baslangicta hatirlatma goster", Lang.ChineseSimplified => " 启动时显示提醒", Lang.ChineseTraditional => " 啟動時顯示提醒", Lang.Japanese => " 起動時にリマインダーを表示", Lang.Korean => " 시작 시 알림 표시", _ => " Show reminder on launch", }; } private static string InstallsLabel() { return Localization.Current switch { Lang.Russian => "Установок: ", Lang.Ukrainian => "Встановлень: ", Lang.Spanish => "Instalaciones: ", Lang.PortugueseBR => "Instalacoes: ", Lang.German => "Installationen: ", Lang.French => "Installations: ", Lang.Italian => "Installazioni: ", Lang.Polish => "Instalacje: ", Lang.Turkish => "Kurulumlar: ", Lang.ChineseSimplified => "安装数: ", Lang.ChineseTraditional => "安裝數: ", Lang.Japanese => "インストール数: ", Lang.Korean => "설치 수: ", _ => "Installs: ", }; } private static string QrHintText() { return Localization.Current switch { Lang.Russian => "Сканируй QR для поддержки", Lang.Ukrainian => "Скануй QR для підтримки", Lang.Spanish => "Escanea el QR para apoyar", Lang.PortugueseBR => "Escaneie o QR para apoiar", Lang.German => "QR scannen zum Unterstuetzen", Lang.French => "Scanne le QR pour soutenir", Lang.Italian => "Scansiona il QR per supportare", Lang.Polish => "Zeskanuj QR, aby wesprzec", Lang.Turkish => "Destek icin QR'yi tara", Lang.ChineseSimplified => "扫描二维码支持", Lang.ChineseTraditional => "掃描 QR 碼支持", Lang.Japanese => "QR を読み取って支援", Lang.Korean => "QR을 스캔해 후원", _ => "Scan the QR to support", }; } private static string CosmeticCategoryLabel(GameApi.CosmeticCategory category) { return category switch { GameApi.CosmeticCategory.Skin => Ru ? "Кожа" : "Skin", GameApi.CosmeticCategory.Accessory => Ru ? "Аксессуар" : "Accessory", GameApi.CosmeticCategory.Eyes => Ru ? "Глаза" : "Eyes", GameApi.CosmeticCategory.Mouth => Ru ? "Рот" : "Mouth", GameApi.CosmeticCategory.Outfit => Ru ? "Одежда" : "Outfit", GameApi.CosmeticCategory.Hat => Ru ? "Шляпа" : "Hat", GameApi.CosmeticCategory.Sash => Ru ? "Лента" : "Sash", GameApi.CosmeticCategory.Medal => Ru ? "Медаль" : "Medal", _ => category.ToString(), }; } private static string CosmeticDisplayName(CustomizationOption option) { if ((Object)(object)option == (Object)null) { return "-"; } try { if (option.isBlank) { return Ru ? "Пусто" : "Empty"; } } catch { } string text = ""; try { text = ((Object)option).name ?? ""; } catch { } if (string.IsNullOrWhiteSpace(text)) { text = "Cosmetic"; } string text2 = HumanizeName(text); if (!Ru) { return text2; } return TranslateCosmeticRu(text2); } private static string HumanizeName(string raw) { string text = ""; char c = '\0'; for (int i = 0; i < raw.Length; i++) { char c2 = raw[i]; if (c2 == '_' || c2 == '-') { text += " "; } else { if (i > 0 && char.IsUpper(c2) && (char.IsLower(c) || char.IsDigit(c))) { text += " "; } text += c2; } c = c2; } text = WebUtility.HtmlDecode(text).Trim(); while (text.Contains(" ")) { text = text.Replace(" ", " "); } if (!string.IsNullOrWhiteSpace(text)) { return text; } return raw; } private static string TranslateCosmeticRu(string human) { string[] array = human.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["eye"] = "глаз", ["eyes"] = "глаза", ["mouth"] = "рот", ["skin"] = "кожа", ["hat"] = "шляпа", ["cap"] = "кепка", ["crown"] = "корона", ["goat"] = "козёл", ["sash"] = "лента", ["fit"] = "наряд", ["outfit"] = "одежда", ["accessory"] = "аксессуар", ["red"] = "красный", ["blue"] = "синий", ["green"] = "зелёный", ["yellow"] = "жёлтый", ["black"] = "чёрный", ["white"] = "белый", ["gold"] = "золотой", ["silver"] = "серебряный", ["pink"] = "розовый", ["purple"] = "фиолетовый", ["orange"] = "оранжевый", ["brown"] = "коричневый", ["small"] = "маленький", ["big"] = "большой", ["large"] = "большой", ["round"] = "круглый", ["sad"] = "грустный", ["happy"] = "счастливый", ["angry"] = "злой", ["sleepy"] = "сонный", ["normal"] = "обычный", ["default"] = "обычный", ["empty"] = "пусто", ["glasses"] = "очки", ["mask"] = "маска", ["bandana"] = "бандана", ["flower"] = "цветок" }; for (int i = 0; i < array.Length; i++) { if (dictionary.TryGetValue(array[i], out var value)) { array[i] = value; } } if (array.Length == 0) { return human; } string text = string.Join(" ", array); return char.ToUpperInvariant(text[0]) + ((text.Length > 1) ? text.Substring(1) : ""); } private static void DrawCosmeticsModern2() { //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(L("tab.cosmetics"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.Label(Ru ? "Здесь можно выбирать именно косметику по категориям, а не только выдавать связанные достижения." : "Here you can choose specific cosmetics by category, not just grant the linked achievements.", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Разблокировать всю косметику" : "Unlock all cosmetics", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { SteamAch.UnlockAllCosmetics(); } if (GUILayout.Button(Ru ? "Сбросить стат высоты" : "Reset height stat", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { SteamAch.SetMaxAscent(0); } GUILayout.EndHorizontal(); GameApi.CosmeticCategory[] array = (GameApi.CosmeticCategory[])Enum.GetValues(typeof(GameApi.CosmeticCategory)); GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < array.Length; i++) { if (GUILayout.Button(CosmeticCategoryLabel(array[i]), (_cosmeticCategory == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _cosmeticCategory = i; } } GUILayout.EndHorizontal(); GameApi.CosmeticCategory category = array[Mathf.Clamp(_cosmeticCategory, 0, array.Length - 1)]; CustomizationOption[] cosmeticOptions = GameApi.GetCosmeticOptions(category); int currentCosmeticIndex = GameApi.GetCurrentCosmeticIndex(category); int num = GameApi.FindBlankCosmeticIndex(category); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Активно: " : "Active: ") + ((currentCosmeticIndex >= 0 && currentCosmeticIndex < cosmeticOptions.Length && (Object)(object)cosmeticOptions[currentCosmeticIndex] != (Object)null) ? ((Object)cosmeticOptions[currentCosmeticIndex]).name : "-"), Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (num >= 0 && GUILayout.Button(Ru ? "Выключить" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.SetCosmetic(category, num); } GUILayout.EndHorizontal(); _cosmeticScroll = BeginVerticalScroll(_cosmeticScroll, GUILayout.Height(Mathf.Clamp(((Rect)(ref _rect)).height - 260f, 180f, 360f))); for (int j = 0; j < cosmeticOptions.Length; j++) { CustomizationOption val = cosmeticOptions[j]; if ((Object)(object)val == (Object)null) { continue; } bool flag = j == currentCosmeticIndex; string text = CosmeticDisplayName(val); try { if (!val.isBlank && val.IsLocked) { text += (Ru ? " [закрыто]" : " [locked]"); } } catch { } if (GUILayout.Button(text, flag ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { GameApi.SetCosmetic(category, j); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static void DrawCosmeticsModern3() { //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(L("tab.cosmetics"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.Label(Ru ? "Выбирай конкретную категорию и конкретный предмет косметики. Элементы можно открывать и сбрасывать отдельно." : "Choose a category and a specific cosmetic item. Options can be unlocked and reset one by one.", Theme.LabelDim, Array.Empty()); GUILayout.Label(Ru ? "Важно: закрытие некоторых предметов сбрасывает связанное достижение, стат или максимальную высоту, поэтому может повлиять на несколько косметик сразу." : "Important: locking some cosmetics resets a linked achievement, stat, or max height value, so it can affect multiple cosmetics at once.", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Разблокировать всё" : "Unlock all", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.UnlockAllCosmeticOptions(); } TipLast(Ru ? "Локально открывает все элементы косметики и дополнительно выставляет связанные Steam-условия." : "Locally unlocks every cosmetic option and also applies related Steam requirements."); if (GUILayout.Button(Ru ? "Сбросить стат высоты" : "Reset height stat", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { SteamAch.SetMaxAscent(0); } TipLast(Ru ? "Сбрасывает стат максимальной высоты до 0. Может закрыть косметику, завязанную на высоту." : "Resets the max height stat to 0. Can lock height-gated cosmetics."); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Случайная одежда и цвет" : "Random outfit + color", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RandomizeOutfitAndColor(); } TipLast(Ru ? "Случайно меняет цвет, лицо, одежду, ленту, медаль и остальные категории." : "Randomly changes color, face, outfit, sash, medal, and the other categories."); ModConfig.RapidRandomOutfitColor = ToggleCompact(Ru ? "Быстро менять" : "Rapid shuffle", ModConfig.RapidRandomOutfitColor); TipLast(Ru ? "Быстро крутит одежду и цвет, пока включено." : "Rapidly shuffles outfit and color while enabled."); GUILayout.EndHorizontal(); if (ModConfig.RapidRandomOutfitColor) { ModConfig.RapidRandomOutfitColorInterval = Slider(Ru ? "Пауза смены" : "Shuffle delay", ModConfig.RapidRandomOutfitColorInterval, 0.08f, 1f); } GameApi.CosmeticCategory[] array = (GameApi.CosmeticCategory[])Enum.GetValues(typeof(GameApi.CosmeticCategory)); GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i < array.Length; i++) { if (GUILayout.Button(CosmeticCategoryLabel(array[i]), (_cosmeticCategory == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _cosmeticCategory = i; } } GUILayout.EndHorizontal(); GameApi.CosmeticCategory category = array[Mathf.Clamp(_cosmeticCategory, 0, array.Length - 1)]; CustomizationOption[] cosmeticOptions = GameApi.GetCosmeticOptions(category); int currentCosmeticIndex = GameApi.GetCurrentCosmeticIndex(category); int num = GameApi.FindBlankCosmeticIndex(category); int num2 = 0; for (int j = 0; j < cosmeticOptions.Length; j++) { if (!((Object)(object)cosmeticOptions[j] == (Object)null)) { num2++; } } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Активно: " : "Active: ") + ((currentCosmeticIndex >= 0 && currentCosmeticIndex < cosmeticOptions.Length && (Object)(object)cosmeticOptions[currentCosmeticIndex] != (Object)null) ? CosmeticDisplayName(cosmeticOptions[currentCosmeticIndex]) : "-"), Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (num >= 0 && GUILayout.Button(Ru ? "Выключить" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.SetCosmetic(category, num); } TipLast(Ru ? "Поставить пустой вариант в текущей категории косметики." : "Select the blank option for the current cosmetic category."); GUILayout.EndHorizontal(); GUILayout.Label((Ru ? "Элементов: " : "Options: ") + num2, Theme.LabelDim, Array.Empty()); if (num2 == 0) { GUILayout.Label(Ru ? "В этой категории пока нет элементов." : "This category has no items yet.", Theme.LabelDim, Array.Empty()); } _cosmeticScroll = BeginVerticalScroll(_cosmeticScroll, GUILayout.Height(Mathf.Clamp(((Rect)(ref _rect)).height - 260f, 180f, 360f))); for (int k = 0; k < cosmeticOptions.Length; k++) { CustomizationOption val = cosmeticOptions[k]; if ((Object)(object)val == (Object)null) { continue; } bool flag = GameApi.IsCosmeticOptionGrantable(category, val); bool flag2 = k == currentCosmeticIndex; bool flag3 = false; string text = CosmeticDisplayName(val); try { flag3 = flag && val.IsLocked; } catch { } if (!flag && !val.isBlank) { text += (Ru ? " [невыдаваемое]" : " [unobtainable]"); } GUILayout.BeginHorizontal(Array.Empty()); if (DrawCosmeticListRow(category, val, text + ((!flag3) ? "" : (Ru ? " [закрыто]" : " [locked]")), flag2, flag3)) { GameApi.SetCosmetic(category, k); } TipLast((flag || val.isBlank) ? ((!flag3) ? (Ru ? "Выбрать этот элемент косметики." : "Select this cosmetic.") : (Ru ? "Элемент закрыт. Нажми «Открыть», чтобы разблокировать его отдельно." : "This option is locked. Press Unlock to unlock it separately.")) : (Ru ? "Можно надеть, но нельзя открывать или закрывать как обычную косметику." : "Can be equipped, but cannot be unlocked or locked like normal cosmetics.")); if (GUILayout.Button(Ru ? "Выбрать" : "Select", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(82f), GUILayout.Height(30f) })) { GameApi.SetCosmetic(category, k); } TipLast(Ru ? "Надеть этот элемент косметики." : "Equip this cosmetic option."); if (flag && flag3 && GUILayout.Button(Ru ? "Открыть" : "Unlock", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(82f), GUILayout.Height(30f) })) { GameApi.UnlockCosmeticOption(val); GameApi.SetCosmetic(category, k); } if (flag && flag3) { TipLast(Ru ? "Открыть конкретный элемент без разблокировки всей категории." : "Unlock this specific cosmetic without unlocking the whole category."); } if (flag && !flag3 && !val.isBlank && GUILayout.Button(Ru ? "Закрыть" : "Lock", Theme.DangerBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(82f), GUILayout.Height(30f) })) { if (flag2 && num >= 0 && num != k) { GameApi.SetCosmetic(category, num); } GameApi.LockCosmeticOption(val); } if (flag && !flag3 && !val.isBlank) { TipLast(Ru ? "Сбросить открытие этого элемента. Может сбросить достижение, стат или максимальную высоту." : "Reset this option's unlock. May reset a linked achievement, stat, or max height value."); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static bool DrawCosmeticListRow(GameApi.CosmeticCategory category, CustomizationOption option, string name, bool active, bool locked) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(10f, 34f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(34f) }); bool result = GUI.Button(rect, GUIContent.none, active ? Theme.ListItemActive : Theme.ListItem); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 6f, ((Rect)(ref rect)).y + 5f, 24f, 24f); Texture val2 = null; Color val3 = Color.clear; bool flag = false; try { val2 = (((Object)(object)option != (Object)null) ? option.texture : null); if ((Object)(object)val2 == (Object)null && (Object)(object)option != (Object)null && (Object)(object)option.fitMaterial != (Object)null) { val2 = option.fitMaterial.mainTexture; } if ((Object)(object)val2 == (Object)null && (Object)(object)option != (Object)null && (Object)(object)option.fitHatMaterial != (Object)null) { val2 = option.fitHatMaterial.mainTexture; } if ((Object)(object)option != (Object)null && !option.isBlank) { val3 = option.color; flag = val3.a > 0.01f; } } catch { } if ((Object)(object)val2 != (Object)null) { Color color = GUI.color; GUI.color = (Color)(locked ? new Color(1f, 1f, 1f, 0.52f) : Color.white); if (category == GameApi.CosmeticCategory.Eyes) { GUI.DrawTextureWithTexCoords(val, val2, new Rect(0f, 1f, 1f, -1f), true); } else { GUI.DrawTexture(val, val2, (ScaleMode)2, true); } GUI.color = color; } else if (flag) { Texture2D val4 = Theme.Tex((Color)(locked ? new Color(val3.r, val3.g, val3.b, 0.5f) : val3)); GUI.DrawTexture(val, (Texture)(object)val4); } else { string text = (string.IsNullOrWhiteSpace(name) ? "?" : name.Trim()[0].ToString().ToUpperInvariant()); GUI.Label(val, text, ItemIconFallbackStyle()); } GUI.Label(new Rect(((Rect)(ref rect)).x + 38f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width - 44f, ((Rect)(ref rect)).height - 4f), name, Theme.RowLabel); return result; } private static void DrawCosmeticsModern() { GUILayout.Label(L("tab.cosmetics"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.Label(Ru ? "Косметика в PEAK в основном открывается через достижения и стат максимальной высоты. Здесь можно точечно управлять связанными достижениями." : "PEAK cosmetics mostly unlock through achievements and max height progression. You can manage the linked unlocks more precisely here.", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Разблокировать всю косметику" : "Unlock all cosmetics", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { SteamAch.UnlockAllCosmetics(); } if (GUILayout.Button(Ru ? "Сбросить стат высоты" : "Reset height stat", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { SteamAch.SetMaxAscent(0); } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Стат максимальной высоты" : "Max height stat", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); for (int i = 0; i <= 8; i++) { int maxAscent = i; if (GUILayout.Button(maxAscent.ToString(), Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(34f), GUILayout.Height(26f) })) { SteamAch.SetMaxAscent(maxAscent); } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); DrawBadgesModern(); } private static void DrawAboutModern() { int num = Mathf.Clamp(_simpleSection[7], 0, 3); bool advancedUi = AdvancedUi; if (advancedUi || num == 0) { GUILayout.Label("PEAK-MX v1.1.2", Theme.Section, Array.Empty()); GUILayout.Label(Ru ? "Автор: maxkir041" : "Author: maxkir041", Theme.Label, Array.Empty()); GUILayout.Label(L("ui.language"), Theme.Section, Array.Empty()); DrawLanguagePicker(); DrawUpdateChecker(); } if (advancedUi || num == 1) { GUILayout.Label(Tx("Управление и вид", "Controls & appearance", "控制与外观", "控制與外觀"), Theme.Section, Array.Empty()); DrawMenuKeyBinding(); DrawQuickActionSettings(); DrawUiScaleSettings(); DrawThemeColorSettings(); DrawWindowSettings(); DrawCompatibilityPanel(); } if (advancedUi || num == 2) { GUILayout.Label(Ru ? "Ссылки" : "Links", Theme.Section, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("GitHub", "https://github.com/maxkir041/PEAK-MX"); LinkButton("Thunderstore", "https://thunderstore.io/c/peak/p/maxkir041/PEAK_MX/"); LinkButton("Nexus", "https://www.nexusmods.com/peak/mods/179"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); LinkButton("Steam", "https://steamcommunity.com/id/everyng/"); LinkButton("Telegram", "https://t.me/maxkir041"); GUILayout.EndHorizontal(); } if (advancedUi || num == 3) { DrawTesterThanks(); GUILayout.Space(8f); GUILayout.Label(SupportText(), Theme.DonateText, Array.Empty()); if (GUILayout.Button(DonateTextLabel(), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(180f), GUILayout.Height(30f) })) { OpenUrl("https://www.donationalerts.com/r/maxkir041"); } GUILayout.Space(6f); DrawQr(150f); GUILayout.Label(QrHintText(), Theme.LabelDim, Array.Empty()); DrawDonationSupportPanel(compact: false); GUILayout.Space(6f); bool value = ModConfig.ShowDonateNotice.Value; bool flag = ToggleRaw(ReminderToggleText().Trim(), Ru ? "Показывать окно поддержки при запуске игры." : "Show the support reminder when the game starts.", value); if (flag != value) { ModConfig.ShowDonateNotice.Value = flag; } } } private static void DrawTesterThanks() { GUILayout.Space(6f); GUILayout.BeginVertical(Theme.Panel9, Array.Empty()); GUILayout.Label(Localization.Pick(Localization.Current, "Отдельная благодарность тестировщикам", "Special thanks to the testers", "特别感谢测试人员", "特別感謝測試人員", "Окрема подяка тестувальникам", "テスターへの特別な感謝", "테스터 특별 감사", "Agradecimiento especial a los testers", "Agradecimento especial aos testadores", "Besonderer Dank an die Tester", "Remerciements particuliers aux testeurs", "Un ringraziamento speciale ai tester", "Specjalne podziękowania dla testerów", "Test ekibine özel teşekkürler"), Theme.Section, Array.Empty()); GUILayout.Label("SaLaBiDay | Noado", Theme.Label, Array.Empty()); GUILayout.Label(Localization.Pick(Localization.Current, "За тщательное тестирование, подробные отчёты и помощь в развитии PEAK-MX.", "For thorough testing, detailed reports, and helping PEAK-MX grow.", "感谢细致测试、详细报告以及对 PEAK-MX 发展的帮助。", "感謝細緻測試、詳細報告以及對 PEAK-MX 發展的幫助。", "За ретельне тестування, докладні звіти та допомогу в розвитку PEAK-MX.", "丁寧なテスト、詳細な報告、そして PEAK-MX の改善への協力に感謝します。", "꼼꼼한 테스트와 자세한 보고, PEAK-MX 발전에 도움을 주셔서 감사합니다.", "Por las pruebas exhaustivas, los informes detallados y la ayuda para mejorar PEAK-MX.", "Pelos testes cuidadosos, relatórios detalhados e pela ajuda no desenvolvimento do PEAK-MX.", "Für gründliche Tests, detaillierte Berichte und die Hilfe bei der Weiterentwicklung von PEAK-MX.", "Pour les tests approfondis, les rapports détaillés et l'aide au développement de PEAK-MX.", "Per i test accurati, le segnalazioni dettagliate e l'aiuto nello sviluppo di PEAK-MX.", "Za dokładne testy, szczegółowe raporty i pomoc w rozwoju PEAK-MX.", "Ayrıntılı testler, detaylı raporlar ve PEAK-MX'in gelişimine katkıları için."), Theme.LabelDim, Array.Empty()); GUILayout.EndVertical(); } private static void DrawWindowModern(int id) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) EnsureAntiCheatTabAllowed(); if ((Object)(object)_headerTex == (Object)null) { _headerTex = Theme.GradientTex(Theme.HeaderBg, Theme.HeaderDim, Mathf.RoundToInt(62f)); } if ((Object)(object)_accentTex == (Object)null) { _accentTex = Theme.Tex(Theme.Accent); } GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 62f), (Texture)(object)_headerTex); GUI.DrawTexture(new Rect(0f, 62f, ((Rect)(ref _rect)).width, 2f), (Texture)(object)_accentTex); float num = Mathf.Clamp(((Rect)(ref _rect)).width * 0.18f, 136f, 170f); float num2 = 74f; float num3 = ((Rect)(ref _rect)).height - num2 - 12f; float num4 = 12f + num + 12f; float num5 = ((Rect)(ref _rect)).width - num4 - 12f; float num6 = Mathf.Clamp(((Rect)(ref _rect)).height * 0.11f, 48f, 78f); GUILayout.BeginArea(new Rect(16f, 10f, ((Rect)(ref _rect)).width - 32f, 44f)); GUILayout.BeginHorizontal(Array.Empty()); DrawBrandMark(32f); GUILayout.Space(8f); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); GUILayout.Label("PEAK-MX", Theme.Title, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) }); GUILayout.Label("v1.1.2 | by maxkir041 | " + CurrentPageTitle(), Theme.Subtitle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(16f) }); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", Theme.CloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(34f), GUILayout.Height(26f) })) { _closeRequested = true; } GUILayout.EndHorizontal(); GUILayout.EndArea(); Rect val = default(Rect); ((Rect)(ref val))..ctor(12f, num2, num, num3); _contentRect = new Rect(num4, num2, num5, num3); GUI.Box(val, GUIContent.none, Theme.Panel9); GUI.Box(_contentRect, GUIContent.none, Theme.Card); GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 20f, ((Rect)(ref val)).height - 20f)); GUI.enabled = !AntiCheat.ClientToolsLocked; if (GUILayout.Button(Tx("★ Избранное", "★ Favorites", "★ 收藏", "★ 收藏"), _favoritesOpen ? Theme.NavItemActive : Theme.NavItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { _favoritesOpen = true; _scroll = Vector2.zero; } GUI.enabled = true; GUILayout.Space(4f); for (int i = 0; i < Tabs.Length; i++) { GUIStyle val2 = ((!_favoritesOpen && i == _tab) ? Theme.NavItemActive : Theme.NavItem); bool flag = (GUI.enabled = !AntiCheat.ClientToolsLocked || IsAntiCheatAllowedTab(i)); if (GUILayout.Button(L(Tabs[i]), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }) && flag) { if (_tab != i || _favoritesOpen) { _scroll = Vector2.zero; } _tab = i; _favoritesOpen = false; } GUI.enabled = true; } GUILayout.FlexibleSpace(); DrawInterfaceModeToggle(); GUILayout.Space(6f); GUILayout.Label("maxkir041", Theme.LabelDim, Array.Empty()); GUILayout.EndArea(); float num7 = SimpleNavigationHeight(); if (num7 > 0f) { GUILayout.BeginArea(new Rect(((Rect)(ref _contentRect)).x + 12f, ((Rect)(ref _contentRect)).y + 8f, ((Rect)(ref _contentRect)).width - 24f, num7)); DrawSimpleSectionNavigation(); GUILayout.EndArea(); } GUILayout.BeginArea(new Rect(((Rect)(ref _contentRect)).x + 12f, ((Rect)(ref _contentRect)).y + 10f + num7, ((Rect)(ref _contentRect)).width - 24f, ((Rect)(ref _contentRect)).height - 24f - num6 - num7)); _scroll = BeginVerticalScroll(_scroll); GUILayout.Space(2f); DrawCurrentModernTabSafe(); GUILayout.Space(4f); GUILayout.EndScrollView(); GUILayout.EndArea(); DrawTooltipFooter(new Rect(((Rect)(ref _contentRect)).x + 12f, ((Rect)(ref _contentRect)).yMax - num6 - 10f, ((Rect)(ref _contentRect)).width - 24f, num6)); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _rect)).width, 62f)); } private static void DrawCurrentModernTabSafe() { try { if (_favoritesOpen) { DrawFavoritesModern(); return; } switch (_tab) { case 0: DrawCharacterRedesign(); break; case 1: DrawCheatsRedesign(); break; case 2: DrawAdminModern(); break; case 3: DrawInventoryRedesign(); break; case 4: DrawWorldModern(); break; case 5: DrawBadgesModern(); break; case 6: DrawCosmeticsModern3(); break; case 7: DrawAboutModern(); break; case 8: DrawAntiCheatModern(); break; } } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[Menu:{CurrentPageTitle()}] {arg}"); } GUILayout.Label(Ru ? "Вкладка временно недоступна после обновления игры. Ошибка записана в лог BepInEx." : "This tab hit a game-update compatibility error. Details were written to the BepInEx log.", Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Ru ? "Обновить игроков/предметы" : "Refresh players/items", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RefreshPlayers(); GameApi.LoadItems(); } } } private static string CurrentPageTitle() { if (!_favoritesOpen) { return L(Tabs[Mathf.Clamp(_tab, 0, Tabs.Length - 1)]); } return Tx("Избранное", "Favorites", "收藏", "收藏"); } private static string[] SimpleSectionKeys(int tab) { if (tab < 0 || tab >= SimpleSectionKeyMap.Length) { return Array.Empty(); } return SimpleSectionKeyMap[tab]; } private static string[] SimpleSectionLabels(int tab) { if (_simpleSectionLabelMap == null || _simpleSectionLabelLanguage != Localization.Current) { _simpleSectionLabelLanguage = Localization.Current; _simpleSectionLabelMap = new string[Tabs.Length][]; _simpleSectionLabelMap[0] = new string[2] { Tx("Движение", "Movement", "移动", "移動"), Tx("Состояние", "Status", "状态", "狀態") }; _simpleSectionLabelMap[1] = new string[5] { Tx("Основное", "Core", "主要", "主要"), "ESP", Tx("Эффекты", "Effects", "效果", "效果"), Tx("Полёт", "Movement", "移动", "移動"), Tx("Приколы", "Pranks", "恶作剧", "惡作劇") }; _simpleSectionLabelMap[2] = new string[4] { Tx("Игроки", "Players", "玩家", "玩家"), Tx("Защита", "Protection", "保护", "保護"), Tx("Много игроков", "Many players", "多人大厅", "多人房間"), Tx("Журнал", "Log", "日志", "日誌") }; _simpleSectionLabelMap[3] = new string[3] { Tx("Предметы", "Items", "物品", "物品"), Tx("Рюкзак", "Backpack", "背包", "背包"), EntitySectionName() }; _simpleSectionLabelMap[4] = new string[5] { Tx("Время", "Time", "时间", "時間"), Tx("Мир", "World", "世界", "世界"), Tx("Поиск", "Finder", "查找", "搜尋"), Tx("Финиш", "Finish", "终点", "終點"), Tx("Контейнеры", "Containers", "容器", "容器") }; _simpleSectionLabelMap[5] = Array.Empty(); _simpleSectionLabelMap[6] = Array.Empty(); _simpleSectionLabelMap[7] = new string[4] { Tx("Основное", "General", "常规", "一般"), Tx("Управление", "Controls", "控制", "控制"), Tx("Ссылки", "Links", "链接", "リンク"), Tx("Поддержка", "Support", "支持", "支持") }; _simpleSectionLabelMap[8] = new string[3] { Tx("Обнаружение действий", "Action detection", "行为检测", "行為偵測"), Tx("Контроль модов", "Mod control", "模组控制", "模組控制"), Tx("События", "Events", "事件", "事件") }; } if (tab < 0 || tab >= _simpleSectionLabelMap.Length) { return Array.Empty(); } return _simpleSectionLabelMap[tab] ?? Array.Empty(); } private static float SimpleNavigationHeight() { if (AdvancedUi || _favoritesOpen) { return 0f; } string[] array = SimpleSectionLabels(_tab); if (array.Length <= 1) { return 0f; } return (float)Mathf.CeilToInt((float)array.Length / (float)Mathf.Max(1, TileColumns(104f))) * 34f + 2f; } private static void DrawSimpleSectionNavigation() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) string[] array = SimpleSectionLabels(_tab); if (array.Length > 1) { int num = Mathf.Clamp(_simpleSection[_tab], 0, array.Length - 1); _simpleSection[_tab] = num; DrawChipBar(ref _simpleSection[_tab], array); if (num != _simpleSection[_tab]) { _scroll = Vector2.zero; } } } private static bool TryGetSimpleSectionIndex(string key, out int index) { index = -1; if (AdvancedUi || string.IsNullOrWhiteSpace(key)) { return false; } string[] array = SimpleSectionKeys(_tab); for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i], key, StringComparison.Ordinal)) { index = i; return true; } } return false; } private static void DrawInterfaceModeToggle() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0213: 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_0200: Unknown result type (might be due to invalid IL or missing references) bool flag = AdvancedUi; Rect rect = GUILayoutUtility.GetRect(80f, 48f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(48f) }); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 18f), Tx("Интерфейс", "Interface", "界面", "介面"), Theme.LabelDim); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 19f, ((Rect)(ref rect)).width, 27f); if (GUI.Button(val, GUIContent.none, GUIStyle.none)) { flag = !flag; } GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, Mathf.Max(42f, ((Rect)(ref val)).width - 48f), ((Rect)(ref val)).height), flag ? Tx("Расшир.", "Advanced", "高级", "進階") : Tx("Простой", "Simple", "简洁", "簡潔"), Theme.LabelDim); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref val)).xMax - 42f, ((Rect)(ref val)).y + 2f, 40f, 22f); GUI.Box(val2, GUIContent.none, flag ? Theme.SwitchOn : Theme.SwitchOff); float num = 16f; float num2 = (flag ? (((Rect)(ref val2)).xMax - num - 3f) : (((Rect)(ref val2)).x + 3f)); if ((Object)(object)Theme.KnobTex != (Object)null) { GUI.DrawTexture(new Rect(num2, ((Rect)(ref val2)).y + 3f, num, num), (Texture)(object)Theme.KnobTex); } if (flag != AdvancedUi && ModConfig.AdvancedUi != null) { ModConfig.AdvancedUi.Value = flag; _scroll = Vector2.zero; } if (Event.current != null && ((Rect)(ref rect)).Contains(Event.current.mousePosition)) { _hoverTip = Tx("Простой режим показывает один рабочий блок. Расширенный возвращает точные слоты и все дополнительные параметры.", "Simple mode shows one task group. Advanced mode restores precise slots and every extra setting.", "简洁模式一次显示一个任务组;高级模式显示精确栏位和全部附加设置。", "簡潔模式一次顯示一個工作群組;進階模式顯示精確欄位和全部附加設定。"); } } private static void DrawFavoritesModern() { GUILayout.Label(Tx("Избранные функции", "Favorite actions", "收藏功能", "收藏功能"), Theme.Section, Array.Empty()); bool flag = QuickActions.FavoriteCount > 0; if (BeginSection("favorites.saved", Tx("Быстрый доступ", "Quick access", "快速访问", "快速存取"), defaultOpen: true)) { if (!flag) { GUILayout.Label(Tx("Пока пусто", "No favorites yet", "暂无收藏", "尚無收藏"), Theme.LabelDim, Array.Empty()); } for (int i = 1; i < QuickActions.Actions.Length; i++) { QuickActions.Definition action = QuickActions.Actions[i]; if (QuickActions.IsFavorite(action.Id)) { DrawFavoriteActionRow(action, favorite: true); } } EndSection(); } if (!BeginSection("favorites.catalog", Tx("Добавить функции", "Add actions", "添加功能", "新增功能"), !flag)) { return; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Поиск:", "Search:", "搜索:", "搜尋:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _favoriteActionSearch = GUILayout.TextField(_favoriteActionSearch ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); GUILayout.EndHorizontal(); string text = (_favoriteActionSearch ?? "").Trim(); for (int j = 1; j < QuickActions.Actions.Length; j++) { QuickActions.Definition action2 = QuickActions.Actions[j]; string text2 = (Ru ? action2.Ru : action2.En); if (text.Length <= 0 || text2.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0 || action2.Id.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { DrawFavoriteActionRow(action2, QuickActions.IsFavorite(action2.Id)); } } EndSection(); } private static void DrawFavoriteActionRow(QuickActions.Definition action, bool favorite) { string text = (Ru ? action.Ru : action.En); string tip = (Ru ? action.TipRu : action.TipEn); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(favorite ? "★" : "☆", favorite ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(32f) })) { QuickActions.SetFavorite(action.Id, !favorite); } TipLast(favorite ? Tx("Убрать из избранного", "Remove from favorites", "取消收藏", "取消收藏") : Tx("Добавить в избранное", "Add to favorites", "添加收藏", "加入收藏")); if (GUILayout.Button(text, favorite ? Theme.DonateBtn : Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { QuickActions.Execute(action.Id); } TipLast(tip); GUILayout.EndHorizontal(); } private static void DrawCharacterRedesign() { if (BeginSection("character.redesign.move", L("tab.character"), defaultOpen: true)) { DrawToggleTiles(new ToggleTileSpec(L("feat.speed"), Localization.D("feat.speed"), () => ModConfig.SpeedMod, delegate(bool v) { ModConfig.SpeedMod = v; }), new ToggleTileSpec(L("feat.jump"), Localization.D("feat.jump"), () => ModConfig.JumpMod, delegate(bool v) { ModConfig.JumpMod = v; }), new ToggleTileSpec(Tx("Бесконечные прыжки", "Infinite jumps", "无限跳跃", "無限跳躍"), Tx("Позволяет прыгать повторно в воздухе без ожидания земли.", "Allows repeated jumps in the air without touching the ground.", "允许在空中反复跳跃,不必等落地。", "允許在空中反覆跳躍,不必等落地。"), () => ModConfig.InfiniteJumps, delegate(bool v) { ModConfig.InfiniteJumps = v; }), new ToggleTileSpec(Tx("Без скольжения", "No sliding", "防滑", "防滑"), Tx("Снижает соскальзывание и считает крутые поверхности пригодными для стояния.", "Reduces sliding and treats steep surfaces as standable.", "降低滑落并把陡坡视为可站立。", "降低滑落並把陡坡視為可站立。"), () => ModConfig.NoSlipperySurfaces, delegate(bool v) { ModConfig.NoSlipperySurfaces = v; })); if (ModConfig.SpeedMod) { ModConfig.SpeedAmount = Slider("Speed x", ModConfig.SpeedAmount, 0.5f, 5f); } if (ModConfig.JumpMod) { ModConfig.JumpAmount = Slider("Jump x", ModConfig.JumpAmount, 1f, 5f); } GUILayout.Space(4f); DrawToggleTiles(new ToggleTileSpec(L("feat.climb"), Localization.D("feat.climb"), () => ModConfig.ClimbMod, delegate(bool v) { ModConfig.ClimbMod = v; }), new ToggleTileSpec(L("feat.vineclimb"), Localization.D("feat.vineclimb"), () => ModConfig.VineClimbMod, delegate(bool v) { ModConfig.VineClimbMod = v; }), new ToggleTileSpec(L("feat.ropeclimb"), Localization.D("feat.ropeclimb"), () => ModConfig.RopeClimbMod, delegate(bool v) { ModConfig.RopeClimbMod = v; })); if (ModConfig.ClimbMod) { ModConfig.ClimbAmount = Slider(Tx("Лазание x", "Climb x", "攀爬 x", "攀爬 x"), ModConfig.ClimbAmount, 1f, 5f); } if (ModConfig.VineClimbMod) { ModConfig.VineClimbAmount = Slider(Tx("Лианы x", "Vines x", "藤蔓 x", "藤蔓 x"), ModConfig.VineClimbAmount, 1f, 5f); } if (ModConfig.RopeClimbMod) { ModConfig.RopeClimbAmount = Slider(Tx("Веревки x", "Ropes x", "绳索 x", "繩索 x"), ModConfig.RopeClimbAmount, 1f, 5f); } ModConfig.ClimbStaminaConsumptionPercent = Slider(Tx("Расход стамины при лазании %", "Climbing stamina cost %", "攀爬耐力消耗 %", "攀爬耐力消耗 %"), ModConfig.ClimbStaminaConsumptionPercent, 0f, 300f); EndSection(); } if (BeginSection("character.redesign.status", Tx("Стамина и недуги", "Stamina & afflictions", "耐力与异常", "耐力與異常"), defaultOpen: true)) { Character target = TargetPicker(ref _statusTarget); DrawActionTiles(new ActionTileSpec(Tx("Полная стамина", "Full stamina", "补满耐力", "補滿耐力"), Tx("Заполняет обычную стамину выбранной цели.", "Fills the selected target's regular stamina.", "填满所选目标普通耐力。", "填滿所選目標普通耐力。"), delegate { GameApi.FullStamina(target); }), new ActionTileSpec(Tx("Полная экстра", "Full extra", "补满额外耐力", "補滿額外耐力"), Tx("Заполняет дополнительную стамину выбранной цели.", "Fills the selected target's extra stamina.", "填满所选目标额外耐力。", "填滿所選目標額外耐力。"), delegate { ModConfig.ExtraStaminaPercent = 100f; SetNumberText(Tx("Экстра стамина %", "Extra stamina %", "额外耐力 %", "額外耐力 %"), 0f, 100f, ModConfig.ExtraStaminaPercent); GameApi.FullExtraStamina(target); }), new ActionTileSpec(Tx("Снять недуги", "Clear afflictions", "清除异常", "清除異常"), Tx("Очищает все недуги выбранной цели.", "Clears every affliction from the selected target.", "清除所选目标所有异常。", "清除所選目標所有異常。"), delegate { GameApi.ClearAllStatus(target); })); ModConfig.ExtraStaminaPercent = NumberField(Tx("Экстра стамина %", "Extra stamina %", "额外耐力 %", "額外耐力 %"), ModConfig.ExtraStaminaPercent, 0f, 100f); if (GUILayout.Button(Tx("Выдать экстрастамину", "Set extra stamina", "设置额外耐力", "設定額外耐力"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.SetExtraStamina(target, ModConfig.ExtraStaminaPercent / 100f); } ModConfig.StaminaConsumptionPercent = Slider(Tx("Расход стамины %", "Stamina cost %", "耐力消耗 %", "耐力消耗 %"), ModConfig.StaminaConsumptionPercent, 0f, 300f); ModConfig.StaminaRegenPercent = Slider(Tx("Восстановление %", "Stamina regen %", "耐力恢复 %", "耐力恢復 %"), ModConfig.StaminaRegenPercent, 0f, 300f); DrawToggleTiles(new ToggleTileSpec(Tx("Своя задержка восстановления", "Custom regen delay", "自定义恢复延迟", "自訂恢復延遲"), Tx("Заменяет задержку перед восстановлением стамины.", "Overrides the delay before stamina starts regenerating.", "覆盖耐力恢复前的延迟。", "覆蓋耐力恢復前的延遲。"), () => ModConfig.StaminaRegenDelayMod, delegate(bool v) { ModConfig.StaminaRegenDelayMod = v; })); if (ModConfig.StaminaRegenDelayMod) { ModConfig.StaminaRegenDelay = Slider(Tx("Задержка", "Delay", "延迟", "延遲"), ModConfig.StaminaRegenDelay, 0f, 5f); } GUILayout.Space(8f); GUILayout.Label(Tx("Работа с недугами", "Afflictions", "异常状态", "異常狀態"), Theme.Section, Array.Empty()); _statusCustomDeltaPercent = Slider(Tx("Своё число (-100…+100)", "Custom change (-100…+100)", "自定义变化 (-100…+100)", "自訂變化 (-100…+100)"), _statusCustomDeltaPercent, -100f, 100f); DrawAfflictionTable(target); EndSection(); } } private static void DrawAfflictionTable(Character target) { //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) string[] array = (Ru ? GameApi.StatusRu : GameApi.StatusEn); int num = Mathf.Min(array.Length, 15); bool flag = ((((Rect)(ref _contentRect)).width > 0f) ? ((Rect)(ref _contentRect)).width : 620f) < 610f; for (int i = 0; i < num; i++) { int idx = i; Color contentColor = GUI.contentColor; GUI.contentColor = StatusUiColor(i); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(array[i], Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(flag ? 92f : 126f), GUILayout.Height(28f) }); if (GUILayout.Button("+25", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(flag ? 44f : 52f), GUILayout.Height(28f) })) { GameApi.AdjustStatus(target, idx, 0.25f); } if (GUILayout.Button("+50", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(flag ? 44f : 52f), GUILayout.Height(28f) })) { GameApi.AdjustStatus(target, idx, 0.5f); } if (GUILayout.Button("-25", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(flag ? 44f : 52f), GUILayout.Height(28f) })) { GameApi.AdjustStatus(target, idx, -0.25f); } if (GUILayout.Button("-50", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(flag ? 44f : 52f), GUILayout.Height(28f) })) { GameApi.AdjustStatus(target, idx, -0.5f); } if (!flag) { if (GUILayout.Button(Tx("Убрать", "Clear", "清除", "清除"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(68f), GUILayout.Height(28f) })) { GameApi.SetStatus(target, idx, 0f); } if (GUILayout.Button(Tx("Своё", "Custom", "自定义", "自訂"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(28f) })) { GameApi.AdjustStatus(target, idx, _statusCustomDeltaPercent / 100f); } } GUILayout.EndHorizontal(); if (flag) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(92f); if (GUILayout.Button(Tx("Убрать", "Clear", "清除", "清除"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(26f) })) { GameApi.SetStatus(target, idx, 0f); } if (GUILayout.Button(Tx("Своё", "Custom", "自定义", "自訂"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(26f) })) { GameApi.AdjustStatus(target, idx, _statusCustomDeltaPercent / 100f); } GUILayout.EndHorizontal(); } GUI.contentColor = contentColor; GUILayout.Space(3f); } } private static Color StatusUiColor(int index) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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_0086: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) return (Color)(index switch { 0 => new Color(1f, 0.37f, 0.4f), 1 => new Color(1f, 0.72f, 0.1f), 2 => new Color(0.24f, 0.8f, 1f), 3 => new Color(0.78f, 0.52f, 1f), 4 => new Color(1f, 0.55f, 0.66f), 5 => new Color(0.78f, 0.78f, 0.82f), 6 => new Color(0.92f, 0.66f, 1f), 7 => new Color(0.78f, 0.82f, 0.88f), 8 => new Color(1f, 0.48f, 0.2f), 9 => new Color(0.35f, 0.82f, 0.45f), 10 => new Color(0.9f, 0.58f, 0.66f), 11 => new Color(0.86f, 0.9f, 0.94f), 12 => new Color(1f, 0.62f, 0.24f), 13 => new Color(0.55f, 0.66f, 0.82f), _ => new Color(0.2f, 0.82f, 0.42f), }); } private static void DrawCheatsRedesign() { //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("cheats.redesign.core", L("tab.cheats"), defaultOpen: true)) { DrawToggleTiles(new ToggleTileSpec(L("feat.god"), Localization.D("feat.god"), () => ModConfig.GodMode, delegate(bool v) { ModConfig.GodMode = v; }), new ToggleTileSpec(L("feat.infstam"), Localization.D("feat.infstam"), () => ModConfig.InfiniteStamina, delegate(bool v) { ModConfig.InfiniteStamina = v; }), new ToggleTileSpec(L("feat.nofall"), Localization.D("feat.nofall"), () => ModConfig.NoFallDamage, delegate(bool v) { ModConfig.NoFallDamage = v; }), new ToggleTileSpec(Tx("Без ragdoll", "No ragdoll", "禁用布娃娃", "停用布娃娃"), Tx("Блокирует принудительный ragdoll от падения и соскальзывания.", "Blocks forced ragdoll from falling and sliding.", "阻止坠落和滑落触发布娃娃。", "阻止墜落和滑落觸發布娃娃。"), () => ModConfig.NoFallingRagdoll, delegate(bool v) { ModConfig.NoFallingRagdoll = v; }), new ToggleTileSpec(L("feat.noweight"), Localization.D("feat.noweight"), () => ModConfig.NoWeight, delegate(bool v) { ModConfig.NoWeight = v; }), new ToggleTileSpec(L("feat.lockstatus"), Localization.D("feat.lockstatus"), () => ModConfig.LockStatus, delegate(bool v) { ModConfig.LockStatus = v; }), new ToggleTileSpec(Tx("Слышно всех", "Hear everyone", "听见所有人", "聽見所有人"), Tx("Локально делает голоса всех игроков слышимыми на карте без 2D-эха.", "Locally makes every player's voice audible across the map without 2D echo.", "本地让所有玩家全图可听且没有 2D 回声。", "本地讓所有玩家全圖可聽且沒有 2D 回聲。"), () => ModConfig.GlobalVoice, delegate(bool v) { ModConfig.GlobalVoice = v; })); DrawActionTiles(new ActionTileSpec(Tx("Слышно всем", "Enable for everyone", "为所有人启用", "為所有人啟用"), Tx("Отправляет команду всем клиентам с PEAK-MX.", "Sends the hear-all command to every PEAK-MX client.", "向所有 PEAK-MX 客户端发送全图语音命令。", "向所有 PEAK-MX 客戶端發送全圖語音命令。"), delegate { VoiceControl.BroadcastHearAll(enabled: true); }), new ActionTileSpec(Tx("Отключить всем", "Disable for everyone", "为所有人关闭", "為所有人關閉"), Tx("Снимает сетевой режим слышимости у клиентов с PEAK-MX.", "Turns off network hear-all on PEAK-MX clients.", "关闭 PEAK-MX 客户端的全图语音。", "關閉 PEAK-MX 客戶端的全圖語音。"), delegate { VoiceControl.BroadcastHearAll(enabled: false); })); EndSection(); } if (BeginSection("cheats.redesign.esp", Tx("ESP и поиск", "ESP & search", "ESP 与搜索", "ESP 與搜尋"), defaultOpen: false)) { DrawToggleTiles(new ToggleTileSpec(Tx("ESP игроков", "Player ESP", "玩家 ESP", "玩家 ESP"), Tx("Показывает игроков через стены экранными метками с расстоянием.", "Shows players through walls with labels and distance.", "用带距离的屏幕标记显示墙后的玩家。", "用帶距離的畫面標記顯示牆後的玩家。"), () => ModConfig.PlayerEsp, delegate(bool v) { ModConfig.PlayerEsp = v; }), new ToggleTileSpec(Tx("ESP предметов", "Item ESP", "物品 ESP", "物品 ESP"), Tx("Показывает выбранные предметы через стены.", "Shows selected items through walls.", "透视显示所选物品。", "透視顯示所選物品。"), () => ModConfig.ItemEsp, delegate(bool v) { ModConfig.ItemEsp = v; }), new ToggleTileSpec(Tx("ESP объектов", "Object ESP", "对象 ESP", "物件 ESP"), Tx("Показывает опасности, костры, предметы на спину и амулеты.", "Shows hazards, campfires, back-slot items and amulets.", "显示危险、营火、背部物品和护符。", "顯示危險、營火、背部物品和護符。"), () => ModConfig.WorldEsp != null && ModConfig.WorldEsp.Value, delegate(bool v) { if (ModConfig.WorldEsp != null) { ModConfig.WorldEsp.Value = v; } })); if (ModConfig.PlayerEsp) { ModConfig.PlayerEspDistance = Slider(Tx("Дистанция игроков", "Player distance", "玩家距离", "玩家距離"), ModConfig.PlayerEspDistance, 25f, 2500f); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.PlayerEspBoxes = ToggleCompact(Tx("Рамки", "Boxes", "方框", "方框"), ModConfig.PlayerEspBoxes); ModConfig.PlayerEspLines = ToggleCompact(Tx("Линии", "Lines", "连线", "連線"), ModConfig.PlayerEspLines); GUILayout.EndHorizontal(); } if (ModConfig.ItemEsp) { ModConfig.ItemEspDistance = Slider(Tx("Дистанция предметов", "Item distance", "物品距离", "物品距離"), ModConfig.ItemEspDistance, 25f, 2000f); ModConfig.ItemEspLines = ToggleCompact(Tx("Линии к предметам", "Item lines", "物品连线", "物品連線"), ModConfig.ItemEspLines); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Все предметы", "All items", "全部物品", "全部物品"), (ModConfig.ItemEspSelectedIndex < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(30f) })) { ModConfig.ItemEspSelectedIndex = -1; } GUILayout.Label(Tx("Поиск:", "Search:", "搜索:", "搜尋:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _itemEspSearch = GUILayout.TextField(_itemEspSearch ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); ModConfig.ItemEspSearch = _itemEspSearch; GUILayout.EndHorizontal(); DrawItemCategoryBar(ref _itemEspCategory); GameApi.EnsureItemsLoaded(); _itemEspScroll = BeginVerticalScroll(_itemEspScroll, GUILayout.Height(176f)); DrawItemTileGrid(_itemEspSearch, _itemEspCategory, ModConfig.ItemEspSelectedIndex, delegate(int i) { ModConfig.ItemEspSelectedIndex = i; }); GUILayout.EndScrollView(); } if (ModConfig.WorldEsp != null && ModConfig.WorldEsp.Value) { ModConfig.WorldEspDistance.Value = Slider(Tx("Дистанция объектов", "Object distance", "对象距离", "物件距離"), ModConfig.WorldEspDistance.Value, 25f, 2500f); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.WorldEspLines.Value = ToggleCompact(Tx("Линии", "Lines", "连线", "連線"), ModConfig.WorldEspLines.Value); ModConfig.WorldEspDangers.Value = ToggleCompact(Tx("Опасности", "Hazards", "危险", "危險"), ModConfig.WorldEspDangers.Value); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.WorldEspCampfires.Value = ToggleCompact(Tx("Костры", "Campfires", "营火", "營火"), ModConfig.WorldEspCampfires.Value); ModConfig.WorldEspBackItems.Value = ToggleCompact(Tx("Рюкзаки/джеты", "Back items", "背部物品", "背部物品"), ModConfig.WorldEspBackItems.Value); ModConfig.WorldEspAmulets.Value = ToggleCompact(Tx("Амулеты", "Amulets", "护符", "護符"), ModConfig.WorldEspAmulets.Value); GUILayout.EndHorizontal(); } EndSection(); } if (BeginSection("cheats.redesign.status", Tx("Защита от эффектов", "Status protection", "状态保护", "狀態保護"), defaultOpen: false)) { DrawToggleTiles(new ToggleTileSpec(Tx("Без всех эффектов", "No status effects", "无状态效果", "無狀態效果"), Tx("Постоянно очищает все недуги локального персонажа.", "Continuously clears every affliction from the local character.", "持续清除本地角色所有负面状态。", "持續清除本地角色所有負面狀態。"), () => ModConfig.NoStatusEffects, delegate(bool v) { ModConfig.NoStatusEffects = v; })); if (!ModConfig.NoStatusEffects) { DrawToggleTiles(new ToggleTileSpec(Tx("Без травм", "No injury", "无受伤", "無受傷"), "", () => ModConfig.NoInjury, delegate(bool v) { ModConfig.NoInjury = v; }), new ToggleTileSpec(Tx("Без голода", "No hunger", "无饥饿", "無飢餓"), "", () => ModConfig.NoHunger, delegate(bool v) { ModConfig.NoHunger = v; }), new ToggleTileSpec(Tx("Без холода", "No cold", "无寒冷", "無寒冷"), "", () => ModConfig.NoCold, delegate(bool v) { ModConfig.NoCold = v; }), new ToggleTileSpec(Tx("Без яда", "No poison", "无中毒", "無中毒"), "", () => ModConfig.NoPoison, delegate(bool v) { ModConfig.NoPoison = v; }), new ToggleTileSpec(Tx("Без проклятия", "No curse", "无诅咒", "無詛咒"), "", () => ModConfig.NoCurse, delegate(bool v) { ModConfig.NoCurse = v; }), new ToggleTileSpec(Tx("Без сонливости", "No drowsy", "无困倦", "無睏倦"), "", () => ModConfig.NoDrowsy, delegate(bool v) { ModConfig.NoDrowsy = v; }), new ToggleTileSpec(Tx("Без жары", "No hot", "无炎热", "無炎熱"), "", () => ModConfig.NoHot, delegate(bool v) { ModConfig.NoHot = v; }), new ToggleTileSpec(Tx("Без краба", "No crab", "无螃蟹", "無螃蟹"), "", () => ModConfig.NoCrab, delegate(bool v) { ModConfig.NoCrab = v; }), new ToggleTileSpec(Tx("Без шипов", "No thorns", "无刺", "無刺"), "", () => ModConfig.NoThorns, delegate(bool v) { ModConfig.NoThorns = v; }), new ToggleTileSpec(Tx("Без спор", "No spores", "无孢子", "無孢子"), "", () => ModConfig.NoSpores, delegate(bool v) { ModConfig.NoSpores = v; }), new ToggleTileSpec(Tx("Без паутины", "No web", "无蛛网", "無蛛網"), "", () => ModConfig.NoWeb, delegate(bool v) { ModConfig.NoWeb = v; }), new ToggleTileSpec(Tx("Без стрел", "No arrows", "无箭矢", "無箭矢"), "", () => ModConfig.NoArrows, delegate(bool v) { ModConfig.NoArrows = v; }), new ToggleTileSpec(Tx("Без окаменения", "No petrify", "无石化", "無石化"), "", () => ModConfig.NoPetrify, delegate(bool v) { ModConfig.NoPetrify = v; }), new ToggleTileSpec(Tx("Без мухоловки", "No flytrap", "无捕蝇草", "無捕蠅草"), "", () => ModConfig.NoFlyTrap, delegate(bool v) { ModConfig.NoFlyTrap = v; })); } EndSection(); } if (BeginSection("cheats.redesign.move", Tx("Полёт и телепорт", "Fly & teleport", "飞行与传送", "飛行與傳送"), defaultOpen: false)) { DrawToggleTiles(new ToggleTileSpec(L("feat.tpping"), Localization.D("feat.tpping"), () => ModConfig.TeleportToPing, delegate(bool v) { ModConfig.TeleportToPing = v; }), new ToggleTileSpec(Tx("Дальнее взаимодействие", "Long interaction", "远距离交互", "遠距離互動"), Tx("Увеличивает дистанцию взаимодействия с предметами и объектами.", "Increases interaction distance for items and objects.", "增加与物品和对象交互的距离。", "增加與物品和物件互動的距離。"), () => ModConfig.LongInteraction, delegate(bool v) { ModConfig.LongInteraction = v; }), new ToggleTileSpec(Tx("Кино-камера", "Cinematic camera", "电影镜头", "電影鏡頭"), Tx("Свободная камера для съемки и обзора.", "Free camera for filming and scouting.", "用于拍摄和观察的自由镜头。", "用於拍攝和觀察的自由鏡頭。"), () => ModConfig.CinematicCamera, delegate(bool v) { ModConfig.CinematicCamera = v; }), new ToggleTileSpec(L("feat.fly"), Localization.D("feat.fly"), () => ModConfig.Fly, delegate(bool v) { ModConfig.Fly = v; })); if (ModConfig.LongInteraction) { ModConfig.InteractionDistance = Slider(Tx("Дистанция", "Distance", "距离", "距離"), ModConfig.InteractionDistance, 2f, 80f); } if (ModConfig.CinematicCamera) { ModConfig.CinematicCameraSpeed = Slider(Tx("Скорость камеры", "Camera speed", "镜头速度", "鏡頭速度"), ModConfig.CinematicCameraSpeed, 0.5f, 40f); ModConfig.CinematicCameraFov = Slider("FOV", ModConfig.CinematicCameraFov, 1f, 120f); } if (ModConfig.Fly) { DrawToggleTiles(new ToggleTileSpec(Tx("Ноклип", "Noclip", "穿墙", "穿牆"), Tx("Во время полёта отключает столкновения локального персонажа.", "Disables local character collisions while flying.", "飞行时关闭本地角色碰撞。", "飛行時關閉本地角色碰撞。"), () => ModConfig.Noclip, delegate(bool v) { ModConfig.Noclip = v; })); ModConfig.FlySpeed = Slider(Tx("Скорость", "Speed", "速度", "速度"), ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Tx("Ускорение", "Accel", "加速度", "加速度"), ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Коорд.:", "Coords:", "坐标:", "座標:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(30f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(30f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(30f) }); if (GUILayout.Button(Tx("ТП", "TP", "传送", "傳送"), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(30f) }) && (float.TryParse(_tpX, out var result) & float.TryParse(_tpY, out var result2) & float.TryParse(_tpZ, out var result3))) { GameApi.TeleportToCoords(result, result2, result3); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.redesign.pranks", Tx("Приколы", "Pranks", "恶作剧", "惡作劇"), defaultOpen: false)) { Character target = TargetPicker(ref _prankTarget); DrawActionTiles(new ActionTileSpec(Tx("Наслать недуги", "Pile afflictions", "施加异常", "施加異常"), Tx("Накладывает набор неприятных эффектов на выбранную цель.", "Adds several nasty effects to the selected target.", "给目标施加多个异常。", "給目標施加多個異常。"), delegate { GameApi.PrankAfflict(target); }), new ActionTileSpec(Tx("Вылечить", "Cure", "治愈", "治癒"), Tx("Очищает все недуги выбранной цели.", "Clears all afflictions from the selected target.", "清除目标所有异常。", "清除目標所有異常。"), delegate { GameApi.ClearAllStatus(target); }), new ActionTileSpec(Tx("Пнуть", "Push", "推开", "推開"), Tx("Толкает выбранную цель от тебя.", "Pushes the selected target away from you.", "把目标从你身边推开。", "把目標從你身邊推開。"), delegate { GameApi.PushPlayer(target); }), new ActionTileSpec(Tx("Взорвать", "Explode", "爆炸", "爆炸"), Tx("Создает взрыв прямо в выбранной цели.", "Creates an explosion directly inside the selected target.", "在目标身上制造爆炸。", "在目標身上製造爆炸。"), delegate { GameApi.ExplodePlayer(target); }, 2), new ActionTileSpec(Tx("Окаменить", "Petrify", "石化", "石化"), Tx("Выставляет окаменение выбранной цели на 100%.", "Sets the target's petrify amount to 100%.", "把目标石化值设为 100%。", "把目標石化值設為 100%。"), delegate { GameApi.PetrifyPlayer(target); }), new ActionTileSpec(Tx("Снять камень", "Clear petrify", "解除石化", "解除石化"), Tx("Сбрасывает окаменение выбранной цели.", "Clears petrify from the selected target.", "清除目标石化。", "清除目標石化。"), delegate { GameApi.ClearPetrify(target); }), new ActionTileSpec(Tx("Стрела", "Arrow", "箭矢", "箭矢"), Tx("Добавляет стрелу на своего персонажа; для чужого игрока нужен его клиент.", "Adds an arrow to your own character; remote targets need their client.", "给自己角色添加箭矢;远程目标需要对方客户端。", "給自己角色新增箭矢;遠端目標需要對方客戶端。"), delegate { GameApi.AddArrowPrank(target); }), new ActionTileSpec(Tx("5 стрел", "5 arrows", "5 支箭", "5 支箭"), Tx("Добавляет несколько стрел.", "Adds several arrows.", "添加多支箭。", "新增多支箭。"), delegate { GameApi.AddArrowPrank(target, 5); }), new ActionTileSpec(Tx("Поножовщина", "Knife Fight", "匕首混战", "匕首混戰"), Tx("Через 5 секунд выдаёт каждому игроку ритуальный кинжал в третий слот.", "After 5 seconds, gives every player a ritual dagger in slot three.", "5 秒后给每位玩家的第三栏发放仪式匕首。", "5 秒後給每位玩家的第三欄發放儀式匕首。"), delegate { GameApi.ScheduleKnifeFight(); }, 2)); _petrifyAmount = Slider(Tx("Окаменение %", "Petrify %", "石化 %", "石化 %"), _petrifyAmount, 0f, 100f); DrawActionTiles(new ActionTileSpec(Tx("Поставить %", "Set %", "设置 %", "設定 %"), Tx("Выставляет окаменение на выбранное значение.", "Sets petrify to the selected value.", "把石化设为所选数值。", "把石化設為所選數值。"), delegate { GameApi.SetPetrifyAmount(target, Mathf.RoundToInt(_petrifyAmount)); }), new ActionTileSpec(Tx("Мини-взрыв", "Mini explosion", "小爆炸", "小爆炸"), Tx("Создает слабый взрыв в цели.", "Creates a weaker explosion inside the target.", "在目标身上制造较弱爆炸。", "在目標身上製造較弱爆炸。"), delegate { GameApi.ExplodePlayer(target, 14f, 4f); }), new ActionTileSpec(Tx("Легкий пинок", "Light push", "轻推", "輕推"), Tx("Слабый толчок.", "A softer push.", "较弱推力。", "較弱推力。"), delegate { GameApi.PushPlayer(target, 7f); })); DrawActionTiles(new ActionTileSpec(Tx("Забить выбранным", "Stuff selected", "塞满所选", "塞滿所選"), Tx("Заполняет слоты целью выбранным предметом из вкладки Инвентарь.", "Fills target slots with the Inventory-selected item.", "用物品栏所选物品填满目标栏位。", "用物品欄所選物品填滿目標欄位。"), delegate { GameApi.FillInventoryWith(target, _selItem); }, 1), new ActionTileSpec(Tx("Забить золотом", "Fill gold", "塞满黄金", "塞滿黃金"), Tx("Заполняет слоты золотом.", "Fills slots with gold.", "用黄金填满栏位。", "用黃金填滿欄位。"), delegate { GameApi.FillInventoryWithGold(target); }), new ActionTileSpec(Tx("Забить паутиной", "Fill webs", "塞满蛛网", "塞滿蛛網"), Tx("Заполняет/накладывает паутину.", "Fills or applies web.", "填充或施加蛛网。", "填充或施加蛛網。"), delegate { GameApi.FillInventoryWithWebs(target); }), new ActionTileSpec(Tx("Случайные", "Random items", "随机物品", "隨機物品"), Tx("Заполняет слоты случайными предметами.", "Fills slots with random items.", "用随机物品填满栏位。", "用隨機物品填滿欄位。"), delegate { GameApi.FillInventoryWithRandom(target); }), new ActionTileSpec(Tx("Очистить", "Clear inventory", "清空", "清空"), Tx("Очищает инвентарь цели.", "Clears the target inventory.", "清空目标物品栏。", "清空目標物品欄。"), delegate { GameApi.ClearInventory(target); }), new ActionTileSpec(Tx("Высыпать", "Drop items", "丢出物品", "丟出物品"), Tx("Выбрасывает предметы рядом с целью.", "Drops items near the target.", "把物品丢到目标附近。", "把物品丟到目標附近。"), delegate { GameApi.DropAllInventory(target); })); EndSection(); } } private static string SmartSpawnResultText(string result) { if (string.IsNullOrWhiteSpace(result)) { return ""; } if (result.StartsWith("slot:", StringComparison.Ordinal)) { return Tx("Добавлено в основной слот ", "Added to inventory slot ", "已放入主栏位 ", "已放入主欄位 ") + result.Substring(5); } if (result.StartsWith("backpack:", StringComparison.Ordinal)) { return Tx("Добавлено в рюкзак, слот ", "Added to backpack slot ", "已放入背包栏位 ", "已放入背包欄位 ") + result.Substring(9); } return result switch { "back" => Tx("Надето на спину", "Equipped on back", "已装备到背部", "已裝備到背部"), "temp" => Tx("Передано в руки/временный слот", "Placed in hand/temporary slot", "已放入手中/临时栏位", "已放入手中/暫時欄位"), "hand_or_ground" => Tx("Передано в руки или создано рядом", "Put in hand or spawned nearby", "已放入手中或生成在附近", "已放入手中或生成在附近"), "ground" => Tx("Создано рядом с игроком", "Spawned near the player", "已生成在玩家附近", "已生成在玩家附近"), _ => Tx("Не удалось выдать предмет", "Could not give the item", "无法给予物品", "無法給予物品"), }; } private static void DrawInventoryRedesign() { //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("inventory.redesign.spawn", Tx("Инвентарь и предметы", "Inventory & items", "物品栏与物品", "物品欄與物品"), defaultOpen: true)) { GameApi.EnsureItemsLoaded(); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character invChar = InventoryTargetPicker(); int num = (((Object)(object)invChar != (Object)null) ? GameApi.SlotCountFor(invChar) : GameApi.SlotCount()); if (num <= 0) { num = 3; } if (_selSlot >= num) { _selSlot = Mathf.Max(0, num - 1); } GUILayout.BeginHorizontal(Array.Empty()); if (AdvancedUi) { GUILayout.Label(Tx("Слот:", "Slot:", "栏位:", "欄位:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int i = 0; i < num; i++) { if (GUILayout.Button((i + 1).ToString(), (_selSlot == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = i; } } GUILayout.FlexibleSpace(); } GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Tx("Обновить", "Reload", "刷新", "重新整理"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(94f), GUILayout.Height(30f) })) { GameApi.LoadItems(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Поиск:", "Search:", "搜索:", "搜尋:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); GUILayout.EndHorizontal(); DrawItemCategoryBar(ref _itemCategory); DrawItemFavoriteControls(); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(260f)); DrawItemTileGrid(_itemSearch, _itemCategory, _selItem, delegate(int selItem) { _selItem = selItem; }); GUILayout.EndScrollView(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } GUILayout.Label((Ru ? "На спине: " : "Back slot: ") + GameApi.DescribeBackSlot(invChar) + " | " + (Ru ? "Амулет/временный: " : "Amulet/temp: ") + GameApi.DescribeTempSlot(invChar), Theme.LabelDim, Array.Empty()); DrawActionTiles(new ActionTileSpec(Tx("Выдать предмет", "Give item", "给予物品", "給予物品"), Tx("Автоматически выбирает свободное место; при заполненном инвентаре передает предмет в руки или кладет рядом.", "Automatically chooses free space; when inventory is full, puts the item in hand or nearby.", "自动选择空位;物品栏已满时放到手中或附近。", "自動選擇空位;物品欄已滿時放到手中或附近。"), delegate { if (_selItem >= 0) { _smartSpawnResult = GameApi.SmartSpawnItem(invChar, _selItem); } }, 1)); if (!string.IsNullOrWhiteSpace(_smartSpawnResult)) { GUILayout.Label(SmartSpawnResultText(_smartSpawnResult), Theme.LabelDim, Array.Empty()); } if (AdvancedUi) { DrawActionTiles(new ActionTileSpec(Tx("В слот", "To slot", "放入栏位", "放入欄位"), Tx("Кладет выбранный предмет в выбранный основной слот.", "Puts the selected item into the selected main slot.", "把所选物品放入所选主栏位。", "把所選物品放入所選主欄位。"), delegate { if (_selItem >= 0) { GameApi.SpawnToSlotFor(invChar, _selItem, _selSlot); } }), new ActionTileSpec(Tx("Очистить слот", "Clear slot", "清空栏位", "清空欄位"), Tx("Очищает выбранный основной слот.", "Clears the selected main slot.", "清空所选主栏位。", "清空所選主欄位。"), delegate { GameApi.ClearSlotFor(invChar, _selSlot); }), new ActionTileSpec(Tx("Во все слоты", "Spawn to all", "填满全部", "填滿全部"), Tx("Кладет выбранный предмет во все основные слоты и рюкзак.", "Puts the selected item into every main slot and backpack.", "把所选物品放入全部主栏位和背包。", "把所選物品放入全部主欄位和背包。"), delegate { if (_selItem >= 0) { GameApi.FillInventoryWith(invChar, _selItem); } }), new ActionTileSpec(Tx("Очистить всё", "Clear all", "全部清空", "全部清空"), Tx("Очищает основные слоты и рюкзак цели.", "Clears main slots and backpack.", "清空主栏位和背包。", "清空主欄位和背包。"), delegate { GameApi.ClearInventory(invChar); }, 2), new ActionTileSpec(Tx("На спину", "Equip back", "装备背部", "裝備背部"), Tx("Надевает выбранный предмет на спину.", "Equips the selected item to the back slot.", "把所选物品装备到背部栏位。", "把所選物品裝備到背部欄位。"), delegate { if (_selItem >= 0) { GameApi.SpawnToBackSlotFor(invChar, _selItem); } }), new ActionTileSpec(Tx("В амулет", "To amulet", "放入护符", "放入護符"), Tx("Кладет выбранный предмет во временный слот 250.", "Puts the selected item into temporary slot 250.", "把所选物品放入临时栏位 250。", "把所選物品放入暫時欄位 250。"), delegate { if (_selItem >= 0) { GameApi.SpawnToTempSlotFor(invChar, _selItem); } })); DrawActionTiles(new ActionTileSpec(Tx("Еда", "Food", "食物", "食物"), Tx("Заполнить несколько слотов случайной едой.", "Fill several slots with random food.", "用随机食物填充多个栏位。", "用隨機食物填充多個欄位。"), delegate { GameApi.SpawnItemSet(invChar, "food"); }), new ActionTileSpec(Tx("Спасение", "Rescue", "救援", "救援"), Tx("Выдать веревку, лечение и источник света.", "Give rope, healing and a light source.", "给予绳索、治疗和光源。", "給予繩索、治療和光源。"), delegate { GameApi.SpawnItemSet(invChar, "rescue"); }), new ActionTileSpec(Tx("Свет", "Light", "照明", "照明"), Tx("Выдать фонарь/факел/топливо.", "Give lantern/torch/fuel.", "给予灯笼/火把/燃料。", "給予燈籠/火把/燃料。"), delegate { GameApi.SpawnItemSet(invChar, "light"); }), new ActionTileSpec(Tx("Мобильность", "Mobility", "机动", "機動"), Tx("Выдать предметы перемещения и слот на спине.", "Give movement tools and a back item.", "给予移动工具和背部物品。", "給予移動工具和背部物品。"), delegate { GameApi.SpawnItemSet(invChar, "mobility"); })); } EndSection(); } if (BeginSection("inventory.redesign.backpack", Tx("Рюкзак и заряд", "Backpack & charge", "背包与充能", "背包與充能"), defaultOpen: false)) { Character invChar2 = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); int num2 = GameApi.BackpackSlotCount(invChar2); if (num2 > 0) { if (AdvancedUi) { if (_selBackpackSlot >= num2) { _selBackpackSlot = Mathf.Max(0, num2 - 1); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Рюкзак:", "Backpack:", "背包:", "背包:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); for (int num3 = 0; num3 < num2; num3++) { if (GUILayout.Button((num3 + 1).ToString(), (_selBackpackSlot == num3) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selBackpackSlot = num3; } } GUILayout.EndHorizontal(); for (int num4 = 0; num4 < num2; num4++) { GUILayout.Label($"B{num4 + 1}. {GameApi.DescribeBackpackSlot(invChar2, num4)}", Theme.LabelDim, Array.Empty()); } } else { GUILayout.Label(Tx("Ячеек рюкзака: ", "Backpack slots: ", "背包栏位: ", "背包欄位: ") + num2, Theme.LabelDim, Array.Empty()); } } else { GUILayout.Label(Tx("Рюкзак не надет или еще не синхронизирован.", "No backpack equipped or not synced yet.", "未装备背包或尚未同步。", "未裝備背包或尚未同步。"), Theme.LabelDim, Array.Empty()); } DrawToggleTiles(new ToggleTileSpec(Tx("Бесконечные использования", "Unlimited uses", "无限使用", "無限使用"), Tx("Не дает предметам тратить количество использований.", "Prevents items from spending uses.", "阻止物品消耗使用次数。", "阻止物品消耗使用次數。"), () => ModConfig.UnlimitedItemUses, delegate(bool v) { ModConfig.UnlimitedItemUses = v; }), new ToggleTileSpec(Tx("Автоперезарядка", "Auto recharge", "自动充能", "自動充能"), Tx("Периодически выставляет заряд предметов.", "Periodically restores item charge.", "定期恢复物品充能。", "定期恢復物品充能。"), () => ModConfig.InfiniteItems, delegate(bool v) { ModConfig.InfiniteItems = v; }), new ToggleTileSpec(Tx("Топливо фонаря", "Lantern fuel", "灯笼燃料", "燈籠燃料"), Tx("Фонари не расходуют топливо и держатся заполненными.", "Lanterns do not spend fuel and stay filled.", "灯笼不消耗燃料并保持满。", "燈籠不消耗燃料並保持滿。"), () => ModConfig.UnlimitedLanternFuel, delegate(bool v) { ModConfig.UnlimitedLanternFuel = v; })); if (!ModConfig.UnlimitedLanternFuel) { ModConfig.LanternFuelConsumptionPercent = Slider(Tx("Расход топлива фонаря %", "Lantern fuel cost %", "灯笼燃料消耗 %", "燈籠燃料消耗 %"), ModConfig.LanternFuelConsumptionPercent, 0f, 300f); } ModConfig.RechargeValue = NumberField(Tx("Заряд", "Charge", "充能", "充能"), ModConfig.RechargeValue, 0f, 999f); if (AdvancedUi) { DrawActionTiles(new ActionTileSpec(Tx("Зарядить слот", "Recharge slot", "充能栏位", "充能欄位"), Tx("Выставить заряд выбранного основного слота.", "Sets charge for the selected main slot.", "设置所选主栏位充能。", "設定所選主欄位充能。"), delegate { GameApi.RechargeSlotFor(invChar2, _selSlot, ModConfig.RechargeValue); }), new ActionTileSpec(Tx("Все слоты", "All slots", "全部栏位", "全部欄位"), Tx("Зарядить все основные слоты.", "Recharge all main slots.", "充能全部主栏位。", "充能全部主欄位。"), delegate { RechargeAllMainSlots(invChar2); }), new ActionTileSpec(Tx("Предмет на спине", "Back item", "背部物品", "背部物品"), Tx("Зарядить предмет на спине.", "Recharge the equipped back item.", "充能背部物品。", "充能背部物品。"), delegate { GameApi.RechargeBackSlotFor(invChar2, ModConfig.RechargeValue); }), new ActionTileSpec(Tx("Амулет", "Amulet", "护符", "護符"), Tx("Зарядить временный слот 250.", "Recharge temporary slot 250.", "充能临时栏位 250。", "充能暫時欄位 250。"), delegate { GameApi.RechargeTempSlotFor(invChar2, ModConfig.RechargeValue); }), new ActionTileSpec(Tx("Слот рюкзака", "Backpack slot", "背包栏位", "背包欄位"), Tx("Зарядить выбранную ячейку рюкзака.", "Recharge selected backpack slot.", "充能所选背包栏位。", "充能所選背包欄位。"), delegate { GameApi.RechargeBackpackSlotFor(invChar2, _selBackpackSlot, ModConfig.RechargeValue); }), new ActionTileSpec(Tx("Весь рюкзак", "All backpack", "整个背包", "整個背包"), Tx("Зарядить весь рюкзак.", "Recharge the whole backpack.", "充能整个背包。", "充能整個背包。"), delegate { RechargeAllBackpackSlots(invChar2); })); } else { DrawActionTiles(new ActionTileSpec(Tx("Зарядить всё", "Recharge everything", "全部充能", "全部充能"), Tx("Заряжает основные слоты, предмет на спине, амулет и весь рюкзак.", "Recharges main slots, back item, amulet, and the whole backpack.", "为主栏位、背部物品、护符和整个背包充能。", "為主欄位、背部物品、護符和整個背包充能。"), delegate { RechargeEverything(invChar2); }, 1)); } EndSection(); } DrawEntitySpawner(); } private static void RechargeAllMainSlots(Character target) { int num = (((Object)(object)target != (Object)null) ? GameApi.SlotCountFor(target) : GameApi.SlotCount()); if (num <= 0) { num = 3; } for (int i = 0; i < num; i++) { GameApi.RechargeSlotFor(target, i, ModConfig.RechargeValue); } } private static void RechargeAllBackpackSlots(Character target) { int num = GameApi.BackpackSlotCount(target); for (int i = 0; i < num; i++) { GameApi.RechargeBackpackSlotFor(target, i, ModConfig.RechargeValue); } } private static void RechargeEverything(Character target) { RechargeAllMainSlots(target); GameApi.RechargeBackSlotFor(target, ModConfig.RechargeValue); GameApi.RechargeTempSlotFor(target, ModConfig.RechargeValue); RechargeAllBackpackSlots(target); } private static void DrawCharacterModern() { if (BeginSection("character.move", L("tab.character"), defaultOpen: true)) { ModConfig.SpeedMod = Toggle("feat.speed", ModConfig.SpeedMod); if (ModConfig.SpeedMod) { ModConfig.SpeedAmount = Slider("x", ModConfig.SpeedAmount, 0.5f, 5f); } ModConfig.JumpMod = Toggle("feat.jump", ModConfig.JumpMod); if (ModConfig.JumpMod) { ModConfig.JumpAmount = Slider("x", ModConfig.JumpAmount, 1f, 5f); } ModConfig.InfiniteJumps = ToggleRaw(Ru ? "Бесконечные прыжки" : "Infinite jumps", Ru ? "Позволяет прыгать повторно в воздухе без ожидания земли." : "Allows repeated jumps in the air without touching the ground.", ModConfig.InfiniteJumps); ModConfig.NoSlipperySurfaces = ToggleRaw(Ru ? "Без скользких поверхностей" : "No slippery surfaces", Ru ? "Сильно снижает соскальзывание и считает крутые поверхности пригодными для стояния." : "Greatly reduces sliding and treats steep surfaces as standable.", ModConfig.NoSlipperySurfaces); EndSection(); } if (BeginSection("character.climb", Ru ? "Лазание" : "Climbing", defaultOpen: false)) { ModConfig.ClimbMod = Toggle("feat.climb", ModConfig.ClimbMod); if (ModConfig.ClimbMod) { ModConfig.ClimbAmount = Slider("x", ModConfig.ClimbAmount, 1f, 5f); } ModConfig.VineClimbMod = Toggle("feat.vineclimb", ModConfig.VineClimbMod); if (ModConfig.VineClimbMod) { ModConfig.VineClimbAmount = Slider("x", ModConfig.VineClimbAmount, 1f, 5f); } ModConfig.RopeClimbMod = Toggle("feat.ropeclimb", ModConfig.RopeClimbMod); if (ModConfig.RopeClimbMod) { ModConfig.RopeClimbAmount = Slider("x", ModConfig.RopeClimbAmount, 1f, 5f); } ModConfig.ClimbStaminaConsumptionPercent = Slider(Ru ? "Расход стамины при лазании %" : "Climbing stamina cost %", ModConfig.ClimbStaminaConsumptionPercent, 0f, 300f); EndSection(); } if (BeginSection("character.status", Ru ? "Стамина и недуги" : "Stamina & afflictions", defaultOpen: false)) { Character val = TargetPicker(ref _statusTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Полная стамина" : "Full stamina", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.FullStamina(val); } if (GUILayout.Button(Ru ? "Полная экстра" : "Full extra", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ModConfig.ExtraStaminaPercent = 100f; SetNumberText(Ru ? "Экстра стамина %" : "Extra stamina %", 0f, 100f, ModConfig.ExtraStaminaPercent); GameApi.FullExtraStamina(val); } if (GUILayout.Button(Ru ? "Снять все недуги" : "Clear afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(val); } GUILayout.EndHorizontal(); ModConfig.ExtraStaminaPercent = NumberField(Ru ? "Экстра стамина %" : "Extra stamina %", ModConfig.ExtraStaminaPercent, 0f, 100f); if (GUILayout.Button(Ru ? "Выдать экстрастамину" : "Set extra stamina", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.SetExtraStamina(val, ModConfig.ExtraStaminaPercent / 100f); } TipLast(Ru ? "Выставляет точное количество дополнительной стамины выбранной цели." : "Sets an exact amount of extra stamina for the selected target."); ModConfig.StaminaConsumptionPercent = Slider(Ru ? "Расход стамины %" : "Stamina cost %", ModConfig.StaminaConsumptionPercent, 0f, 300f); ModConfig.StaminaRegenPercent = Slider(Ru ? "Восстановление %" : "Stamina regen %", ModConfig.StaminaRegenPercent, 0f, 300f); ModConfig.StaminaRegenDelayMod = ToggleRaw(Ru ? "Своя задержка восстановления" : "Custom regen delay", Ru ? "Заменяет задержку перед восстановлением стамины на значение ниже." : "Overrides the delay before stamina starts regenerating.", ModConfig.StaminaRegenDelayMod); if (ModConfig.StaminaRegenDelayMod) { ModConfig.StaminaRegenDelay = Slider(Ru ? "Задержка" : "Delay", ModConfig.StaminaRegenDelay, 0f, 5f); } string[] array = (Ru ? GameApi.StatusRu : GameApi.StatusEn); _selStatus = GUILayout.SelectionGrid(_selStatus, array, 3, Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); _statusAmount = Slider(Ru ? "Сила" : "Amount", _statusAmount, 0f, 1f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наложить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.SetStatus(val, _selStatus, _statusAmount); } if (GUILayout.Button(Ru ? "Убрать этот" : "Remove this", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(32f) })) { GameApi.SetStatus(val, _selStatus, 0f); } GUILayout.EndHorizontal(); ModConfig.StatusIncreasePercent = Slider(Ru ? "Увеличение статуса %" : "Status increase %", ModConfig.StatusIncreasePercent, 0f, 100f); if (GUILayout.Button(Ru ? "Увеличить выбранный" : "Increase selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.IncreaseStatus(val, _selStatus, ModConfig.StatusIncreasePercent / 100f); } TipLast(Ru ? "Прибавить выбранный статус на указанный процент." : "Increase the selected status by the chosen percentage."); DrawStatusIncreaseButtons(val); EndSection(); } } private static void DrawCheatsModern() { if (BeginSection("cheats.core", L("tab.cheats"), defaultOpen: true)) { ModConfig.GodMode = Toggle("feat.god", ModConfig.GodMode); ModConfig.InfiniteStamina = Toggle("feat.infstam", ModConfig.InfiniteStamina); ModConfig.NoFallDamage = Toggle("feat.nofall", ModConfig.NoFallDamage); ModConfig.NoWeight = Toggle("feat.noweight", ModConfig.NoWeight); ModConfig.LockStatus = Toggle("feat.lockstatus", ModConfig.LockStatus); EndSection(); } if (BeginSection("cheats.fly", Ru ? "Полёт и телепорт" : "Fly & teleport", defaultOpen: false)) { ModConfig.TeleportToPing = Toggle("feat.tpping", ModConfig.TeleportToPing); ModConfig.Fly = Toggle("feat.fly", ModConfig.Fly); if (ModConfig.Fly) { ModConfig.FlySpeed = Slider(Ru ? "Скорость" : "Speed", ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Ru ? "Ускорение" : "Accel", ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Коорд.:" : "Coords:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); if (GUILayout.Button(Ru ? "ТП" : "TP", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(54f), GUILayout.Height(26f) }) && (float.TryParse(_tpX, out var result) & float.TryParse(_tpY, out var result2) & float.TryParse(_tpZ, out var result3))) { GameApi.TeleportToCoords(result, result2, result3); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.actions", Ru ? "Действия" : "Actions", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Воскресить себя" : "Revive self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ReviveSelf(); } if (GUILayout.Button(Ru ? "Убить себя" : "Kill self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.KillSelf(); } if (GUILayout.Button(Ru ? "К точке спавна" : "Warp to spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.WarpToSpawn(); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.players", Ru ? "Игроки" : "Players", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить список" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } if (GUILayout.Button(Ru ? "Воскресить всех" : "Revive all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.ReviveAll(); } if (GUILayout.Button(Ru ? "Притянуть всех" : "Warp all to me", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.WarpAllToMe(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Убить всех" : "Kill all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.KillAll(_excludeSelf); } _excludeSelf = GUILayout.Toggle(_excludeSelf, Ru ? " Не трогать себя" : " Exclude me", Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); GUILayout.EndHorizontal(); if (GameApi.PlayerChars.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» в лобби" : "Empty — press Refresh in a lobby", Theme.LabelDim, Array.Empty()); } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val = GameApi.PlayerChars[i]; if ((Object)(object)val == (Object)null) { continue; } bool flag = false; try { flag = val.IsLocal; } catch { } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?") + ((!flag) ? "" : (Ru ? " (ты)" : " (you)")), Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); if (!flag) { if (GUILayout.Button("TP", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { GameApi.WarpToPlayer(val); } if (GUILayout.Button(Ru ? "Притянуть" : "Bring", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { GameApi.BringPlayer(val); } if (GUILayout.Button(Ru ? "Убить" : "Kill", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { GameApi.KillPlayer(val); } if (GUILayout.Button(Ru ? "Ожив." : "Revive", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { GameApi.RevivePlayer(val); } } if (GUILayout.Button(Ru ? "Скаут" : "Scout", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { GameApi.SpawnScoutmaster(val); } GUILayout.EndHorizontal(); } EndSection(); } if (!BeginSection("cheats.pranks", Ru ? "Приколы" : "Pranks", defaultOpen: false)) { return; } Character c = TargetPicker(ref _prankTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наслать все недуги" : "Pile on afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PrankAfflict(c); } if (GUILayout.Button(Ru ? "Вылечить" : "Cure", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c); } GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Забить инвентарь выбранным предметом" : "Stuff inventory with selected item", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.FillInventoryWith(c, _selItem); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Забить золотом" : "Fill with gold", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { int num = GameApi.FindItemIndex("gold", "coin", "treasure"); if (num >= 0) { GameApi.FillInventoryWith(c, num); } } if (GUILayout.Button(Ru ? "Забить паутиной" : "Fill with webs", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { int num2 = GameApi.FindItemIndex("web", "spider"); if (num2 >= 0) { GameApi.FillInventoryWith(c, num2); } } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Предмет берётся из вкладки «Инвентарь». Физические шарики на игроке добавлю отдельно." : "Item comes from the Inventory tab. Physical balloons on a player will come separately.", Theme.LabelDim, Array.Empty()); EndSection(); } private static void DrawCheatsModern2() { if (BeginSection("cheats.core", L("tab.cheats"), defaultOpen: true)) { ModConfig.GodMode = Toggle("feat.god", ModConfig.GodMode); ModConfig.InfiniteStamina = Toggle("feat.infstam", ModConfig.InfiniteStamina); ModConfig.NoFallDamage = Toggle("feat.nofall", ModConfig.NoFallDamage); ModConfig.NoWeight = Toggle("feat.noweight", ModConfig.NoWeight); ModConfig.LockStatus = Toggle("feat.lockstatus", ModConfig.LockStatus); EndSection(); } if (BeginSection("cheats.fly2", Ru ? "Полёт и телепорт" : "Fly & teleport", defaultOpen: false)) { ModConfig.TeleportToPing = Toggle("feat.tpping", ModConfig.TeleportToPing); ModConfig.Fly = Toggle("feat.fly", ModConfig.Fly); if (ModConfig.Fly) { ModConfig.Noclip = ToggleRaw(Ru ? "Ноклип" : "Noclip", Ru ? "Отключает локальные коллайдеры и столкновения во время полёта." : "Disables local colliders and collisions while flying.", ModConfig.Noclip); ModConfig.FlySpeed = Slider(Ru ? "Скорость" : "Speed", ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Ru ? "Ускорение" : "Accel", ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Коорд.:" : "Coords:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); if (GUILayout.Button(Ru ? "ТП" : "TP", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(54f), GUILayout.Height(26f) }) && (float.TryParse(_tpX, out var result) & float.TryParse(_tpY, out var result2) & float.TryParse(_tpZ, out var result3))) { GameApi.TeleportToCoords(result, result2, result3); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.actions2", Ru ? "Действия" : "Actions", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Воскресить себя" : "Revive self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ReviveSelf(); } if (GUILayout.Button(Ru ? "Убить себя" : "Kill self", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.KillSelf(); } if (GUILayout.Button(Ru ? "К точке спавна" : "Warp to spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.WarpToSpawn(); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.players2", Ru ? "Игроки" : "Players", defaultOpen: false)) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить список" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } if (GUILayout.Button(Ru ? "Воскресить всех" : "Revive all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.ReviveAll(); } if (GUILayout.Button(Ru ? "Притянуть всех" : "Warp all to me", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.WarpAllToMe(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Убить всех" : "Kill all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.KillAll(_excludeSelf); } _excludeSelf = GUILayout.Toggle(_excludeSelf, Ru ? " Не трогать себя" : " Exclude me", Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); GUILayout.EndHorizontal(); if (GameApi.PlayerChars.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» в лобби." : "Empty - press Refresh in a lobby.", Theme.LabelDim, Array.Empty()); } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val = GameApi.PlayerChars[i]; if ((Object)(object)val == (Object)null) { continue; } bool flag = false; try { flag = val.IsLocal; } catch { } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?") + ((!flag) ? "" : (Ru ? " (ты)" : " (you)")), Theme.RowLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(92f) }); if (!flag) { if (GUILayout.Button("TP", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(44f) })) { GameApi.WarpToPlayer(val); } if (GUILayout.Button(Ru ? "Спавн" : "Spawn", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { GameApi.WarpPlayerToSpawn(val); } if (GUILayout.Button(Ru ? "Притянуть" : "Bring", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { GameApi.BringPlayer(val); } if (GUILayout.Button(Ru ? "Убить" : "Kill", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { GameApi.KillPlayer(val); } if (GUILayout.Button(Ru ? "Ожив." : "Revive", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(66f) })) { GameApi.RevivePlayer(val); } } if (GUILayout.Button(Ru ? "Скаут" : "Scout", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(64f) })) { GameApi.SpawnScoutmaster(val); } GUILayout.EndHorizontal(); } EndSection(); } if (!BeginSection("cheats.pranks2", Ru ? "Приколы" : "Pranks", defaultOpen: false)) { return; } Character c = TargetPicker(ref _prankTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Наслать все недуги" : "Pile on afflictions", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PrankAfflict(c); } if (GUILayout.Button(Ru ? "Вылечить" : "Cure", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c); } GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Забить инвентарь выбранным предметом" : "Stuff inventory with selected item", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.FillInventoryWith(c, _selItem); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Забить золотом" : "Fill with gold", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { int num = GameApi.FindItemIndex("gold", "coin", "treasure"); if (num >= 0) { GameApi.FillInventoryWith(c, num); } } if (GUILayout.Button(Ru ? "Забить паутиной" : "Fill with webs", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { int num2 = GameApi.FindItemIndex("web", "spider"); if (num2 >= 0) { GameApi.FillInventoryWith(c, num2); } } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Предмет берётся из вкладки «Инвентарь». Физические шарики и другие приколы можно добавить позже отдельно." : "The item comes from the Inventory tab. Physical balloon-style pranks can be added separately later.", Theme.LabelDim, Array.Empty()); EndSection(); } private static void DrawInventoryModern() { //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("inventory.spawn", Ru ? "Спавн предметов" : "Item spawner", defaultOpen: true)) { if (GameApi.ItemNames.Count <= 0) { if (GUILayout.Button(Ru ? "Загрузить список предметов" : "Load item list", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.EnsureItemsLoaded(); } } else { GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character val = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Кому:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(Ru ? "Себе" : "Me", (_invTarget < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = -1; } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val2 = GameApi.PlayerChars[i]; bool flag = false; try { flag = (Object)(object)val2 != (Object)null && val2.IsLocal; } catch { } if (!flag && GUILayout.Button((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?", (_invTarget == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = i; } } if (GUILayout.Button(Ru ? "Обн." : "Sync", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(52f), GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } GUILayout.EndHorizontal(); int num = (((Object)(object)val != (Object)null) ? GameApi.SlotCountFor(val) : GameApi.SlotCount()); if (num <= 0) { num = 3; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int j = 0; j < num; j++) { if (GUILayout.Button((j + 1).ToString(), (_selSlot == j) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = j; } } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Содержимое слотов" : "Slot contents", Theme.LabelDim, Array.Empty()); for (int k = 0; k < num; k++) { string text = GameApi.DescribeSlot(val, k); GUILayout.Label(string.Format("{0}. {1}", k + 1, (!string.IsNullOrEmpty(text)) ? text : "-"), Theme.LabelDim, Array.Empty()); } _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(170f)); string text2 = (_itemSearch ?? "").Trim().ToLowerInvariant(); for (int l = 0; l < GameApi.ItemNames.Count; l++) { string text3 = GameApi.ItemNames[l]; if ((text2.Length <= 0 || text3.ToLowerInvariant().IndexOf(text2) >= 0) && DrawItemListRow(l, text3, _selItem == l)) { _selItem = l; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Заспавнить в слот" : "Spawn to slot", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && _selItem >= 0) { if ((Object)(object)val != (Object)null) { GameApi.SpawnToSlotFor(val, _selItem, _selSlot); } else { GameApi.SpawnToSlot(_selItem, _selSlot); } } if (GUILayout.Button(Ru ? "Очистить слот" : "Clear slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(28f) })) { if ((Object)(object)val != (Object)null) { GameApi.ClearSlotFor(val, _selSlot); } else { GameApi.ClearSlot(_selSlot); } } GUILayout.EndHorizontal(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } if ((Object)(object)val != (Object)null) { GUILayout.Label((Ru ? "Смотришь и редактируешь инвентарь игрока: " : "Viewing and editing player's inventory: ") + ((_invTarget < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[_invTarget] : "?"), Theme.LabelDim, Array.Empty()); } } EndSection(); } if (!BeginSection("inventory.recharge", Ru ? "Перезарядка предметов" : "Item recharge", defaultOpen: false)) { return; } ModConfig.RechargeValue = NumberField(Ru ? "Заряд" : "Charge", ModConfig.RechargeValue, 0f, 999f); GUILayout.BeginHorizontal(Array.Empty()); for (int m = 0; m < Mathf.Min(3, GameApi.SlotCount()); m++) { int num2 = m; if (GUILayout.Button((Ru ? "Слот " : "Slot ") + (num2 + 1), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RechargeSlot(num2, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить выбранный слот" : "Recharge selected slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeSlot(_selSlot, ModConfig.RechargeValue); } if (GUILayout.Button(Ru ? "Зарядить все" : "Recharge all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int n = 0; n < GameApi.SlotCount(); n++) { GameApi.RechargeSlot(n, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); EndSection(); } private static void DrawInventoryModern2() { //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("inventory.spawn2", Ru ? "Спавн предметов" : "Item spawner", defaultOpen: true)) { if (GameApi.ItemNames.Count <= 0) { if (GUILayout.Button(Ru ? "Загрузить список предметов" : "Load item list", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.EnsureItemsLoaded(); } } else { GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character val = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Кому:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(Ru ? "Себе" : "Me", (_invTarget < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = -1; } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val2 = GameApi.PlayerChars[i]; bool flag = false; try { flag = (Object)(object)val2 != (Object)null && val2.IsLocal; } catch { } if (!flag && GUILayout.Button((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?", (_invTarget == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _invTarget = i; } } if (GUILayout.Button(Ru ? "Обн." : "Sync", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(52f), GUILayout.Height(26f) })) { GameApi.RefreshPlayers(); } GUILayout.EndHorizontal(); int num = (((Object)(object)val != (Object)null) ? GameApi.SlotCountFor(val) : GameApi.SlotCount()); if (num <= 0) { num = 3; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int j = 0; j < num; j++) { if (GUILayout.Button((j + 1).ToString(), (_selSlot == j) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = j; } } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Содержимое слотов" : "Slot contents", Theme.LabelDim, Array.Empty()); for (int k = 0; k < num; k++) { string text = GameApi.DescribeSlot(val, k); GUILayout.Label(string.Format("{0}. {1}", k + 1, (!string.IsNullOrEmpty(text)) ? text : "-"), Theme.LabelDim, Array.Empty()); } _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(170f)); string text2 = (_itemSearch ?? "").Trim().ToLowerInvariant(); for (int l = 0; l < GameApi.ItemNames.Count; l++) { string text3 = GameApi.ItemNames[l]; if ((text2.Length <= 0 || text3.ToLowerInvariant().IndexOf(text2) >= 0) && DrawItemListRow(l, text3, _selItem == l)) { _selItem = l; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Заспавнить в слот" : "Spawn to slot", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && _selItem >= 0) { if ((Object)(object)val != (Object)null) { GameApi.SpawnToSlotFor(val, _selItem, _selSlot); } else { GameApi.SpawnToSlot(_selItem, _selSlot); } } if (GUILayout.Button(Ru ? "Очистить слот" : "Clear slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(28f) })) { if ((Object)(object)val != (Object)null) { GameApi.ClearSlotFor(val, _selSlot); } else { GameApi.ClearSlot(_selSlot); } } GUILayout.EndHorizontal(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } if ((Object)(object)val != (Object)null) { GUILayout.Label((Ru ? "Смотришь и редактируешь инвентарь игрока: " : "Viewing and editing player's inventory: ") + ((_invTarget < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[_invTarget] : "?"), Theme.LabelDim, Array.Empty()); } } EndSection(); } if (!BeginSection("inventory.recharge2", Ru ? "Перезарядка предметов" : "Item recharge", defaultOpen: false)) { return; } ModConfig.RechargeValue = NumberField(Ru ? "Заряд" : "Charge", ModConfig.RechargeValue, 0f, 999f); int num2 = Mathf.Max(1, GameApi.SlotCount()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int m = 0; m < num2; m++) { if (GUILayout.Button((m + 1).ToString(), (_selSlot == m) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(28f) })) { _selSlot = m; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить выбранный слот" : "Recharge selected slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeSlot(_selSlot, ModConfig.RechargeValue); } if (GUILayout.Button(Ru ? "Зарядить все" : "Recharge all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int n = 0; n < GameApi.SlotCount(); n++) { GameApi.RechargeSlot(n, ModConfig.RechargeValue); } } GUILayout.EndHorizontal(); EndSection(); } private static void DrawCheatsModern3() { //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("cheats.core3", L("tab.cheats"), defaultOpen: true)) { ModConfig.GodMode = Toggle("feat.god", ModConfig.GodMode); ModConfig.InfiniteStamina = Toggle("feat.infstam", ModConfig.InfiniteStamina); ModConfig.NoFallDamage = Toggle("feat.nofall", ModConfig.NoFallDamage); ModConfig.NoFallingRagdoll = ToggleRaw(Tx("Без падения в ragdoll", "No falling ragdoll", "禁用摔倒布娃娃", "停用摔倒布娃娃"), Tx("Блокирует принудительный ragdoll от падения и соскальзывания.", "Blocks forced ragdoll from falling and sliding.", "阻止坠落和滑落触发强制布娃娃状态。", "阻止墜落和滑落觸發強制布娃娃狀態。"), ModConfig.NoFallingRagdoll); ModConfig.NoWeight = Toggle("feat.noweight", ModConfig.NoWeight); ModConfig.LockStatus = Toggle("feat.lockstatus", ModConfig.LockStatus); ModConfig.GlobalVoice = ToggleRaw(Tx("Слышно всех", "Hear everyone", "听见所有人", "聽見所有人"), Tx("Локально делает голоса всех игроков слышимыми на карте без 2D-эха: рядом остается обычный голос игры.", "Locally makes every player's voice audible across the map without 2D echo: nearby voices stay as normal game proximity voice.", "在本地让所有玩家的语音全图可听且没有 2D 回声:附近仍保持游戏原本的近距离语音。", "在本地讓所有玩家的語音全圖可聽且沒有 2D 回聲:附近仍保持遊戲原本的近距離語音。"), ModConfig.GlobalVoice); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Включить всем", "Enable for everyone", "为所有人启用", "為所有人啟用"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { VoiceControl.BroadcastHearAll(enabled: true); } TipLast(Tx("Отправляет команду всем клиентам с PEAK-MX: все игроки будут слышны на всей карте без эха.", "Sends a command to every PEAK-MX client: all players become audible across the map without echo.", "向所有 PEAK-MX 客户端发送命令:所有玩家全图可听且没有回声。", "向所有 PEAK-MX 客戶端發送命令:所有玩家全圖可聽且沒有回聲。")); if (GUILayout.Button(Tx("Выключить всем", "Disable for everyone", "为所有人关闭", "為所有人關閉"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(140f), GUILayout.Height(28f) })) { VoiceControl.BroadcastHearAll(enabled: false); } TipLast(Tx("Снимает сетевой режим слышимости у клиентов с PEAK-MX. Локальный переключатель выше остается твоей настройкой.", "Turns off the network voice-hearing mode on PEAK-MX clients. The local toggle above remains your own setting.", "关闭 PEAK-MX 客户端上的联网语音可听模式。上方本地开关仍是你的个人设置。", "關閉 PEAK-MX 客戶端上的連網語音可聽模式。上方本地開關仍是你的個人設定。")); GUILayout.EndHorizontal(); ModConfig.PlayerEsp = ToggleRaw(Tx("ESP игроков", "Player ESP", "玩家 ESP", "玩家 ESP"), Tx("Показывает игроков через стены экранными метками с расстоянием.", "Shows players through walls with screen labels and distance.", "用带距离的屏幕标记显示墙后的玩家。", "用帶距離的畫面標記顯示牆後的玩家。"), ModConfig.PlayerEsp); if (ModConfig.PlayerEsp) { ModConfig.PlayerEspDistance = Slider(Tx("Дистанция ESP", "ESP distance", "ESP 距离", "ESP 距離"), ModConfig.PlayerEspDistance, 25f, 2500f); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.PlayerEspBoxes = ToggleCompact(Tx("Рамки", "Boxes", "方框", "方框"), ModConfig.PlayerEspBoxes); ModConfig.PlayerEspLines = ToggleCompact(Tx("Линии", "Lines", "连线", "連線"), ModConfig.PlayerEspLines); GUILayout.EndHorizontal(); } ModConfig.ItemEsp = ToggleRaw(Tx("ESP предметов", "Item ESP", "物品 ESP", "物品 ESP"), Tx("Показывает выбранные предметы через стены экранными метками.", "Shows selected items through walls with screen labels.", "用屏幕标记显示墙后的所选物品。", "用畫面標記顯示牆後的所選物品。"), ModConfig.ItemEsp); if (ModConfig.ItemEsp) { ModConfig.ItemEspDistance = Slider(Tx("Дистанция предметов", "Item distance", "物品距离", "物品距離"), ModConfig.ItemEspDistance, 25f, 2000f); ModConfig.ItemEspLines = ToggleCompact(Tx("Линии к предметам", "Item lines", "物品连线", "物品連線"), ModConfig.ItemEspLines); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Все предметы", "All items", "全部物品", "全部物品"), (ModConfig.ItemEspSelectedIndex < 0) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(26f) })) { ModConfig.ItemEspSelectedIndex = -1; } GUILayout.Label(Tx("Поиск:", "Search:", "搜索:", "搜尋:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _itemEspSearch = GUILayout.TextField(_itemEspSearch ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); ModConfig.ItemEspSearch = _itemEspSearch; GUILayout.EndHorizontal(); GameApi.EnsureItemsLoaded(); string text = (_itemEspSearch ?? "").Trim().ToLowerInvariant(); _itemEspScroll = BeginVerticalScroll(_itemEspScroll, GUILayout.Height(126f)); for (int i = 0; i < GameApi.ItemNames.Count; i++) { string text2 = GameApi.ItemNames[i] ?? ""; if ((text.Length <= 0 || text2.ToLowerInvariant().IndexOf(text, StringComparison.Ordinal) >= 0) && DrawItemListRow(i, text2, ModConfig.ItemEspSelectedIndex == i)) { ModConfig.ItemEspSelectedIndex = i; } } GUILayout.EndScrollView(); } if (ModConfig.WorldEsp != null) { ModConfig.WorldEsp.Value = ToggleRaw(Tx("ESP опасностей и объектов", "Danger/object ESP", "危险/对象 ESP", "危險/物件 ESP"), Tx("Показывает через стены опасности, костры, предметы на спину и амулеты.", "Shows hazards, campfires, back-slot items and amulets through walls.", "透视显示危险、营火、背部物品和护符。", "透視顯示危險、營火、背部物品和護符。"), ModConfig.WorldEsp.Value); if (ModConfig.WorldEsp.Value) { ModConfig.WorldEspDistance.Value = Slider(Tx("Дистанция объектов", "Object distance", "对象距离", "物件距離"), ModConfig.WorldEspDistance.Value, 25f, 2500f); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.WorldEspLines.Value = ToggleCompact(Tx("Линии", "Lines", "连线", "連線"), ModConfig.WorldEspLines.Value); ModConfig.WorldEspDangers.Value = ToggleCompact(Tx("Опасности", "Hazards", "危险", "危險"), ModConfig.WorldEspDangers.Value); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); ModConfig.WorldEspCampfires.Value = ToggleCompact(Tx("Костры", "Campfires", "营火", "營火"), ModConfig.WorldEspCampfires.Value); ModConfig.WorldEspBackItems.Value = ToggleCompact(Tx("Рюкзаки/джеты", "Back items", "背部物品", "背部物品"), ModConfig.WorldEspBackItems.Value); ModConfig.WorldEspAmulets.Value = ToggleCompact(Tx("Амулеты", "Amulets", "护符", "護符"), ModConfig.WorldEspAmulets.Value); GUILayout.EndHorizontal(); } } ModConfig.NoStatusEffects = ToggleRaw(Tx("Без эффектов статуса", "No status effects", "无状态效果", "無狀態效果"), Tx("Постоянно очищает все недуги локального персонажа.", "Continuously clears every affliction from the local character.", "持续清除本地角色的所有负面状态。", "持續清除本地角色的所有負面狀態。"), ModConfig.NoStatusEffects); if (!ModConfig.NoStatusEffects) { ModConfig.NoInjury = ToggleRaw(Tx("Без травм", "No injury", "无受伤", "無受傷"), Tx("Постоянно очищает травмы.", "Continuously clears injury.", "持续清除受伤状态。", "持續清除受傷狀態。"), ModConfig.NoInjury); ModConfig.NoHunger = ToggleRaw(Tx("Без голода", "No hunger", "无饥饿", "無飢餓"), Tx("Постоянно очищает голод.", "Continuously clears hunger.", "持续清除饥饿。", "持續清除飢餓。"), ModConfig.NoHunger); ModConfig.NoCold = ToggleRaw(Tx("Без холода", "No cold", "无寒冷", "無寒冷"), Tx("Постоянно очищает холод.", "Continuously clears cold.", "持续清除寒冷。", "持續清除寒冷。"), ModConfig.NoCold); ModConfig.NoPoison = ToggleRaw(Tx("Без яда", "No poison", "无中毒", "無中毒"), Tx("Постоянно очищает яд.", "Continuously clears poison.", "持续清除中毒。", "持續清除中毒。"), ModConfig.NoPoison); ModConfig.NoCurse = ToggleRaw(Tx("Без проклятия", "No curse", "无诅咒", "無詛咒"), Tx("Постоянно очищает проклятие.", "Continuously clears curse.", "持续清除诅咒。", "持續清除詛咒。"), ModConfig.NoCurse); ModConfig.NoDrowsy = ToggleRaw(Tx("Без сонливости", "No drowsy", "无困倦", "無睏倦"), Tx("Постоянно очищает сонливость.", "Continuously clears drowsiness.", "持续清除困倦。", "持續清除睏倦。"), ModConfig.NoDrowsy); ModConfig.NoHot = ToggleRaw(Tx("Без жары", "No hot", "无炎热", "無炎熱"), Tx("Постоянно очищает жару.", "Continuously clears heat.", "持续清除炎热。", "持續清除炎熱。"), ModConfig.NoHot); ModConfig.NoCrab = ToggleRaw(Tx("Без краба", "No crab", "无螃蟹", "無螃蟹"), Tx("Постоянно очищает эффект краба.", "Continuously clears crab status.", "持续清除螃蟹状态。", "持續清除螃蟹狀態。"), ModConfig.NoCrab); ModConfig.NoThorns = ToggleRaw(Tx("Без шипов", "No thorns", "无刺", "無刺"), Tx("Постоянно очищает шипы.", "Continuously clears thorns.", "持续清除刺。", "持續清除刺。"), ModConfig.NoThorns); ModConfig.NoSpores = ToggleRaw(Tx("Без спор", "No spores", "无孢子", "無孢子"), Tx("Постоянно очищает споры.", "Continuously clears spores.", "持续清除孢子。", "持續清除孢子。"), ModConfig.NoSpores); ModConfig.NoWeb = ToggleRaw(Tx("Без паутины", "No web", "无蛛网", "無蛛網"), Tx("Постоянно очищает паутину.", "Continuously clears web.", "持续清除蛛网。", "持續清除蛛網。"), ModConfig.NoWeb); ModConfig.NoArrows = ToggleRaw(Tx("Без стрел", "No arrows", "无箭矢", "無箭矢"), Tx("Постоянно очищает стрелы.", "Continuously clears arrows.", "持续清除箭矢。", "持續清除箭矢。"), ModConfig.NoArrows); ModConfig.NoPetrify = ToggleRaw(Tx("Без окаменения", "No petrify", "无石化", "無石化"), Tx("Постоянно очищает окаменение, включая цену эффектов амулетов.", "Continuously clears petrify, including the cost from amulet effects.", "持续清除石化,包括护符效果的代价。", "持續清除石化,包括護符效果的代價。"), ModConfig.NoPetrify); ModConfig.NoFlyTrap = ToggleRaw(Tx("Без мухоловки", "No flytrap", "无捕蝇草", "無捕蠅草"), Tx("Постоянно очищает эффект мухоловки.", "Continuously clears flytrap status.", "持续清除捕蝇草状态。", "持續清除捕蠅草狀態。"), ModConfig.NoFlyTrap); } EndSection(); } if (BeginSection("cheats.fly3", Tx("Полёт и телепорт", "Fly & teleport", "飞行与传送", "飛行與傳送"), defaultOpen: false)) { ModConfig.TeleportToPing = Toggle("feat.tpping", ModConfig.TeleportToPing); ModConfig.LongInteraction = ToggleRaw(Tx("Дальнее взаимодействие", "Long interaction", "远距离交互", "遠距離互動"), Tx("Увеличивает дистанцию взаимодействия с предметами и объектами.", "Increases interaction distance for items and objects.", "增加与物品和对象交互的距离。", "增加與物品和物件互動的距離。"), ModConfig.LongInteraction); if (ModConfig.LongInteraction) { ModConfig.InteractionDistance = Slider(Tx("Дистанция", "Distance", "距离", "距離"), ModConfig.InteractionDistance, 2f, 80f); } ModConfig.CinematicCamera = ToggleRaw(Tx("Кинематографичная камера", "Cinematic camera", "电影镜头", "電影鏡頭"), Tx("Свободная камера: WASD, Space/E вверх, Ctrl/Q вниз, Shift быстрее, мышь поворачивает.", "Free camera: WASD, Space/E up, Ctrl/Q down, Shift faster, mouse rotates.", "自由镜头:WASD 移动,Space/E 上升,Ctrl/Q 下降,Shift 加速,鼠标转向。", "自由鏡頭:WASD 移動,Space/E 上升,Ctrl/Q 下降,Shift 加速,滑鼠轉向。"), ModConfig.CinematicCamera); if (ModConfig.CinematicCamera) { ModConfig.CinematicCameraSpeed = Slider(Tx("Скорость камеры", "Camera speed", "镜头速度", "鏡頭速度"), ModConfig.CinematicCameraSpeed, 0.5f, 40f); ModConfig.CinematicCameraFov = Slider("FOV", ModConfig.CinematicCameraFov, 1f, 120f); } ModConfig.Fly = Toggle("feat.fly", ModConfig.Fly); if (ModConfig.Fly) { ModConfig.Noclip = ToggleRaw(Tx("Проходить сквозь стены", "Noclip through geometry", "穿墙飞行", "穿牆飛行"), Tx("Во время полёта отключает столкновения локального персонажа с объектами и невидимыми стенами.", "Disables local character collisions while flying, including invisible blockers.", "飞行时关闭本地角色与物体和隐形墙的碰撞。", "飛行時關閉本地角色與物件和隱形牆的碰撞。"), ModConfig.Noclip); ModConfig.FlySpeed = Slider(Tx("Скорость", "Speed", "速度", "速度"), ModConfig.FlySpeed, 1f, 50f); ModConfig.FlyAcceleration = Slider(Tx("Ускорение", "Accel", "加速度", "加速度"), ModConfig.FlyAcceleration, 1f, 100f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Коорд.:", "Coords:", "坐标:", "座標:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); GUILayout.Label("X", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpX = GUILayout.TextField(_tpX ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Y", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpY = GUILayout.TextField(_tpY ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); GUILayout.Label("Z", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(12f) }); _tpZ = GUILayout.TextField(_tpZ ?? "0", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(70f), GUILayout.Height(26f) }); if (GUILayout.Button(Tx("ТП", "TP", "传送", "傳送"), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(54f), GUILayout.Height(26f) }) && (float.TryParse(_tpX, out var result) & float.TryParse(_tpY, out var result2) & float.TryParse(_tpZ, out var result3))) { GameApi.TeleportToCoords(result, result2, result3); } GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("cheats.pranks3", Tx("Приколы", "Pranks", "恶作剧", "惡作劇"), defaultOpen: false)) { Character c = TargetPicker(ref _prankTarget); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Наслать недуги", "Pile on afflictions", "施加异常", "施加異常"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PrankAfflict(c); } TipLast(Tx("Накладывает яд, проклятие, краба, сонливость и паутину на выбранную цель. Часть сетевых эффектов может зависеть от владельца цели.", "Adds poison, curse, crab, drowsy, and web to the target. Some networked effects may depend on the target owner.", "给目标施加中毒、诅咒、螃蟹、困倦和蛛网。部分网络效果可能取决于目标所有者。", "給目標施加中毒、詛咒、螃蟹、睏倦和蛛網。部分網路效果可能取決於目標擁有者。")); if (GUILayout.Button(Tx("Вылечить", "Cure", "治愈", "治癒"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearAllStatus(c); } TipLast(Tx("Очищает все недуги выбранной цели.", "Clears every affliction on the selected target.", "清除所选目标的所有异常状态。", "清除所選目標的所有異常狀態。")); if (GUILayout.Button(Tx("Пнуть", "Push", "推开", "推開"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.PushPlayer(c); } TipLast(Tx("Толкает выбранную цель от тебя физическим импульсом.", "Pushes the selected target away from you with a physics impulse.", "用物理冲量把所选目标从你身边推开。", "用物理衝量把所選目標從你身邊推開。")); if (GUILayout.Button(Tx("Взорвать", "Explode", "爆炸", "爆炸"), Theme.DangerBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ExplodePlayer(c); } TipLast(Tx("Создает взрыв прямо в выбранной цели и подбрасывает игроков рядом.", "Creates an explosion directly inside the selected target and throws nearby players.", "在所选目标身上直接制造爆炸并击飞附近玩家。", "在所選目標身上直接製造爆炸並擊飛附近玩家。")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Окаменить", "Petrify", "石化", "石化"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.PetrifyPlayer(c); } TipLast(Tx("Выставляет окаменение выбранной цели на 100%. На чужих игроках результат зависит от сетевого владельца.", "Sets the selected target's petrify amount to 100%. On remote players, the result depends on network ownership.", "把所选目标的石化值设为 100%。远程玩家的结果取决于网络所有权。", "把所選目標的石化值設為 100%。遠端玩家的結果取決於網路擁有權。")); if (GUILayout.Button(Tx("Снять окаменение", "Clear petrify", "解除石化", "解除石化"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ClearPetrify(c); } TipLast(Tx("Сбрасывает окаменение выбранной цели.", "Clears petrify from the selected target.", "清除所选目标的石化。", "清除所選目標的石化。")); GUILayout.EndHorizontal(); _petrifyAmount = Slider(Tx("Окаменение %", "Petrify %", "石化 %", "石化 %"), _petrifyAmount, 0f, 100f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Поставить %", "Set %", "设置 %", "設定 %"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SetPetrifyAmount(c, Mathf.RoundToInt(_petrifyAmount)); } TipLast(Tx("Выставляет окаменение выбранной цели на указанное значение.", "Sets the selected target's petrify amount to the selected value.", "把所选目标的石化值设为指定数值。", "把所選目標的石化值設為指定數值。")); if (GUILayout.Button(Tx("Мини-взрыв", "Mini explosion", "小爆炸", "小爆炸"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ExplodePlayer(c, 14f, 4f); } TipLast(Tx("Создает слабый взрыв в цели без намеренного убийства.", "Creates a weaker explosion inside the target without intentionally killing them.", "在目标身上制造较弱爆炸,不刻意击杀。", "在目標身上製造較弱爆炸,不刻意擊殺。")); if (GUILayout.Button(Tx("Легкий пинок", "Light push", "轻推", "輕推"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.PushPlayer(c, 7f); } TipLast(Tx("Слабый толчок для мягкого розыгрыша.", "A weaker push for a softer prank.", "用于轻度恶作剧的较弱推力。", "用於輕度惡作劇的較弱推力。")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Добавить стрелу", "Add arrow", "添加箭矢", "新增箭矢"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.AddArrowPrank(c); } TipLast(Tx("Надежно работает на своем персонаже; чужому игроку стрелу должен добавить его клиент.", "Works reliably on your own character; a remote target's client owns arrow placement.", "在自己角色上最可靠;远程目标的箭矢位置由对方客户端拥有。", "在自己角色上最可靠;遠端目標的箭矢位置由對方客戶端擁有。")); if (GUILayout.Button(Tx("5 стрел", "5 arrows", "5 支箭", "5 支箭"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.AddArrowPrank(c, 5); } TipLast(Tx("Добавляет несколько стрел на твоего персонажа; для чужого игрока нужен код на его стороне.", "Adds several arrows to your character; remote targets need code on their side.", "给你的角色添加多支箭;远程目标需要对方客户端执行代码。", "給你的角色新增多支箭;遠端目標需要對方客戶端執行程式碼。")); if (GUILayout.Button(Tx("Вытащить стрелы", "Remove arrows", "移除箭矢", "移除箭矢"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ClearArrows(c); } TipLast(Tx("Снимает физические стрелы с выбранной цели. У хоста может запросить снятие у владельца цели.", "Removes physical arrows from the selected target. As host, asks the target owner to remove them.", "移除所选目标身上的实体箭矢。房主可请求目标所有者移除。", "移除所選目標身上的實體箭矢。房主可請求目標擁有者移除。")); GUILayout.EndHorizontal(); if (GUILayout.Button(Tx("Забить выбранным предметом", "Stuff with selected item", "塞满所选物品", "塞滿所選物品"), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { GameApi.FillInventoryWith(c, _selItem); } TipLast(Tx("Заполняет все обычные слоты и рюкзак предметом из вкладки «Инвентарь».", "Fills every regular slot and backpack slot with the selected Inventory item.", "用“物品栏”标签中选中的物品填满普通栏位和背包栏位。", "用「物品欄」分頁中選中的物品填滿普通欄位和背包欄位。")); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Забить золотом", "Fill with gold", "塞满黄金", "塞滿黃金"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.FillInventoryWithGold(c); } TipLast(Tx("Ищет золотой идол по игровому тегу и кладёт его во все слоты цели, включая рюкзак.", "Finds the golden idol by game tag and fills the target's slots, including backpack.", "按游戏标签查找金色神像,并填入目标所有栏位,包括背包。", "按遊戲標籤查找金色神像,並填入目標所有欄位,包括背包。")); if (GUILayout.Button(Tx("Забить паутиной", "Fill with webs", "塞满蛛网", "塞滿蛛網"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.FillInventoryWithWebs(c); } TipLast(Tx("Пытается найти предмет паутины/паука; если такого предмета нет, накладывает эффект паутины.", "Tries to find a web/spider item; if none exists, applies the web status.", "尝试查找蛛网/蜘蛛物品;如果没有,则施加蛛网状态。", "嘗試查找蛛網/蜘蛛物品;如果沒有,則施加蛛網狀態。")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Случайные предметы", "Random items", "随机物品", "隨機物品"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.FillInventoryWithRandom(c); } TipLast(Tx("Заполняет слоты цели случайными предметами из загруженного списка, включая рюкзак.", "Fills the target's slots with random loaded items, including backpack.", "用已加载列表中的随机物品填充目标栏位,包括背包。", "用已載入列表中的隨機物品填充目標欄位,包括背包。")); if (GUILayout.Button(Tx("Очистить инвентарь", "Clear inventory", "清空物品栏", "清空物品欄"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.ClearInventory(c); } TipLast(Tx("Очищает обычные слоты и рюкзак выбранной цели.", "Clears the selected target's regular slots and backpack.", "清空所选目标的普通栏位和背包。", "清空所選目標的普通欄位和背包。")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("7 шариков", "7 balloons", "7 个气球", "7 個氣球"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.TieBalloons(c, 7); } TipLast(Tx("Привязывает к цели семь игровых шариков, чтобы подъём был заметнее.", "Ties seven in-game balloons to the target for a stronger lift.", "给目标绑上 7 个游戏气球,让升力更明显。", "給目標綁上 7 個遊戲氣球,讓升力更明顯。")); if (GUILayout.Button(Tx("Высыпать вещи", "Drop items", "丢出物品", "丟出物品"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.DropAllInventory(c); } TipLast(Tx("Выбрасывает содержимое основных слотов и надетый рюкзак рядом с целью.", "Drops main-slot items and the equipped backpack near the target.", "把主栏位物品和已装备背包丢到目标附近。", "把主欄位物品和已裝備背包丟到目標附近。")); GUILayout.EndHorizontal(); GUILayout.Label(Tx("Предмет для первого прикола выбирается во вкладке «Инвентарь». Список предметов загружается автоматически.", "The selected item comes from the Inventory tab. The item list loads automatically.", "第一个恶作剧使用“物品栏”标签中选中的物品。物品列表会自动加载。", "第一個惡作劇使用「物品欄」分頁中選中的物品。物品列表會自動載入。"), Theme.LabelDim, Array.Empty()); EndSection(); } } private static void DrawAdminModern() { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(Ru ? "Администрирование" : "Administration", Theme.Section, Array.Empty()); if (!GameApi.IsHost()) { GUILayout.Label(Ru ? "Функции меню доступны всем пользователям, но кик и часть сетевых действий игра всё равно принимает только от хоста комнаты." : "Menu actions are available to every user, but kick and some network actions are still accepted only from the room host by the game.", Theme.LabelDim, Array.Empty()); } if (BeginSection("admin.players", Ru ? "Игроки" : "Players", defaultOpen: true)) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "В списке: " : "Listed: ") + GameApi.PlayerChars.Count, Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); _excludeSelf = ToggleCompact(Ru ? "Не трогать себя" : "Exclude me", _excludeSelf); GUILayout.EndHorizontal(); DrawActionTiles(new ActionTileSpec(Ru ? "Обновить" : "Refresh", Ru ? "Обновить список игроков, не меняя размер панели." : "Refresh the player list without changing the panel size.", delegate { GameApi.RefreshPlayers(); }), new ActionTileSpec(Ru ? "Воскресить всех" : "Revive all", Ru ? "Воскресить всех игроков." : "Revive every player.", delegate { GameApi.ReviveAll(); }), new ActionTileSpec(Ru ? "Только мёртвых" : "Dead only", Ru ? "Воскресить только игроков, которые сейчас отмечены мёртвыми." : "Revive only players currently marked as dead.", delegate { GameApi.ReviveAllDeadOnly(); }), new ActionTileSpec(Ru ? "Притянуть всех" : "Bring all", Ru ? "Телепортировать остальных игроков к тебе." : "Teleport the other players to you.", delegate { GameApi.WarpAllToMe(); }), new ActionTileSpec(Ru ? "Убить всех" : "Kill all", Ru ? "Убить всех игроков. Переключатель выше исключает тебя из действия." : "Kill all players. The switch above excludes you.", delegate { GameApi.KillAll(_excludeSelf); }, 2)); if (GameApi.PlayerChars.Count == 0) { GUILayout.Label(Ru ? "Список пуст. Нажми «Обновить список» в лобби или забеге." : "Empty. Press Refresh in a lobby or run.", Theme.LabelDim, Array.Empty()); } _adminScroll = BeginVerticalScroll(_adminScroll, GUILayout.Height((float)((GameApi.PlayerChars.Count > 4) ? 150 : 112))); for (int num = 0; num < GameApi.PlayerChars.Count; num++) { DrawAdminPlayerRow(num); } GUILayout.EndScrollView(); Character val = ((_adminTarget >= 0 && _adminTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_adminTarget] : null); if ((Object)(object)val != (Object)null) { DrawAdminSelectedPlayer(val); } EndSection(); } if (BeginSection("admin.protection", Ru ? "Админ-защита" : "Admin protection", defaultOpen: false)) { GUILayout.Label(Ru ? "Хостовая защита от подозрительного поведения других игроков. На пользователя панели проверки не действуют." : "Host-side protection against suspicious behavior from other players. The panel user is exempt.", Theme.LabelDim, Array.Empty()); DrawToggleTiles(new ToggleTileSpec(Ru ? "Защита" : "Protection", Ru ? "Включает проверки для других игроков. На пользователя панели проверки не действуют." : "Enables checks for other players. The panel user is exempt.", () => ModConfig.AdminProtectionEnabled, delegate(bool v) { ModConfig.AdminProtectionEnabled = v; }), new ToggleTileSpec(Ru ? "Только лог" : "Warn only", Ru ? "Писать подозрительные события в лог, но не кикать автоматически." : "Write suspicious events to the log without automatic kicks.", () => ModConfig.AdminWarnOnly, delegate(bool v) { ModConfig.AdminWarnOnly = v; }), new ToggleTileSpec(Ru ? "Скорость" : "Movement", Ru ? "Проверяет скорость других игроков и отмечает слишком резкие скачки." : "Measures other players' speed and flags extreme jumps.", () => ModConfig.AdminDetectExtremeMovement, delegate(bool v) { ModConfig.AdminDetectExtremeMovement = v; }), new ToggleTileSpec(Ru ? "Игнор падения" : "Ignore falling", Ru ? "При проверке скорости не считать чистое движение вниз." : "Ignores pure downward motion in speed checks.", () => ModConfig.AdminIgnoreDownwardMovement, delegate(bool v) { ModConfig.AdminIgnoreDownwardMovement = v; }), new ToggleTileSpec(Ru ? "Редкие предметы" : "Rare items", Ru ? "Отслеживает частое появление проклятых предметов и амулетов в слотах игроков." : "Tracks frequent cursed item and amulet appearances in player slots.", () => ModConfig.AdminDetectRareItemBursts, delegate(bool v) { ModConfig.AdminDetectRareItemBursts = v; }), new ToggleTileSpec(Ru ? "Сессионные баны" : "Session bans", Ru ? "Если забаненный игрок вернётся в комнату, хост снова его кикнет." : "If a session-banned player rejoins, the host kicks them again.", () => ModConfig.AdminAutoKickSessionBans, delegate(bool v) { ModConfig.AdminAutoKickSessionBans = v; })); ModConfig.AdminMaxSpeed = NumberField(Ru ? "Макс. скорость" : "Max speed", ModConfig.AdminMaxSpeed, 5f, 300f); ModConfig.AdminSpeedStrikes = Mathf.RoundToInt(NumberField(Ru ? "Срабатываний" : "Strikes", ModConfig.AdminSpeedStrikes, 1f, 10f)); EndSection(); } DrawManyPlayersAdmin(); if (!BeginSection("admin.lists", Ru ? "Баны, запреты и лог" : "Bans, locks & log", defaultOpen: false)) { return; } GUILayout.Label(Ru ? "Сессионный бан-лист" : "Session ban list", Theme.LabelDim, Array.Empty()); List list = GameApi.SessionBanEntries(); if (list.Count == 0) { GUILayout.Label(Ru ? "Пока пусто." : "Empty.", Theme.LabelDim, Array.Empty()); } for (int num2 = 0; num2 < list.Count; num2++) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(list[num2].Label, Theme.RowLabel, Array.Empty()); if (GUILayout.Button(Ru ? "Разбанить" : "Unban", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(28f) })) { GameApi.UnbanSession(list[num2].Key); } GUILayout.EndHorizontal(); } GUILayout.Space(6f); GUILayout.Label(Ru ? "Запрет инвентаря" : "Inventory locks", Theme.LabelDim, Array.Empty()); List list2 = GameApi.InventoryLockEntries(); if (list2.Count == 0) { GUILayout.Label(Ru ? "Пока пусто." : "Empty.", Theme.LabelDim, Array.Empty()); } for (int num3 = 0; num3 < list2.Count; num3++) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(list2[num3].Label, Theme.RowLabel, Array.Empty()); if (GUILayout.Button(Ru ? "Снять запрет" : "Unlock", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(28f) })) { GameApi.UnlockInventoryLock(list2[num3].Key); } GUILayout.EndHorizontal(); } GUILayout.Space(6f); GUILayout.Label(Ru ? "Последние действия" : "Recent actions", Theme.LabelDim, Array.Empty()); if (GameApi.AdminProtectionLog.Count == 0) { GUILayout.Label(Ru ? "Лог пока пуст." : "No log events yet.", Theme.LabelDim, Array.Empty()); } for (int num4 = 0; num4 < GameApi.AdminProtectionLog.Count; num4++) { GUILayout.Label(GameApi.AdminProtectionLog[num4], Theme.LabelDim, Array.Empty()); } EndSection(); } private static void DrawAntiCheatModern() { GUILayout.Label(L("tab.anticheat"), Theme.Section, Array.Empty()); bool flag = GameApi.IsHost(); if (BeginSection("anticheat.detection", Tx("Обнаружение действий", "Action detection", "行为检测", "行為偵測"), defaultOpen: true)) { GUILayout.Label(AntiCheat.StatusText(Localization.Current), Theme.LabelDim, Array.Empty()); if (flag) { DrawToggleTiles(new ToggleTileSpec(Tx("Античит", "Anti-cheat", "反作弊", "反作弊"), Tx("Включает обнаружение подозрительных действий. Настройки ниже управляют тем, что именно проверять и как реагировать.", "Enables suspicious-action detection. The settings below control what is checked and how the host responds.", "启用可疑行为检测。下方设置决定检查内容及房主响应方式。", "啟用可疑行為偵測。下方設定決定檢查內容及房主回應方式。"), () => ModConfig.AntiCheatEnabled, delegate(bool v) { AntiCheat.SetHostEnabled(v); })); if (ModConfig.AntiCheatEnabled) { DrawToggleTiles(new ToggleTileSpec(Tx("Блокировать инструменты PEAK-MX у клиентов", "Lock PEAK-MX tools on clients", "锁定客户端 PEAK-MX 工具", "鎖定用戶端 PEAK-MX 工具"), Tx("Не-хосты смогут открыть только вкладки «О моде» и «Античит».", "Non-hosts can only open the About and Anti-cheat tabs.", "非房主只能打开“关于”和“反作弊”标签。", "非房主只能打開「關於」和「反作弊」分頁。"), () => ModConfig.AntiCheatLockClients == null || ModConfig.AntiCheatLockClients.Value, delegate(bool v) { if (ModConfig.AntiCheatLockClients != null) { ModConfig.AntiCheatLockClients.Value = v; AntiCheat.SetHostEnabled(enabled: true); } }), new ToggleTileSpec(Tx("Только предупреждать", "Warn only", "仅警告", "僅警告"), Tx("Записывает подозрительные события, но не кикает автоматически.", "Logs suspicious events without automatic kicks.", "记录可疑事件,但不会自动踢出。", "記錄可疑事件,但不會自動踢出。"), () => ModConfig.AdminWarnOnly, delegate(bool v) { ModConfig.AdminWarnOnly = v; }), new ToggleTileSpec(Tx("Проверять скорость", "Detect movement", "检测移动", "偵測移動"), Tx("Отмечает слишком быстрое движение других игроков.", "Flags excessively fast movement by other players.", "标记其他玩家的异常高速移动。", "標記其他玩家的異常高速移動。"), () => ModConfig.AdminDetectExtremeMovement, delegate(bool v) { ModConfig.AdminDetectExtremeMovement = v; }), new ToggleTileSpec(Tx("Игнорировать движение вниз", "Ignore downward movement", "忽略向下移动", "忽略向下移動"), Tx("Падение вниз не учитывается при проверке скорости.", "Downward falling is excluded from movement checks.", "速度检测不计算向下坠落。", "速度偵測不計算向下墜落。"), () => ModConfig.AdminIgnoreDownwardMovement, delegate(bool v) { ModConfig.AdminIgnoreDownwardMovement = v; }, ModConfig.AdminDetectExtremeMovement), new ToggleTileSpec(Tx("Редкие предметы", "Rare items", "稀有物品", "稀有物品"), Tx("Отслеживает подозрительное появление проклятых предметов и одинаковых амулетов.", "Tracks suspicious cursed-item appearances and duplicate amulets.", "检测可疑的诅咒物品和重复护符。", "偵測可疑的詛咒物品和重複護符。"), () => ModConfig.AdminDetectRareItemBursts, delegate(bool v) { ModConfig.AdminDetectRareItemBursts = v; }), new ToggleTileSpec(Tx("Сессионные баны", "Session bans", "会话封禁", "工作階段封鎖"), Tx("Повторно кикает заблокированного игрока при возврате в текущую комнату.", "Kicks a session-banned player again if they return to the current room.", "玩家返回当前房间时再次踢出。", "玩家返回目前房間時再次踢出。"), () => ModConfig.AdminAutoKickSessionBans, delegate(bool v) { ModConfig.AdminAutoKickSessionBans = v; })); if (ModConfig.AdminDetectExtremeMovement) { ModConfig.AdminMaxSpeed = NumberField(Tx("Макс. скорость", "Max speed", "最大速度", "最大速度"), ModConfig.AdminMaxSpeed, 5f, 300f); ModConfig.AdminSpeedStrikes = Mathf.RoundToInt(NumberField(Tx("Срабатываний", "Strikes", "触发次数", "觸發次數"), ModConfig.AdminSpeedStrikes, 1f, 10f)); } } } else { GUILayout.Label(Tx("Проверки выполняет хост. На этом клиенте показано только состояние политики комнаты.", "Checks are run by the host. This client only shows the room policy state.", "检查由房主执行。此客户端仅显示房间策略状态。", "檢查由房主執行。此用戶端僅顯示房間策略狀態。"), Theme.LabelDim, Array.Empty()); GUILayout.Label(Tx("Хост: ", "Host: ", "房主: ", "房主: ") + ((AntiCheat.HostActor > 0) ? AntiCheat.HostActor.ToString() : "?"), Theme.LabelDim, Array.Empty()); if (!string.IsNullOrWhiteSpace(AntiCheat.HostVersion)) { GUILayout.Label("PEAK-MX: " + AntiCheat.HostVersion, Theme.LabelDim, Array.Empty()); } } if (AntiCheat.ClientToolsLocked) { GUILayout.Label(Tx("Инструменты отключены политикой античита хоста.", "Tools are disabled by the host anti-cheat policy.", "工具已被房主反作弊策略禁用。", "工具已被房主反作弊策略停用。"), Theme.DonateText, Array.Empty()); } EndSection(); } if (BeginSection("anticheat.mods", Tx("Контроль модов", "Mod control", "模组控制", "模組控制"), defaultOpen: true)) { DrawMxAhgAdmin(); EndSection(); } if (BeginSection("anticheat.events", Tx("События", "Events", "事件", "事件"), defaultOpen: true)) { if (GameApi.AdminProtectionLog.Count == 0) { GUILayout.Label(Ru ? "Лог пока пуст." : "No log events yet.", Theme.LabelDim, Array.Empty()); } for (int num = 0; num < GameApi.AdminProtectionLog.Count; num++) { GUILayout.Label(GameApi.AdminProtectionLog[num], Theme.LabelDim, Array.Empty()); } EndSection(); } } private static void DrawMxAhgAdmin() { GUILayout.Label(Tx("Отдельный лёгкий агент проверяет DLL в BepInEx/plugins, реально загруженные плагины и владельцев Harmony-патчей. Личные файлы и SteamID не собираются.", "The standalone lightweight agent checks DLLs under BepInEx/plugins, loaded plugins and Harmony patch owners. It does not collect personal files or SteamID.", "独立轻量代理检查 BepInEx/plugins 中的 DLL、已加载插件和 Harmony 补丁所有者,不收集个人文件或 SteamID。", "獨立輕量代理檢查 BepInEx/plugins 中的 DLL、已載入外掛和 Harmony 修補擁有者,不收集個人檔案或 SteamID。"), Theme.LabelDim, Array.Empty()); GUILayout.Label(Tx("Строгий режим: хост ставит PEAK-MX, игроки ставят MX-AHG и тот же набор обычных модов. PEAK-MX хоста и MX-AHG не входят в эталон.", "Strict mode: the host runs PEAK-MX, players run MX-AHG plus the same regular mod pack. Host PEAK-MX and MX-AHG are excluded from the baseline.", "严格模式:房主使用 PEAK-MX,玩家使用 MX-AHG 和相同的普通模组包。房主 PEAK-MX 和 MX-AHG 不计入基准。", "嚴格模式:房主使用 PEAK-MX,玩家使用 MX-AHG 和相同的普通模組包。房主 PEAK-MX 和 MX-AHG 不計入基準。"), Theme.LabelDim, Array.Empty()); if (!GameApi.IsHost()) { GUILayout.Label(Tx("Управление MX-AHG доступно хосту комнаты.", "MX-AHG controls are available to the room host.", "MX-AHG 控制仅供房主使用。", "MX-AHG 控制僅供房主使用。"), Theme.LabelDim, Array.Empty()); return; } bool requireAgent = ModConfig.MxAhgRequireAgent != null && ModConfig.MxAhgRequireAgent.Value; bool exactPack = ModConfig.MxAhgExactPack == null || ModConfig.MxAhgExactPack.Value; DrawToggleTiles(new ToggleTileSpec(Tx("Требовать MX-AHG", "Require MX-AHG", "要求 MX-AHG", "要求 MX-AHG"), Tx("После времени на подключение игрок должен прислать действительный отчёт агента.", "After the join grace period, every player must provide a valid agent report.", "加入宽限期后,每位玩家都必须提供有效的代理报告。", "加入寬限期後,每位玩家都必須提供有效的代理報告。"), () => requireAgent, delegate(bool v) { if (ModConfig.MxAhgRequireAgent != null) { ModConfig.MxAhgRequireAgent.Value = v; if (v) { if (ModConfig.MxAhgExactPack != null) { ModConfig.MxAhgExactPack.Value = true; } if (ModConfig.MxAhgKickMissing != null) { ModConfig.MxAhgKickMissing.Value = true; } if (ModConfig.MxAhgKickMismatch != null) { ModConfig.MxAhgKickMismatch.Value = true; } } } })); if (!requireAgent) { GUILayout.Label(Tx("Включи требование агента, чтобы настроить точное сравнение, реакцию на несовпадения и отчёты игроков.", "Enable the agent requirement to configure exact matching, mismatch handling and player reports.", "启用代理要求后可配置精确匹配、不匹配处理和玩家报告。", "啟用代理要求後可設定精確比對、不相符處理和玩家報告。"), Theme.LabelDim, Array.Empty()); return; } DrawToggleTiles(new ToggleTileSpec(Tx("Точный набор хоста", "Exact host pack", "与房主完全一致", "與房主完全一致"), Tx("Сравнивает DLL, загруженные плагины и Harmony-патчи с набором хоста.", "Compares DLLs, loaded plugins and Harmony patches against the host set.", "将 DLL、已加载插件和 Harmony 补丁与房主集合进行比较。", "將 DLL、已載入外掛和 Harmony 修補與房主集合進行比較。"), () => exactPack, delegate(bool v) { if (ModConfig.MxAhgExactPack != null) { ModConfig.MxAhgExactPack.Value = v; } }), new ToggleTileSpec(Tx("Кик без агента", "Kick missing agent", "踢出无代理者", "踢出無代理者"), Tx("Кикает игрока без heartbeat или действительного отчёта после ожидания.", "Kicks a player without a heartbeat or valid report after the grace period.", "宽限期后踢出没有心跳或有效报告的玩家。", "寬限期後踢出沒有心跳或有效報告的玩家。"), () => ModConfig.MxAhgKickMissing == null || ModConfig.MxAhgKickMissing.Value, delegate(bool v) { if (ModConfig.MxAhgKickMissing != null) { ModConfig.MxAhgKickMissing.Value = v; } }, requireAgent), new ToggleTileSpec(Tx("Кик несовпадений", "Kick mismatches", "踢出不匹配者", "踢出不相符者"), Tx("Кикает игрока, если его проверенный набор отличается от набора хоста.", "Kicks a player when their verified set differs from the host set.", "若验证集合与房主不同则踢出玩家。", "若驗證集合與房主不同則踢出玩家。"), () => ModConfig.MxAhgKickMismatch == null || ModConfig.MxAhgKickMismatch.Value, delegate(bool v) { if (ModConfig.MxAhgKickMismatch != null) { ModConfig.MxAhgKickMismatch.Value = v; } }, requireAgent && exactPack), new ToggleTileSpec(Tx("Кик подозрительных", "Kick suspicious", "踢出可疑者", "踢出可疑者"), Tx("Кикает по стоп-словам. По умолчанию выключено из-за риска ложных срабатываний.", "Kicks on denied keywords. Off by default because names can cause false positives.", "根据禁用关键词踢出。默认关闭以避免误报。", "根據禁用關鍵詞踢出。預設關閉以避免誤報。"), () => ModConfig.MxAhgKickSuspicious != null && ModConfig.MxAhgKickSuspicious.Value, delegate(bool v) { if (ModConfig.MxAhgKickSuspicious != null) { ModConfig.MxAhgKickSuspicious.Value = v; } }, requireAgent), new ToggleTileSpec(Tx("Кик за потерю heartbeat", "Kick stale heartbeat", "心跳丢失时踢出", "心跳遺失時踢出"), Tx("Кикает, если агент перестал отвечать более чем на 20 секунд.", "Kicks when the agent stops responding for more than 20 seconds.", "代理停止响应超过 20 秒时踢出。", "代理停止回應超過 20 秒時踢出。"), () => ModConfig.MxAhgKickStale != null && ModConfig.MxAhgKickStale.Value, delegate(bool v) { if (ModConfig.MxAhgKickStale != null) { ModConfig.MxAhgKickStale.Value = v; } }, requireAgent)); if (ModConfig.MxAhgGraceSeconds != null) { ModConfig.MxAhgGraceSeconds.Value = NumberField(Tx("Ожидание после входа", "Join grace", "加入宽限", "加入寬限"), ModConfig.MxAhgGraceSeconds.Value, 8f, 90f); } if (ModConfig.MxAhgRecheckSeconds != null) { ModConfig.MxAhgRecheckSeconds.Value = NumberField(Tx("Повторная проверка", "Recheck interval", "复查间隔", "複查間隔"), ModConfig.MxAhgRecheckSeconds.Value, 20f, 300f); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Стоп-слова", "Denied keywords", "禁用关键词", "禁用關鍵詞"), Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Tx("Сброс", "Reset", "重置", "重設"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(72f), GUILayout.Height(24f) }) && ModConfig.MxAhgDeniedKeywords != null) { ModConfig.MxAhgDeniedKeywords.Value = "cheat;trainer;hack;godmode;exploit;injector"; } TipLast(Tx("Вернуть стандартный список стоп-слов.", "Restore the default denied-keyword list.", "恢复默认禁用关键词列表。", "還原預設禁用關鍵詞清單。")); GUILayout.EndHorizontal(); if (ModConfig.MxAhgDeniedKeywords != null) { ModConfig.MxAhgDeniedKeywords.Value = GUILayout.TextField(ModConfig.MxAhgDeniedKeywords.Value ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); } DrawActionTiles(new ActionTileSpec(Tx("Обновить набор хоста", "Rescan host", "重新扫描房主", "重新掃描房主"), Tx("Повторно считает локальные DLL и загруженные плагины.", "Rescans local DLLs and loaded plugins.", "重新扫描本地 DLL 和已加载插件。", "重新掃描本地 DLL 和已載入外掛。"), delegate { MxAhgHost.RefreshLocal(); }), new ActionTileSpec(Tx("Перепроверить всех", "Recheck all", "复查所有人", "複查所有人"), Tx("Отправляет новый одноразовый challenge всем агентам.", "Sends a fresh one-time challenge to every agent.", "向所有代理发送新的单次挑战。", "向所有代理傳送新的單次挑戰。"), delegate { MxAhgHost.RequestAll(); }), new ActionTileSpec(Tx("Копировать отчёт", "Copy report", "复制报告", "複製報告"), Tx("Копирует подробный отчёт по всем игрокам.", "Copies the detailed report for every player.", "复制所有玩家的详细报告。", "複製所有玩家的詳細報告。"), delegate { GUIUtility.systemCopyBuffer = MxAhgHost.BuildReport(Localization.Current); }), new ActionTileSpec(Tx("Кикнуть отклонённых", "Kick rejected", "踢出未通过者", "踢出未通過者"), Tx("Сразу кикает всех игроков, которые сейчас не прошли проверку и не отмечены доверенными.", "Immediately kicks every player currently rejected and not trusted.", "立即踢出当前未通过且未受信任的玩家。", "立即踢出目前未通過且未受信任的玩家。"), delegate { MxAhgHost.KickRejected(); }, 2)); GUILayout.Label(Tx("Эталон хоста: ", "Host baseline: ", "房主基准: ", "房主基準: ") + MxAhgHost.LocalSignature + $" ({MxAhgHost.LocalFileCount} DLL)", Theme.LabelDim, Array.Empty()); if (!string.IsNullOrWhiteSpace(MxAhgHost.LocalError)) { GUILayout.Label(Tx("Примечание сканера: ", "Scanner note: ", "扫描提示: ", "掃描提示: ") + MxAhgHost.LocalError, Theme.DonateText, Array.Empty()); } IReadOnlyList rows = MxAhgHost.Rows; if (rows.Count == 0) { GUILayout.Label(Tx("В комнате пока нет других игроков.", "No other players are in the room yet.", "房间内暂时没有其他玩家。", "房間內暫時沒有其他玩家。"), Theme.LabelDim, Array.Empty()); } else { bool flag = false; for (int num = 0; num < rows.Count; num++) { MxAhgRow mxAhgRow = rows[num]; if (mxAhgRow.ActorNumber == _mxAhgTargetActor) { flag = true; } string text = ((mxAhgRow.HeartbeatAge < 0f) ? "--" : (mxAhgRow.HeartbeatAge.ToString("0") + "s")); string text2 = mxAhgRow.PlayerName + " | " + mxAhgRow.StatusText(Localization.Current) + " | " + text; GUIStyle val = ((mxAhgRow.ActorNumber == _mxAhgTargetActor) ? Theme.ListItemActive : Theme.ListItem); if (GUILayout.Button(text2, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) })) { _mxAhgTargetActor = mxAhgRow.ActorNumber; } } if (!flag && rows.Count > 0) { _mxAhgTargetActor = rows[0].ActorNumber; } } MxAhgRow selected = null; for (int num2 = 0; num2 < rows.Count; num2++) { if (rows[num2].ActorNumber == _mxAhgTargetActor) { selected = rows[num2]; break; } } if (selected != null) { GUILayout.Space(6f); GUILayout.Label(selected.PlayerName + " — " + selected.StatusText(Localization.Current), Theme.Section, Array.Empty()); GUILayout.Label("MX-AHG " + (string.IsNullOrWhiteSpace(selected.AgentVersion) ? "--" : selected.AgentVersion) + " | " + Tx("подпись ", "signature ", "签名 ", "簽名 ") + (string.IsNullOrWhiteSpace(selected.DeclaredSignature) ? "--" : selected.DeclaredSignature) + $" ({selected.DeclaredFileCount} DLL)", Theme.LabelDim, Array.Empty()); DrawActionTiles(new ActionTileSpec(Tx("Перепроверить", "Recheck", "重新检查", "重新檢查"), Tx("Запрашивает новый полный отчёт только у этого игрока.", "Requests a fresh full report from this player.", "仅向该玩家请求新的完整报告。", "僅向該玩家請求新的完整報告。"), delegate { MxAhgHost.RequestReport(selected.ActorNumber); }), new ActionTileSpec(selected.Trusted ? Tx("Снять доверие", "Remove trust", "取消信任", "取消信任") : Tx("Доверить", "Trust", "信任", "信任"), Tx("Временное исключение действует только до выхода из текущей комнаты.", "The temporary exception lasts only until leaving the current room.", "临时例外仅持续到离开当前房间。", "臨時例外僅持續到離開目前房間。"), delegate { MxAhgHost.SetTrusted(selected.ActorNumber, !selected.Trusted); }, (!selected.Trusted) ? 1 : 2), new ActionTileSpec(Tx("Копировать всё", "Copy all", "复制全部", "複製全部"), Tx("Копирует полный MX-AHG отчёт.", "Copies the complete MX-AHG report.", "复制完整 MX-AHG 报告。", "複製完整 MX-AHG 報告。"), delegate { GUIUtility.systemCopyBuffer = MxAhgHost.BuildReport(Localization.Current); }), new ActionTileSpec(Tx("Кикнуть", "Kick", "踢出", "踢出"), Tx("Кикает выбранного игрока с причиной MX-AHG.", "Kicks the selected player with an MX-AHG reason.", "以 MX-AHG 原因踢出所选玩家。", "以 MX-AHG 原因踢出所選玩家。"), delegate { MxAhgHost.Kick(selected.ActorNumber); }, 2)); if (!string.IsNullOrWhiteSpace(selected.InvalidReason)) { GUILayout.Label(Tx("Ошибка отчёта: ", "Report error: ", "报告错误: ", "報告錯誤: ") + selected.InvalidReason, Theme.DonateText, Array.Empty()); } DrawMxAhgList(Tx("Отсутствует", "Missing", "缺少", "缺少"), selected.Missing); DrawMxAhgList(Tx("Лишнее", "Extra", "额外", "額外"), selected.Extra); DrawMxAhgList(Tx("Изменено", "Changed", "已更改", "已更改"), selected.Changed); DrawMxAhgList("Harmony", selected.PatchDifferences); DrawMxAhgList(Tx("Подозрительное", "Suspicious", "可疑", "可疑"), selected.SuspiciousFindings); } } private static void DrawMxAhgList(string title, IReadOnlyList values) { if (values != null && values.Count != 0) { GUILayout.Label(title + ":", Theme.LabelDim, Array.Empty()); int num = Mathf.Min(values.Count, 20); for (int i = 0; i < num; i++) { GUILayout.Label("- " + values[i], Theme.LabelDim, Array.Empty()); } if (values.Count > num) { GUILayout.Label("+" + (values.Count - num), Theme.LabelDim, Array.Empty()); } } } private static void DrawAdminPlayerRow(int index) { Character val = ((index >= 0 && index < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[index] : null); if (!((Object)(object)val == (Object)null)) { bool flag = GameApi.IsDead(val); bool flag2 = false; try { flag2 = val.IsLocal; } catch { } string text = ((index < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[index] : GameApi.PlayerDisplayName(val)); string text2 = ((!flag) ? (Ru ? "[жив] " : "[alive] ") : (Ru ? "[мёртв] " : "[dead] ")) + text + ((!flag2) ? "" : (Ru ? " (ты)" : " (you)")); float num = GameApi.DistanceToLocal(val); if (!flag2 && num >= 0f) { text2 = text2 + " " + num.ToString("0") + "m"; } string text3 = GameApi.PlayerModVersion(val); if (!string.IsNullOrWhiteSpace(text3)) { text2 = text2 + " MX " + text3; } GUIStyle val2 = ((_adminTarget == index) ? Theme.ListItemActive : (flag ? Theme.DangerBtn : Theme.ListItem)); if (GUILayout.Button(text2, val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _adminTarget = index; } TipLast(GameApi.PlayerDetails(val, Ru)); } } private static void DrawAdminSelectedPlayer(Character c) { GUILayout.Space(6f); GUILayout.Label((Ru ? "Выбран: " : "Selected: ") + GameApi.PlayerDisplayName(c), Theme.Section, Array.Empty()); GUILayout.Label(GameApi.PlayerDetails(c, Ru), Theme.LabelDim, Array.Empty()); bool local = false; try { local = c.IsLocal; } catch { } if (string.IsNullOrWhiteSpace(_nicknameInput)) { _nicknameInput = GameApi.LocalNickname(); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Ник:" : "Nick:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _nicknameInput = GUILayout.TextField(_nicknameInput ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }); if (GUILayout.Button(Ru ? "Сменить" : "Set", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(88f), GUILayout.Height(28f) })) { GameApi.SetLocalNickname(_nicknameInput); } GUILayout.EndHorizontal(); TipLast(Ru ? "Меняет твой отображаемый Photon-ник. SteamID не меняется." : "Changes your displayed Photon nickname. SteamID is unchanged."); bool flag = GameApi.IsFrozen(c); bool flag2 = GameApi.IsMuted(c); bool flag3 = GameApi.IsInventoryLocked(c); bool voiceForced = VoiceControl.IsActorForced(c); bool flag4 = GameApi.IsSessionBanned(c); DrawActionTiles(AdminTile(Ru ? "Скопировать вид" : "Clone look", Ru ? "Копирует одежду, цвет и косметику выбранного игрока на тебя." : "Copies the selected player's outfit, color, and cosmetics onto you.", delegate { GameApi.CloneLocalAppearanceFrom(c, includeNickname: false); }), AdminTile(Ru ? "Клон + ник" : "Clone + nick", Ru ? "Копирует внешний вид выбранного игрока и ставит тебе такой же отображаемый ник." : "Copies the selected player's appearance and applies the same displayed nickname to you.", delegate { GameApi.CloneLocalAppearanceFrom(c, includeNickname: true); }), AdminTile(Ru ? "Телепорт к нему" : "Teleport to", Ru ? "Переместиться к выбранному игроку." : "Move yourself to the selected player.", delegate { GameApi.WarpToPlayer(c); }), AdminTile(Ru ? "К себе" : "Bring to me", Ru ? "Притянуть выбранного игрока к тебе." : "Bring the selected player to you.", delegate { GameApi.BringPlayer(c); }), AdminTile(Ru ? "На спавн" : "To spawn", Ru ? "Отправить выбранного игрока на его точку спавна." : "Send the selected player to their spawn point.", delegate { GameApi.WarpPlayerToSpawn(c); }), AdminTile(Ru ? "Анти-застр." : "Anti-stuck", Ru ? "Сбросить скорость/падение и поднять выбранного игрока вверх." : "Reset velocity/fall state and lift the selected player up.", delegate { GameApi.AntiStuck(c); })); DrawActionTiles(AdminTile(Ru ? "Найти" : "Find", Ru ? "Включить ESP игроков и выделить выбранного игрока линией." : "Enable player ESP and highlight the selected player with a line.", delegate { PlayerEsp.Focus(c); }, 1), AdminTile(Ru ? "Снять поиск" : "Clear find", Ru ? "Убрать выделение выбранного игрока в ESP." : "Clear the player ESP focus.", delegate { PlayerEsp.ClearFocus(); }), AdminTile(Ru ? "Убить" : "Kill", Ru ? "Убить выбранного игрока." : "Kill the selected player.", delegate { GameApi.KillPlayer(c); }, 2), AdminTile(Ru ? "Воскресить" : "Revive", Ru ? "Воскресить выбранного игрока." : "Revive the selected player.", delegate { GameApi.RevivePlayer(c); }), AdminTile(Ru ? "Оживить тут" : "Revive here", Ru ? "Воскресить выбранного игрока рядом с тобой." : "Revive the selected player near you.", delegate { GameApi.RevivePlayerHere(c); }), AdminTile(Ru ? "Скаут" : "Scoutmaster", Ru ? "Призвать скаутмастера рядом с выбранным игроком. Работает у хоста." : "Spawn a Scoutmaster near the selected player. Host only.", delegate { GameApi.SpawnScoutmaster(c); })); DrawActionTiles(AdminTile((!flag) ? (Ru ? "Фриз: выкл" : "Freeze: off") : (Ru ? "Фриз: вкл" : "Freeze: on"), Ru ? "Первое нажатие замораживает, второе снимает фриз." : "First click freezes, second click unfreezes.", delegate { GameApi.ToggleFreeze(c); }, flag ? 2 : 0), AdminTile((!flag2) ? (Ru ? "Мут: выкл" : "Mute: off") : (Ru ? "Мут: вкл" : "Mute: on"), (!local) ? (Ru ? "Переключить мут выбранного игрока через сетевое свойство Photon." : "Toggle this player's mute state through Photon properties.") : (Ru ? "Мут на себя может игнорироваться игрой/Photon. Эта кнопка в основном для других игроков." : "Self mute may be ignored by the game/Photon. This is mainly for other players."), delegate { if (local) { GameApi.AddAdminLog(Ru ? "Мут на себя: игра может игнорировать действие" : "Self mute: game may ignore it"); } GameApi.ToggleMute(c); }, flag2 ? 2 : 0), AdminTile((!flag3) ? (Ru ? "Инвентарь: можно" : "Inventory: allowed") : (Ru ? "Инвентарь: запрет" : "Inventory: locked"), Ru ? "Запрещает цель держать предметы: найденные предметы будут выкидываться." : "Prevents the target from keeping items by dropping them repeatedly.", delegate { GameApi.ToggleInventoryLock(c); }, flag3 ? 2 : 0), AdminTile((!voiceForced) ? (Ru ? "Слышно всем" : "Hear target") : (Ru ? "Слышимость: вкл" : "Voice: global"), (!voiceForced) ? (Ru ? "Отправить клиентам с PEAK-MX команду: выбранного игрока слышно на всей карте без эха." : "Tell PEAK-MX clients to hear the selected player across the map without echo.") : (Ru ? "Снять сетевую команду: выбранного игрока больше не форсируем как слышимого на всей карте." : "Remove the network command: the selected player is no longer forced audible across the map."), delegate { VoiceControl.BroadcastHearActor(c, !voiceForced); }, voiceForced ? 2 : 0), AdminTile((!VoiceControl.ForceAllActors) ? (Ru ? "Слышно всех" : "Hear everyone") : (Ru ? "Все слышны: вкл" : "All voices: on"), Ru ? "Переключить сетевой режим: у клиентов с PEAK-MX все игроки слышны на всей карте без эха." : "Toggle the network mode: PEAK-MX clients hear every player across the map without echo.", delegate { VoiceControl.BroadcastHearAll(!VoiceControl.ForceAllActors); }, VoiceControl.ForceAllActors ? 2 : 0), AdminTile(Ru ? "Кикнуть" : "Kick", Ru ? "Попробовать кикнуть игрока из текущей комнаты." : "Try to kick this player from the current room.", delegate { GameApi.KickPlayer(c); }, 2), AdminTile((!flag4) ? (Ru ? "Бан: выкл" : "Ban: off") : (Ru ? "Бан: вкл" : "Ban: on"), (!local) ? (Ru ? "Сессионный бан: игрок будет снова кикнут при входе в эту комнату, если твой клиент может применить действие." : "Session ban: the player is kicked again if they rejoin, if your client can apply the action.") : (Ru ? "Сессионный бан нужен для других игроков. Самого себя игра обычно не кикает." : "Session ban is for other players. The game usually does not kick yourself."), delegate { if (local) { GameApi.AddAdminLog(Ru ? "Бан на себя: добавлен в список, самокик может игнорироваться" : "Self ban: listed, self-kick may be ignored"); } GameApi.ToggleSessionBan(c); }, flag4 ? 2 : 0)); if (local) { GUILayout.Label(Ru ? "Кик, мут и бан предназначены для других игроков. На себе они могут выглядеть как бездействие." : "Kick, mute, and ban are meant for other players. On yourself they can look like no-op actions.", Theme.LabelDim, Array.Empty()); } if (!GameApi.IsHost()) { GUILayout.Label(Ru ? "Если игра отклонит сетевое действие без прав хоста, оно просто не применится." : "If the game rejects a network action without host authority, it will simply not apply.", Theme.LabelDim, Array.Empty()); } } private static bool AdminActionButton(string label, string tip, GUIStyle style = null) { bool num = GUILayout.Button(label, style ?? Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); TipLast(tip); if (num) { GameApi.AddAdminLog("action: " + label); } return num; } private static ActionTileSpec AdminTile(string label, string tip, Action run, int style = 0) { return new ActionTileSpec(label, tip, delegate { GameApi.AddAdminLog("action: " + label); run?.Invoke(); }, style); } private static bool ToggleCompact(string label, bool value) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(160f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(178f), GUILayout.Height(30f) }); if (GUI.Button(rect, GUIContent.none, GUIStyle.none)) { value = !value; } GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 54f, ((Rect)(ref rect)).height), label, Theme.LabelDim); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).xMax - 48f, ((Rect)(ref rect)).y + 3f, 46f, 24f); GUI.Box(val, GUIContent.none, value ? Theme.SwitchOn : Theme.SwitchOff); float num = 18f; float num2 = (value ? (((Rect)(ref val)).xMax - num - 3f) : (((Rect)(ref val)).x + 3f)); if ((Object)(object)Theme.KnobTex != (Object)null) { GUI.DrawTexture(new Rect(num2, ((Rect)(ref val)).y + 3f, num, num), (Texture)(object)Theme.KnobTex); } return value; } private static Vector2 BeginVerticalScroll(Vector2 scroll, params GUILayoutOption[] options) { //IL_000c: 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) scroll.x = 0f; return GUILayout.BeginScrollView(scroll, GUIStyle.none, GUI.skin.verticalScrollbar, options); } private static int TileColumns(float minTileWidth = 150f) { return Mathf.Clamp(Mathf.FloorToInt((Mathf.Max(280f, (((Rect)(ref _contentRect)).width > 0f) ? (((Rect)(ref _contentRect)).width - 52f) : 620f) + 8f) / Mathf.Max(72f, minTileWidth + 8f)), 1, 10); } private static float TileWidth(int columns, float gap = 8f) { return Mathf.Floor((Mathf.Max(280f, (((Rect)(ref _contentRect)).width > 0f) ? (((Rect)(ref _contentRect)).width - 52f) : 620f) - gap * (float)Mathf.Max(0, columns - 1)) / (float)Mathf.Max(1, columns)); } private static void DrawToggleTiles(params ToggleTileSpec[] specs) { int num = TileColumns(); float num2 = TileWidth(num); for (int i = 0; i < specs.Length; i += num) { GUILayout.BeginHorizontal(Array.Empty()); for (int j = 0; j < num; j++) { int num3 = i + j; if (num3 >= specs.Length) { GUILayout.Space(num2); continue; } ToggleTileSpec toggleTileSpec = specs[num3]; bool flag = toggleTileSpec.Get != null && toggleTileSpec.Get(); bool enabled = GUI.enabled; GUI.enabled = enabled && toggleTileSpec.Enabled; bool num4 = DrawTile(toggleTileSpec.Label, toggleTileSpec.Tip, flag, num2, 52f, flag ? Theme.ToggleOn : Theme.Toggle); GUI.enabled = enabled; if (num4) { toggleTileSpec.Set?.Invoke(!flag); } if (j < num - 1) { GUILayout.Space(8f); } } GUILayout.EndHorizontal(); GUILayout.Space(6f); } } private static void DrawActionTiles(params ActionTileSpec[] specs) { int num = TileColumns(); float num2 = TileWidth(num); for (int i = 0; i < specs.Length; i += num) { GUILayout.BeginHorizontal(Array.Empty()); for (int j = 0; j < num; j++) { int num3 = i + j; if (num3 >= specs.Length) { GUILayout.Space(num2); continue; } ActionTileSpec actionTileSpec = specs[num3]; GUIStyle style = ((actionTileSpec.Style == 2) ? Theme.DangerBtn : ((actionTileSpec.Style == 1) ? Theme.DonateBtn : Theme.LinkBtn)); if (DrawTile(actionTileSpec.Label, actionTileSpec.Tip, active: false, num2, 42f, style)) { actionTileSpec.Run?.Invoke(); } if (j < num - 1) { GUILayout.Space(8f); } } GUILayout.EndHorizontal(); GUILayout.Space(6f); } } private static bool DrawTile(string label, string tip, bool active, float width, float height, GUIStyle style) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_003a: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(width, height, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) }); bool result = GUI.Button(rect, new GUIContent(label, tip ?? ""), style); if (Event.current != null && ((Rect)(ref rect)).Contains(Event.current.mousePosition) && !string.IsNullOrWhiteSpace(tip)) { _hoverTip = tip; } return result; } private static void DrawChipBar(ref int selected, string[] labels, string[] tips = null) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) int num = TileColumns(104f); float num2 = TileWidth(num); for (int i = 0; i < labels.Length; i += num) { GUILayout.BeginHorizontal(Array.Empty()); for (int j = 0; j < num; j++) { int num3 = i + j; if (num3 >= labels.Length) { GUILayout.Space(num2); continue; } bool flag = selected == num3; if (GUILayout.Button(labels[num3], flag ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(num2), GUILayout.Height(30f) })) { selected = num3; } if (Event.current != null) { Rect lastRect = GUILayoutUtility.GetLastRect(); if (((Rect)(ref lastRect)).Contains(Event.current.mousePosition) && tips != null && num3 < tips.Length) { _hoverTip = tips[num3]; } } if (j < num - 1) { GUILayout.Space(8f); } } GUILayout.EndHorizontal(); GUILayout.Space(4f); } } private static void DrawStatusIncreaseButtons(Character target) { GUILayout.Space(4f); GUILayout.Label(Ru ? "Быстрое увеличение недугов" : "Quick status increases", Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Ru ? "Увеличить основные недуги" : "Increase common statuses", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.IncreaseCommonStatuses(target, ModConfig.StatusIncreasePercent / 100f); } DrawStatusIncreaseRow(target, 0, Ru ? "Травма %" : "Injury %", ref ModConfig.InjuryIncreasePercent); DrawStatusIncreaseRow(target, 1, Ru ? "Голод %" : "Hunger %", ref ModConfig.HungerIncreasePercent); DrawStatusIncreaseRow(target, 2, Ru ? "Холод %" : "Cold %", ref ModConfig.ColdIncreasePercent); DrawStatusIncreaseRow(target, 3, Ru ? "Яд %" : "Poison %", ref ModConfig.PoisonIncreasePercent); DrawStatusIncreaseRow(target, 4, Ru ? "Краб %" : "Crab %", ref ModConfig.CrabIncreasePercent); DrawStatusIncreaseRow(target, 5, Ru ? "Проклятие %" : "Curse %", ref ModConfig.CurseIncreasePercent); DrawStatusIncreaseRow(target, 6, Ru ? "Сонливость %" : "Drowsy %", ref ModConfig.DrowsyIncreasePercent); DrawStatusIncreaseRow(target, 8, Ru ? "Жара %" : "Hot %", ref ModConfig.HotIncreasePercent); DrawStatusIncreaseRow(target, 9, Ru ? "Шипы %" : "Thorns %", ref ModConfig.ThornsIncreasePercent); DrawStatusIncreaseRow(target, 10, Ru ? "Споры %" : "Spores %", ref ModConfig.SporesIncreasePercent); DrawStatusIncreaseRow(target, 11, Ru ? "Паутина %" : "Web %", ref ModConfig.WebIncreasePercent); DrawStatusIncreaseRow(target, 12, Ru ? "Стрелы %" : "Arrows %", ref ModConfig.ArrowsIncreasePercent); DrawStatusIncreaseRow(target, 13, Ru ? "Окаменение %" : "Petrify %", ref ModConfig.PetrifyIncreasePercent); DrawStatusIncreaseRow(target, 14, Ru ? "Мухоловка %" : "Flytrap %", ref ModConfig.FlyTrapIncreasePercent); } private static void DrawStatusIncreaseRow(Character target, int statusIndex, string label, ref float percent) { percent = NumberField(label, percent, 0f, 100f); string[] array = (Ru ? GameApi.StatusRu : GameApi.StatusEn); string text = ((statusIndex >= 0 && statusIndex < array.Length) ? array[statusIndex] : statusIndex.ToString()); if (GUILayout.Button("+ " + text, Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(28f), GUILayout.ExpandWidth(true) })) { GameApi.IncreaseStatus(target, statusIndex, percent / 100f); } TipLast(Ru ? "Прибавить этот недуг выбранной цели." : "Increase this status on the selected target."); } private static void DrawInventoryModern3() { //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) if (BeginSection("inventory.spawn3", Ru ? "Инвентарь и предметы" : "Inventory & items", defaultOpen: true)) { GameApi.EnsureItemsLoaded(); if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } Character val = InventoryTargetPicker(); int num = (((Object)(object)val != (Object)null) ? GameApi.SlotCountFor(val) : GameApi.SlotCount()); if (num <= 0) { num = 3; } if (_selSlot >= num) { _selSlot = Mathf.Max(0, num - 1); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int i = 0; i < num; i++) { if (GUILayout.Button((i + 1).ToString(), (_selSlot == i) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(30f) })) { _selSlot = i; } } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Содержимое слотов" : "Slot contents", Theme.LabelDim, Array.Empty()); for (int j = 0; j < num; j++) { GUILayout.Label($"{j + 1}. {GameApi.DescribeSlot(val, j)}", Theme.LabelDim, Array.Empty()); } GUILayout.Label((Ru ? "На спине: " : "Back slot: ") + GameApi.DescribeBackSlot(val), Theme.LabelDim, Array.Empty()); GUILayout.Label((Ru ? "Амулет/временный: " : "Amulet/temp: ") + GameApi.DescribeTempSlot(val), Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Предметов: " : "Items: ") + GameApi.ItemNames.Count, Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Ru ? "Перезагрузить список" : "Reload list", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.LoadItems(); } TipLast(Ru ? "Заново собрать список предметов из игровых ресурсов." : "Reload the item list from game resources."); GUILayout.EndHorizontal(); _itemSearch = GUILayout.TextField(_itemSearch ?? "", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }); DrawItemFavoriteControls(); _itemScroll = BeginVerticalScroll(_itemScroll, GUILayout.Height(170f)); string text = (_itemSearch ?? "").Trim().ToLowerInvariant(); for (int k = 0; k < GameApi.ItemNames.Count; k++) { string text2 = GameApi.ItemNames[k]; if ((!_itemFavoritesOnly || IsFavoriteItem(k)) && (text.Length <= 0 || text2.ToLowerInvariant().IndexOf(text) >= 0) && DrawItemListRow(k, text2, _selItem == k)) { _selItem = k; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Заспавнить в слот" : "Spawn to slot", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }) && _selItem >= 0) { GameApi.SpawnToSlotFor(val, _selItem, _selSlot); } TipLast(Ru ? "Положить выбранный предмет в выбранный основной слот цели." : "Put the selected item into the selected main slot."); if (GUILayout.Button(Ru ? "Очистить слот" : "Clear slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(34f) })) { GameApi.ClearSlotFor(val, _selSlot); } TipLast(Ru ? "Очистить выбранный основной слот цели." : "Clear the selected main slot."); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Во все слоты" : "Spawn to all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }) && _selItem >= 0) { GameApi.FillInventoryWith(val, _selItem); } TipLast(Ru ? "Положить выбранный предмет во все основные слоты и рюкзак цели." : "Put the selected item into every main slot and backpack slot."); if (GUILayout.Button(Ru ? "Очистить всё" : "Clear all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ClearInventory(val); } TipLast(Ru ? "Очистить все основные слоты и рюкзак выбранной цели." : "Clear all main slots and backpack slots for the selected target."); GUILayout.EndHorizontal(); if (_selItem >= 0 && _selItem < GameApi.ItemNames.Count) { GUILayout.Label((Ru ? "Выбрано: " : "Selected: ") + GameApi.ItemNames[_selItem], Theme.LabelDim, Array.Empty()); } if ((Object)(object)val != (Object)null) { GUILayout.Label((Ru ? "Смотришь и редактируешь инвентарь игрока: " : "Viewing and editing player's inventory: ") + ((_invTarget < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[_invTarget] : "?"), Theme.LabelDim, Array.Empty()); } GUILayout.Space(4f); GUILayout.Label(Ru ? "Быстрые наборы" : "Quick item sets", Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Еда" : "Food", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnItemSet(val, "food"); } TipLast(Ru ? "Заполнить несколько слотов случайной едой." : "Fill several slots with random food."); if (GUILayout.Button(Ru ? "Спасение" : "Rescue", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnItemSet(val, "rescue"); } TipLast(Ru ? "Попробовать выдать веревку, лечение и источник света." : "Try to give rope, healing and a light source."); if (GUILayout.Button(Ru ? "Свет" : "Light", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnItemSet(val, "light"); } TipLast(Ru ? "Попробовать выдать фонарь/факел/топливо." : "Try to give lantern/torch/fuel."); if (GUILayout.Button(Ru ? "Мобильность" : "Mobility", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnItemSet(val, "mobility"); } TipLast(Ru ? "Попробовать выдать предмет на спину и средства передвижения." : "Try to give a back item and movement tools."); GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("inventory.special3", Ru ? "Слот на спине и амулет" : "Back slot & amulet", defaultOpen: false)) { Character val2 = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.Label(Ru ? "Новые предметы на спине используют отдельный слот игры. Амулеты и переполненный предмет используют временный слот 250." : "New back items use the game's back slot. Amulets and overflow items use temporary slot 250.", Theme.LabelDim, Array.Empty()); GUILayout.Label((Ru ? "На спине: " : "Back slot: ") + GameApi.DescribeBackSlot(val2), Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Надеть на спину" : "Equip back item", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }) && _selItem >= 0) { GameApi.SpawnToBackSlotFor(val2, _selItem); } TipLast(Ru ? "Работает с Backpack, Fannypack, Jetpack и Rocketpack из списка предметов." : "Works with Backpack, Fannypack, Jetpack and Rocketpack from the item list."); if (GUILayout.Button(Ru ? "Снять" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(30f) })) { GameApi.ClearBackSlotFor(val2); } TipLast(Ru ? "Очищает предмет на спине." : "Clears the equipped back item."); GUILayout.EndHorizontal(); GUILayout.Label((Ru ? "Амулет/временный: " : "Amulet/temp: ") + GameApi.DescribeTempSlot(val2), Theme.LabelDim, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "В слот 250" : "To slot 250", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }) && _selItem >= 0) { GameApi.SpawnToTempSlotFor(val2, _selItem); } TipLast(Ru ? "Подходит для амулетов и обычных предметов, которые игра держит во временном слоте." : "For amulets and regular items the game stores in the temporary slot."); if (GUILayout.Button(Ru ? "Очистить" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(30f) })) { GameApi.ClearTempSlotFor(val2); } TipLast(Ru ? "Очищает временный слот 250." : "Clears temporary slot 250."); GUILayout.EndHorizontal(); EndSection(); } if (BeginSection("inventory.backpack3", Ru ? "Рюкзак" : "Backpack", defaultOpen: false)) { Character val3 = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); GUILayout.Label(Ru ? "Ячейки рюкзака доступны только у предметов со встроенным хранилищем." : "Backpack slots are available only on back items with internal storage.", Theme.LabelDim, Array.Empty()); int num2 = GameApi.BackpackSlotCount(val3); if (num2 <= 0) { GUILayout.Label(Ru ? "Рюкзак не надет или ещё не синхронизирован." : "No backpack equipped or not synced yet.", Theme.LabelDim, Array.Empty()); } else { if (_selBackpackSlot >= num2) { _selBackpackSlot = Mathf.Max(0, num2 - 1); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int l = 0; l < num2; l++) { if (GUILayout.Button((l + 1).ToString(), (_selBackpackSlot == l) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(28f) })) { _selBackpackSlot = l; } } GUILayout.EndHorizontal(); for (int m = 0; m < num2; m++) { GUILayout.Label($"B{m + 1}. {GameApi.DescribeBackpackSlot(val3, m)}", Theme.LabelDim, Array.Empty()); } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "В рюкзак" : "To backpack", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }) && _selItem >= 0) { GameApi.SpawnToBackpackSlotFor(val3, _selItem, _selBackpackSlot); } TipLast(Ru ? "Положить выбранный предмет в выбранную ячейку рюкзака." : "Put the selected item into the selected backpack slot."); if (GUILayout.Button(Ru ? "Очистить" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(30f) })) { GameApi.ClearBackpackSlotFor(val3, _selBackpackSlot); } TipLast(Ru ? "Очистить выбранную ячейку рюкзака." : "Clear the selected backpack slot."); GUILayout.EndHorizontal(); } EndSection(); } if (!BeginSection("inventory.recharge3", Ru ? "Перезарядка предметов" : "Item recharge", defaultOpen: false)) { return; } Character val4 = ((_invTarget >= 0 && _invTarget < GameApi.PlayerChars.Count) ? GameApi.PlayerChars[_invTarget] : null); int num3 = (((Object)(object)val4 != (Object)null) ? GameApi.SlotCountFor(val4) : GameApi.SlotCount()); if (num3 <= 0) { num3 = 3; } ModConfig.UnlimitedItemUses = ToggleRaw(Ru ? "Бесконечные использования предметов" : "Unlimited item uses", Ru ? "Не даёт предметам тратить количество использований." : "Prevents items from spending their use count.", ModConfig.UnlimitedItemUses); ModConfig.InfiniteItems = ToggleRaw(Ru ? "Автоперезарядка предметов" : "Auto recharge items", Ru ? "Периодически выставляет заряд/прочность предметов в слотах на значение ниже." : "Periodically sets charge/durability in slots to the value below.", ModConfig.InfiniteItems); ModConfig.UnlimitedLanternFuel = ToggleRaw(Ru ? "Бесконечное топливо фонаря" : "Unlimited lantern fuel", Ru ? "Фонари не расходуют топливо и держатся заполненными." : "Lanterns do not spend fuel and stay filled.", ModConfig.UnlimitedLanternFuel); if (!ModConfig.UnlimitedLanternFuel) { ModConfig.LanternFuelConsumptionPercent = Slider(Ru ? "Расход топлива фонаря %" : "Lantern fuel cost %", ModConfig.LanternFuelConsumptionPercent, 0f, 300f); } ModConfig.RechargeValue = NumberField(Ru ? "Заряд" : "Charge", ModConfig.RechargeValue, 0f, 999f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Слот:" : "Slot:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); for (int n = 0; n < num3; n++) { if (GUILayout.Button((n + 1).ToString(), (_selSlot == n) ? Theme.ChipActive : Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(28f) })) { _selSlot = n; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить выбранный" : "Recharge selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeSlotFor(val4, _selSlot, ModConfig.RechargeValue); } TipLast(Ru ? "Выставить заряд/прочность выбранного основного слота." : "Set charge/durability for the selected main slot."); if (GUILayout.Button(Ru ? "Зарядить все" : "Recharge all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int num4 = 0; num4 < num3; num4++) { GameApi.RechargeSlotFor(val4, num4, ModConfig.RechargeValue); } } TipLast(Ru ? "Выставить заряд/прочность всех основных слотов." : "Set charge/durability for all main slots."); GUILayout.EndHorizontal(); int num5 = GameApi.BackpackSlotCount(val4); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить предмет на спине" : "Recharge back item", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeBackSlotFor(val4, ModConfig.RechargeValue); } TipLast(Ru ? "Выставить заряд/прочность предмета на спине, если у него есть такие данные." : "Set charge/durability for the equipped back item if it has those data."); if (GUILayout.Button(Ru ? "Зарядить амулет" : "Recharge amulet", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { GameApi.RechargeTempSlotFor(val4, ModConfig.RechargeValue); } TipLast(Ru ? "Выставить заряд/прочность временного слота 250." : "Set charge/durability for temporary slot 250."); GUILayout.EndHorizontal(); if (num5 > 0) { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Зарядить слот рюкзака" : "Recharge backpack slot", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.RechargeBackpackSlotFor(val4, _selBackpackSlot, ModConfig.RechargeValue); } TipLast(Ru ? "Выставить заряд/прочность выбранной ячейки рюкзака." : "Set charge/durability for the selected backpack slot."); if (GUILayout.Button(Ru ? "Весь рюкзак" : "All backpack", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(130f), GUILayout.Height(30f) })) { for (int num6 = 0; num6 < num5; num6++) { GameApi.RechargeBackpackSlotFor(val4, num6, ModConfig.RechargeValue); } } TipLast(Ru ? "Выставить заряд/прочность всех предметов в рюкзаке." : "Set charge/durability for every backpack item."); GUILayout.EndHorizontal(); } EndSection(); } private static void DrawWorldModern() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) float num = GameApi.ExpeditionTimeSeconds(); float timeOfDayNow = GameApi.TimeOfDay(); int num2 = GameApi.DayCount(); if ((int)Event.current.type == 7) { SyncTimeOfDayInput(timeOfDayNow); } if (BeginSection("world.time", Ru ? "Время и забег" : "Time & run", defaultOpen: true)) { GUILayout.Label((Ru ? "Время забега: " : "Run time: ") + FormatRunTime(num), Theme.LabelDim, Array.Empty()); GUILayout.Label((Ru ? "День: " : "Day: ") + num2 + " " + (Ru ? "Час: " : "Hour: ") + timeOfDayNow.ToString("0.0"), Theme.LabelDim, Array.Empty()); bool flag = Toggle(Ru ? "Держать время забега" : "Hold run timer", ModConfig.OverrideExpeditionTime); if (flag != ModConfig.OverrideExpeditionTime) { if (flag && num > 0.01f) { ModConfig.ExpeditionTimeSeconds = num; SetNumberText(Ru ? "Секунды забега" : "Run seconds", 0f, 7200f, ModConfig.ExpeditionTimeSeconds); GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } ModConfig.OverrideExpeditionTime = flag; } ModConfig.ExpeditionTimeSeconds = NumberField(Ru ? "Секунды забега" : "Run seconds", ModConfig.ExpeditionTimeSeconds, 0f, 7200f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "-60 сек" : "-60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds = Mathf.Max(0f, ModConfig.ExpeditionTimeSeconds - 60f); GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } TipLast(Ru ? "Уменьшить удерживаемое время забега на минуту." : "Decrease the held run time by one minute."); if (GUILayout.Button(Ru ? "Применить" : "Apply", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } TipLast(Ru ? "Применить указанное время забега сейчас." : "Apply the entered run time now."); if (GUILayout.Button(Ru ? "+60 сек" : "+60 sec", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { ModConfig.ExpeditionTimeSeconds += 60f; GameApi.SetExpeditionTime(ModConfig.ExpeditionTimeSeconds); } TipLast(Ru ? "Увеличить удерживаемое время забега на минуту." : "Increase the held run time by one minute."); GUILayout.EndHorizontal(); float num3 = NumberField(TimeOfDayLabel(), _timeOfDay, 0f, 24f); if (Mathf.Abs(num3 - _timeOfDay) > 0.001f) { _timeOfDay = num3; _timePreset = PresetForHour(_timeOfDay); _timeOfDayDirty = true; } GUILayout.BeginHorizontal(Array.Empty()); TimePresetButton(Ru ? "Рассвет" : "Dawn", 6f, 0, Ru ? "Выбрать рассвет. Применится после кнопки ниже." : "Choose dawn. Applies after the button below."); TimePresetButton(Ru ? "День" : "Day", 12f, 1, Ru ? "Выбрать день. Применится после кнопки ниже." : "Choose daytime. Applies after the button below."); TimePresetButton(Ru ? "Закат" : "Dusk", 19f, 2, Ru ? "Выбрать закат. Применится после кнопки ниже." : "Choose dusk. Applies after the button below."); TimePresetButton(Ru ? "Ночь" : "Night", 23f, 3, Ru ? "Выбрать ночь. Применится после кнопки ниже." : "Choose night. Applies after the button below."); GUILayout.EndHorizontal(); if (GUILayout.Button(Ru ? "Применить время суток" : "Apply time of day", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ApplySelectedTimeOfDay(); } TipLast(Ru ? "Применить указанное время суток." : "Apply the entered time of day."); EndSection(); } if (BeginSection("world.modifiers", Ru ? "Модификаторы мира" : "World modifiers", defaultOpen: false)) { ModConfig.GameSpeedMod = ToggleRaw(Ru ? "Скорость игры" : "Game speed", Ru ? "Меняет общий Time.timeScale игры. Используй аккуратно." : "Changes the game's global Time.timeScale. Use with care.", ModConfig.GameSpeedMod); if (ModConfig.GameSpeedMod) { ModConfig.GameSpeed = Slider("x", ModConfig.GameSpeed, 0.05f, 5f); } ModConfig.PingHandSizeMultiplier = Slider(Ru ? "Размер руки пинга" : "Ping hand size", ModConfig.PingHandSizeMultiplier, 0.1f, 10f); EndSection(); } DrawWorldNavigationTools(); if (BeginSection("world.finish", Ru ? "Финиш" : "Finish", defaultOpen: false)) { GUILayout.Label(Ru ? "Мгновенно завершает текущий забег победой." : "Instantly ends the current run as a win.", Theme.LabelDim, Array.Empty()); if (GUILayout.Button(Ru ? "Мгновенно пройти" : "Force win", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { GameApi.ForceWin(); } EndSection(); } if (!BeginSection("world.luggage", Ru ? "Контейнеры рядом" : "Nearby containers", defaultOpen: false)) { return; } GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Обновить (300 м)" : "Refresh (300 m)", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.RefreshLuggage(); _selLuggage = -1; } if (GUILayout.Button(Ru ? "Открыть все рядом" : "Open all nearby", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { GameApi.OpenAllNearbyLuggage(); } GUILayout.EndHorizontal(); if (GameApi.LuggageLabels.Count == 0) { GUILayout.Label(Ru ? "Список пуст — нажми «Обновить» во время забега." : "Empty — press Refresh during a run.", Theme.LabelDim, Array.Empty()); } else { _luggageScroll = BeginVerticalScroll(_luggageScroll, GUILayout.Height(150f)); for (int i = 0; i < GameApi.LuggageLabels.Count; i++) { if (GUILayout.Button(GameApi.LuggageLabels[i], (_selLuggage == i) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { _selLuggage = i; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Открыть выбранный" : "Open selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.OpenLuggage(_selLuggage); } if (GUILayout.Button(Ru ? "Телепорт к нему" : "Warp to it", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }) && _selLuggage >= 0) { GameApi.WarpToLuggage(_selLuggage); } GUILayout.EndHorizontal(); } EndSection(); } private static void DrawWorldNavigationTools() { //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) if (!BeginSection("world.navigation", Ru ? "Биомы и поиск объектов" : "Biomes & object finder", defaultOpen: false)) { return; } GUILayout.Label((Ru ? "Текущий сегмент: " : "Current segment: ") + GameApi.CurrentSegmentLabel(Ru), Theme.LabelDim, Array.Empty()); ActionTileSpec[] array = new ActionTileSpec[GameApi.SegmentCount]; for (int i = 0; i < GameApi.SegmentCount; i++) { int segmentIndex = i; string text = GameApi.SegmentLabel(segmentIndex, Ru); string text2 = GameApi.SegmentBiomeLabel(segmentIndex, Ru); if (!string.IsNullOrWhiteSpace(text2) && !string.Equals(text2, text, StringComparison.OrdinalIgnoreCase)) { text = text + " / " + text2; } array[i] = new ActionTileSpec(text, Ru ? "Перейти к выбранному сегменту через MapHandler игры." : "Jump to this segment through the game's MapHandler.", delegate { GameApi.WarpToSegmentIndex(segmentIndex); }); } DrawActionTiles(array); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Поиск:" : "Search:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _worldObjectSearch = GUILayout.TextField(_worldObjectSearch ?? "", Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }); GUILayout.EndHorizontal(); _worldObjectRange = NumberField(Ru ? "Радиус" : "Radius", _worldObjectRange, 50f, 5000f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Сканировать" : "Scan", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.RefreshWorldObjects(_worldObjectSearch, _worldObjectRange); _selWorldObject = -1; } TipLast(Ru ? "Ищет активные объекты по имени, типу компонента и названию предмета." : "Finds active objects by name, component type, and item name."); if (GUILayout.Button(Ru ? "Gloom/Bell" : "Gloom/Bell", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(28f) })) { _worldObjectSearch = "gloom bell belltower tower jester"; GameApi.RefreshWorldObjects(_worldObjectSearch, _worldObjectRange); _selWorldObject = -1; } if (GUILayout.Button(Ru ? "Предметы" : "Items", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(100f), GUILayout.Height(28f) })) { _worldObjectSearch = "item luggage chest container"; GameApi.RefreshWorldObjects(_worldObjectSearch, _worldObjectRange); _selWorldObject = -1; } GUILayout.EndHorizontal(); if (_selWorldObject >= GameApi.WorldObjectLabels.Count) { _selWorldObject = -1; } int count = GameApi.WorldObjectLabels.Count; GUILayout.Label((Ru ? "Найдено: " : "Found: ") + count, Theme.LabelDim, Array.Empty()); if (count > 0) { _worldObjectScroll = BeginVerticalScroll(_worldObjectScroll, GUILayout.Height(150f)); for (int num = 0; num < count; num++) { if (GUILayout.Button(GameApi.WorldObjectLabels[num], (_selWorldObject == num) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(30f), GUILayout.ExpandWidth(true) })) { _selWorldObject = num; } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Ru ? "Телепорт к выбранному" : "Warp to selected", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.WarpToWorldObject(_selWorldObject); } if (GUILayout.Button(Ru ? "В координаты" : "To coords", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(28f) })) { Vector3 val = GameApi.WorldObjectPosition(_selWorldObject); _tpX = val.x.ToString("0.##"); _tpY = (val.y + 2f).ToString("0.##"); _tpZ = val.z.ToString("0.##"); } GUILayout.EndHorizontal(); } EndSection(); } private static void DrawBadgesModern() { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Invalid comparison between Unknown and I4 //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) ACHIEVEMENTTYPE[] allTypes = SteamAch.AllTypes; int num = allTypes.Length; RefreshBadgeCache(force: false); int num2 = 0; for (int i = 0; i < num; i++) { if (_badgeUnlockedCache != null && i < _badgeUnlockedCache.Length && _badgeUnlockedCache[i]) { num2++; } } GUILayout.Label(L("tab.badges"), Theme.Section, Array.Empty()); GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label((Ru ? "Получено: " : "Unlocked: ") + num2 + " / " + num, Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button(Ru ? "Выдать все" : "Unlock all", Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SteamAch.UnlockAll(); RefreshBadgeCache(force: true); } if (GUILayout.Button(Ru ? "Отозвать все" : "Revoke all", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { SteamAch.RevokeAll(); RefreshBadgeCache(force: true); } GUILayout.EndHorizontal(); GUILayout.Label(Ru ? "Лёгкий список: маленькая иконка, название, статус и отдельная кнопка действия." : "Lightweight list: small icon, name, status, and a dedicated action button.", Theme.LabelDim, Array.Empty()); if ((Object)(object)_badgeTileBg == (Object)null) { _badgeTileBg = Theme.RoundedTex(Theme.Panel, 10); } if ((Object)(object)_badgeTileOn == (Object)null) { _badgeTileOn = Theme.RoundedTex(Theme.AccentDim, 10); } if ((Object)(object)_badgeTileOff == (Object)null) { _badgeTileOff = Theme.RoundedTex(Theme.PanelLight, 10); } if ((Object)(object)_badgeStripeOn == (Object)null) { _badgeStripeOn = Theme.RoundedTex(Theme.Accent, 6); } if ((Object)(object)_badgeStripeOff == (Object)null) { _badgeStripeOff = Theme.RoundedTex(BadgeLockedModern, 6); } float num3 = Mathf.Clamp(((Rect)(ref _rect)).height - 240f, 180f, 440f); _badgeScroll = BeginVerticalScroll(_badgeScroll, GUILayout.Height(num3)); Rect val2 = default(Rect); for (int j = 0; j < num; j++) { ACHIEVEMENTTYPE t = allTypes[j]; bool flag = _badgeUnlockedCache != null && j < _badgeUnlockedCache.Length && _badgeUnlockedCache[j]; Rect rect = GUILayoutUtility.GetRect(10f, 42f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(42f) }); bool flag2 = Event.current != null && ((Rect)(ref rect)).Contains(Event.current.mousePosition); if ((int)Event.current.type == 7) { GUI.Box(rect, GUIContent.none, flag2 ? Theme.RowHover : (flag ? Theme.ListItemActive : Theme.ListItem)); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + 6f, ((Rect)(ref rect)).y + 6f, 4f, ((Rect)(ref rect)).height - 12f), (Texture)(object)(flag ? _badgeStripeOn : _badgeStripeOff)); Texture2D val = SteamAch.Icon(t); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + 16f, ((Rect)(ref rect)).y + 7f, 28f, 28f); if ((Object)(object)val != (Object)null) { Color color = GUI.color; GUI.color = (Color)(flag ? Color.white : new Color(1f, 1f, 1f, 0.58f)); GUI.DrawTexture(val2, (Texture)(object)val, (ScaleMode)2, true); GUI.color = color; } else { GUI.Label(val2, "?", ItemIconFallbackStyle()); } string text = SteamAch.DisplayName(t); GUI.Label(new Rect(((Rect)(ref rect)).x + 52f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width - 220f, 22f), text, Theme.RowLabel); GUI.Label(new Rect(((Rect)(ref rect)).x + 52f, ((Rect)(ref rect)).y + 21f, ((Rect)(ref rect)).width - 220f, 18f), (!flag) ? (Ru ? "Не получено" : "Locked") : (Ru ? "Получено" : "Unlocked"), Theme.LabelDim); } string text2 = SteamAch.DisplayName(t); string text3 = SteamAch.Desc(t); if (!string.IsNullOrEmpty(text3)) { text2 = text2 + "\n" + text3; } if (flag2) { _hoverTip = text2; } Rect val3 = new Rect(((Rect)(ref rect)).xMax - 112f, ((Rect)(ref rect)).y + 7f, 104f, 28f); string text4 = ((!flag) ? (Ru ? "Выдать" : "Unlock") : (Ru ? "Отозвать" : "Revoke")); if (GUI.Button(val3, text4, flag ? Theme.LinkBtn : Theme.DonateBtn)) { SteamAch.Toggle(t); RefreshBadgeCache(force: true); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); } private static void RefreshBadgeCache(bool force) { ACHIEVEMENTTYPE[] allTypes = SteamAch.AllTypes; if (force || _badgeTypeCache != allTypes || _badgeUnlockedCache == null || _badgeUnlockedCache.Length != allTypes.Length || !(Time.realtimeSinceStartup - _badgeCacheTime < 0.75f)) { _badgeTypeCache = allTypes; if (_badgeUnlockedCache == null || _badgeUnlockedCache.Length != allTypes.Length) { _badgeUnlockedCache = new bool[allTypes.Length]; } for (int i = 0; i < allTypes.Length; i++) { _badgeUnlockedCache[i] = SteamAch.IsUnlocked(allTypes[i]); } _badgeCacheTime = Time.realtimeSinceStartup; } } private static void DrawTooltipOverlayModern() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) string text = HoverTooltipText(); if (!string.IsNullOrEmpty(text)) { Vector2 mouse = default(Vector2); ((Vector2)(ref mouse))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); DrawTooltipBox(text, mouse, avoidWindow: false); } } private static bool ToggleModern(string key, bool value) { //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_002d: 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_0048: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(10f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); int num; if (Event.current != null) { num = (((Rect)(ref rect)).Contains(Event.current.mousePosition) ? 1 : 0); if (num != 0 && (int)Event.current.type == 7) { GUI.Box(rect, GUIContent.none, Theme.RowHover); } } else { num = 0; } if (num != 0) { _hoverTip = Localization.D(key); } bool num2 = GUI.Button(rect, GUIContent.none, GUIStyle.none); GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 72f, ((Rect)(ref rect)).height), L(key), Theme.RowLabel); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).xMax - 46f - 12f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 24f) * 0.5f, 46f, 24f); GUI.Box(val, GUIContent.none, value ? Theme.SwitchOn : Theme.SwitchOff); float num3 = 18f; float num4 = (value ? (((Rect)(ref val)).xMax - num3 - 3f) : (((Rect)(ref val)).x + 3f)); if ((Object)(object)Theme.KnobTex != (Object)null) { GUI.DrawTexture(new Rect(num4, ((Rect)(ref val)).y + 3f, num3, num3), (Texture)(object)Theme.KnobTex); } if (num2) { value = !value; } return value; } private static bool ToggleRaw(string label, string tip, bool value) { //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_002d: 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_0048: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(10f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); int num; if (Event.current != null) { num = (((Rect)(ref rect)).Contains(Event.current.mousePosition) ? 1 : 0); if (num != 0 && (int)Event.current.type == 7) { GUI.Box(rect, GUIContent.none, Theme.RowHover); } } else { num = 0; } if (num != 0) { _hoverTip = tip; } bool num2 = GUI.Button(rect, GUIContent.none, GUIStyle.none); GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 72f, ((Rect)(ref rect)).height), label, Theme.RowLabel); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).xMax - 46f - 12f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 24f) * 0.5f, 46f, 24f); GUI.Box(val, GUIContent.none, value ? Theme.SwitchOn : Theme.SwitchOff); float num3 = 18f; float num4 = (value ? (((Rect)(ref val)).xMax - num3 - 3f) : (((Rect)(ref val)).x + 3f)); if ((Object)(object)Theme.KnobTex != (Object)null) { GUI.DrawTexture(new Rect(num4, ((Rect)(ref val)).y + 3f, num3, num3), (Texture)(object)Theme.KnobTex); } if (num2) { value = !value; } return value; } private static Rect DefaultWindowRect() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) return new Rect(80f, 80f, 680f, 580f); } private static void EnsureWindowRectLoaded() { //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_005d: 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) if (!_windowRectLoaded) { _windowRectLoaded = true; if (ModConfig.WindowX != null && ModConfig.WindowY != null && ModConfig.WindowWidth != null && ModConfig.WindowHeight != null) { _rect = new Rect(ModConfig.WindowX.Value, ModConfig.WindowY.Value, ModConfig.WindowWidth.Value, ModConfig.WindowHeight.Value); _lastSavedRect = _rect; } } } private static void PersistWindowRect() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (_windowRectLoaded && !Input.GetMouseButton(0) && ModConfig.WindowX != null && ModConfig.WindowY != null && ModConfig.WindowWidth != null && ModConfig.WindowHeight != null && (!(Mathf.Abs(((Rect)(ref _rect)).x - ((Rect)(ref _lastSavedRect)).x) < 0.5f) || !(Mathf.Abs(((Rect)(ref _rect)).y - ((Rect)(ref _lastSavedRect)).y) < 0.5f) || !(Mathf.Abs(((Rect)(ref _rect)).width - ((Rect)(ref _lastSavedRect)).width) < 0.5f) || !(Mathf.Abs(((Rect)(ref _rect)).height - ((Rect)(ref _lastSavedRect)).height) < 0.5f))) { ModConfig.WindowX.Value = Mathf.Round(((Rect)(ref _rect)).x); ModConfig.WindowY.Value = Mathf.Round(((Rect)(ref _rect)).y); ModConfig.WindowWidth.Value = Mathf.Round(((Rect)(ref _rect)).width); ModConfig.WindowHeight.Value = Mathf.Round(((Rect)(ref _rect)).height); _lastSavedRect = _rect; } } private static float EffectiveMinWindowWidth() { float num = Mathf.Clamp01((UiScale() - 1f) / 0.5f); return Mathf.Lerp(540f, 820f, num); } private static float EffectiveMinWindowHeight() { float num = Mathf.Clamp01((UiScale() - 1f) / 0.5f); return Mathf.Lerp(500f, 640f, num); } private static void CenterWindow() { ((Rect)(ref _rect)).x = Mathf.Round((VirtualScreenWidth() - ((Rect)(ref _rect)).width) * 0.5f); ((Rect)(ref _rect)).y = Mathf.Round((VirtualScreenHeight() - ((Rect)(ref _rect)).height) * 0.5f); ClampWindowToScreen(); } private static void ClampWindowToScreen() { float num = 8f; float num2 = VirtualScreenWidth(); float num3 = VirtualScreenHeight(); float num4 = Mathf.Max(420f, num2 - num * 2f); float num5 = Mathf.Max(340f, num3 - num * 2f); float num6 = Mathf.Min(EffectiveMinWindowWidth(), num4); float num7 = Mathf.Min(EffectiveMinWindowHeight(), num5); ((Rect)(ref _rect)).width = Mathf.Clamp(((Rect)(ref _rect)).width, num6, num4); ((Rect)(ref _rect)).height = Mathf.Clamp(((Rect)(ref _rect)).height, num7, num5); ((Rect)(ref _rect)).x = Mathf.Clamp(((Rect)(ref _rect)).x, num, num2 - ((Rect)(ref _rect)).width - num); ((Rect)(ref _rect)).y = Mathf.Clamp(((Rect)(ref _rect)).y, num, num3 - ((Rect)(ref _rect)).height - num); } private static void HandleWindowResize(Event e) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0022: 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_0084: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_01c4: Unknown result type (might be due to invalid IL or missing references) if (e == null) { return; } if (_resizeEdge != ResizeEdge.None && !Input.GetMouseButton(0)) { _resizeEdge = ResizeEdge.None; } else if (_resizeEdge == ResizeEdge.None) { if ((int)e.type == 0 && e.button == 0) { ResizeEdge resizeEdge = HitResizeEdge(e.mousePosition); if (resizeEdge != ResizeEdge.None) { _resizeEdge = resizeEdge; _resizeStartRect = _rect; _resizeStartMouse = e.mousePosition; e.Use(); } } } else if ((int)e.type == 1) { _resizeEdge = ResizeEdge.None; e.Use(); } else if ((int)e.type == 3) { float num = 8f; float num2 = VirtualScreenWidth(); float num3 = VirtualScreenHeight(); float num4 = Mathf.Max(420f, num2 - num * 2f); float num5 = Mathf.Max(340f, num3 - num * 2f); float num6 = Mathf.Min(EffectiveMinWindowWidth(), num4); float num7 = Mathf.Min(EffectiveMinWindowHeight(), num5); Vector2 val = e.mousePosition - _resizeStartMouse; float num8 = ((Rect)(ref _resizeStartRect)).xMin; float num9 = ((Rect)(ref _resizeStartRect)).xMax; float num10 = ((Rect)(ref _resizeStartRect)).yMin; float num11 = ((Rect)(ref _resizeStartRect)).yMax; if ((_resizeEdge & ResizeEdge.Left) != ResizeEdge.None) { num8 = Mathf.Clamp(((Rect)(ref _resizeStartRect)).xMin + val.x, num, ((Rect)(ref _resizeStartRect)).xMax - num6); } if ((_resizeEdge & ResizeEdge.Right) != ResizeEdge.None) { num9 = Mathf.Clamp(((Rect)(ref _resizeStartRect)).xMax + val.x, ((Rect)(ref _resizeStartRect)).xMin + num6, num2 - num); } if ((_resizeEdge & ResizeEdge.Top) != ResizeEdge.None) { num10 = Mathf.Clamp(((Rect)(ref _resizeStartRect)).yMin + val.y, num, ((Rect)(ref _resizeStartRect)).yMax - num7); } if ((_resizeEdge & ResizeEdge.Bottom) != ResizeEdge.None) { num11 = Mathf.Clamp(((Rect)(ref _resizeStartRect)).yMax + val.y, ((Rect)(ref _resizeStartRect)).yMin + num7, num3 - num); } _rect = Rect.MinMaxRect(num8, num10, num9, num11); ((Rect)(ref _rect)).width = Mathf.Clamp(((Rect)(ref _rect)).width, num6, num4); ((Rect)(ref _rect)).height = Mathf.Clamp(((Rect)(ref _rect)).height, num7, num5); e.Use(); } } private static ResizeEdge HitResizeEdge(Vector2 mouse) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) bool num = mouse.x >= ((Rect)(ref _rect)).xMin - 8f && mouse.x <= ((Rect)(ref _rect)).xMax + 8f; bool flag = mouse.y >= ((Rect)(ref _rect)).yMin - 8f && mouse.y <= ((Rect)(ref _rect)).yMax + 8f; if (!num || !flag) { return ResizeEdge.None; } ResizeEdge resizeEdge = ResizeEdge.None; if (Mathf.Abs(mouse.x - ((Rect)(ref _rect)).xMin) <= 8f) { resizeEdge |= ResizeEdge.Left; } if (Mathf.Abs(mouse.x - ((Rect)(ref _rect)).xMax) <= 8f) { resizeEdge |= ResizeEdge.Right; } if (Mathf.Abs(mouse.y - ((Rect)(ref _rect)).yMin) <= 8f) { resizeEdge |= ResizeEdge.Top; } if (Mathf.Abs(mouse.y - ((Rect)(ref _rect)).yMax) <= 8f) { resizeEdge |= ResizeEdge.Bottom; } return resizeEdge; } private static void DrawTooltipOverlay() { //IL_004a: 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_0033: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (UseModernUi) { DrawTooltipOverlayModern(); return; } string tooltip = GUI.tooltip; if (!string.IsNullOrEmpty(tooltip)) { Vector2 mouse = (Vector2)((Event.current != null) ? Event.current.mousePosition : new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y)); RememberTooltip(tooltip); DrawTooltipBox(tooltip, mouse, avoidWindow: true); } } public static void DrawDonateNotice() { //IL_00bf: 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_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_0086: 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_0091: Expected O, but got Unknown BeginScaledGui(out var previous); try { Theme.EnsureBuilt(); SyncThemeTextureCache(); if (!_noticeDismissed && ModConfig.ShowDonateNotice.Value) { ApplyFont(); float num = 420f; float num2 = (_langOpen ? Mathf.Min(660f, VirtualScreenHeight() - 80f) : Mathf.Min(520f, VirtualScreenHeight() - 80f)); ClampNoticeToScreen(num, num2); Rect noticeRect = _noticeRect; object obj = <>O.<1>__DrawNoticeWindowModern; if (obj == null) { WindowFunction val = DrawNoticeWindowModern; <>O.<1>__DrawNoticeWindowModern = val; obj = (object)val; } _noticeRect = GUILayout.Window(1, noticeRect, (WindowFunction)obj, GUIContent.none, Theme.Window, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(num), GUILayout.Height(num2) }); } } finally { EndScaledGui(previous); } } private static void ClampNoticeToScreen(float width, float height) { float num = 12f; float num2 = VirtualScreenWidth(); float num3 = VirtualScreenHeight(); ((Rect)(ref _noticeRect)).width = width; ((Rect)(ref _noticeRect)).height = height; ((Rect)(ref _noticeRect)).x = Mathf.Clamp(((Rect)(ref _noticeRect)).x, num, Mathf.Max(num, num2 - width - num)); ((Rect)(ref _noticeRect)).y = Mathf.Clamp(((Rect)(ref _noticeRect)).y, num, Mathf.Max(num, num3 - height - num)); } private static void DrawNoticeWindow(int id) { GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(12f); GUILayout.BeginVertical(Array.Empty()); GUILayout.Label("PEAK-MX ♥", Theme.Title, Array.Empty()); GUILayout.Label(SupportText(), Theme.DonateText, Array.Empty()); GUILayout.Space(6f); GUILayout.Label(L("ui.language"), Theme.LabelDim, Array.Empty()); DrawLanguagePicker(); GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(DonateTextLabel(), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { OpenUrl("https://www.donationalerts.com/r/maxkir041"); _noticeDismissed = true; } if (GUILayout.Button(CloseTextLabel(), Theme.CloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _noticeDismissed = true; } GUILayout.EndHorizontal(); GUILayout.Space(6f); DrawQr(_langOpen ? 118 : 92); DrawDonationSupportPanel(compact: true); GUILayout.Space(8f); GUILayout.EndVertical(); GUILayout.Space(12f); GUILayout.EndHorizontal(); GUI.DragWindow(); } private static void DrawNoticeWindowModern(int id) { GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(12f); GUILayout.BeginVertical(Array.Empty()); GUILayout.Label("PEAK-MX ♥", Theme.Title, Array.Empty()); GUILayout.Label(SupportText(), Theme.DonateText, Array.Empty()); GUILayout.Space(6f); GUILayout.Label(L("ui.language"), Theme.LabelDim, Array.Empty()); DrawLanguagePicker(); GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(DonateTextLabel(), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { OpenUrl("https://www.donationalerts.com/r/maxkir041"); _noticeDismissed = true; } if (GUILayout.Button(Ru ? "Закрыть" : "Close", Theme.CloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _noticeDismissed = true; } GUILayout.EndHorizontal(); GUILayout.Space(6f); DrawQr(_langOpen ? 118 : 92); DrawDonationSupportPanel(compact: true); GUILayout.Space(8f); GUILayout.EndVertical(); GUILayout.Space(12f); GUILayout.EndHorizontal(); GUI.DragWindow(); } private static bool BeginSection(string key, string title, bool defaultOpen) { if (TryGetSimpleSectionIndex(key, out var index)) { if (index != _simpleSection[_tab]) { return false; } GUILayout.BeginVertical(Theme.Card, Array.Empty()); GUILayout.Label(title, Theme.Section, Array.Empty()); GUILayout.Space(6f); return true; } if (!_sectionOpen.TryGetValue(key, out var value)) { value = defaultOpen; } GUILayout.BeginVertical(Theme.Card, Array.Empty()); string obj = (value ? "▼ " : "► "); GUIStyle val = (value ? Theme.FoldoutBtnOpen : Theme.FoldoutBtn); if (GUILayout.Button(obj + title, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { value = !value; } _sectionOpen[key] = value; if (!value) { GUILayout.EndVertical(); return false; } GUILayout.Space(8f); return true; } private static void EndSection() { GUILayout.EndVertical(); } private static bool Toggle(string key, bool value) { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if (UseModernUi) { return ToggleModern(key, value); } Rect rect = GUILayoutUtility.GetRect(10f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (((Rect)(ref rect)).Contains(Event.current.mousePosition) && (int)Event.current.type == 7) { GUI.Box(rect, GUIContent.none, Theme.RowHover); } bool num = GUI.Button(rect, new GUIContent("", Localization.D(key)), GUIStyle.none); GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - 72f, ((Rect)(ref rect)).height), L(key), Theme.RowLabel); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).xMax - 46f - 12f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 24f) * 0.5f, 46f, 24f); GUI.Box(val, GUIContent.none, value ? Theme.SwitchOn : Theme.SwitchOff); float num2 = 18f; float num3 = (value ? (((Rect)(ref val)).xMax - num2 - 3f) : (((Rect)(ref val)).x + 3f)); if ((Object)(object)Theme.KnobTex != (Object)null) { GUI.DrawTexture(new Rect(num3, ((Rect)(ref val)).y + 3f, num2, num2), (Texture)(object)Theme.KnobTex); } if (num) { value = !value; } return value; } private static float NumberField(string label, float value, float min, float max) { string key = NumberKey(label, min, max); if (!_numberText.TryGetValue(key, out var value2)) { value2 = value.ToString("0.##"); } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); string text = GUILayout.TextField(value2, Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(96f), GUILayout.Height(28f) }); GUILayout.Label(min.ToString("0.##") + " - " + max.ToString("0.##"), Theme.LabelDim, Array.Empty()); GUILayout.EndHorizontal(); if (float.TryParse(text, out var result)) { value = Mathf.Clamp(result, min, max); } string text2 = value.ToString("0.##"); _numberText[key] = ((text == value2 && text != text2) ? text2 : text); return value; } private static string NumberKey(string label, float min, float max) { return label + "|" + min.ToString("0.###") + "|" + max.ToString("0.###"); } private static void SetNumberText(string label, float min, float max, float value) { _numberText[NumberKey(label, min, max)] = value.ToString("0.##"); } private static float Slider(string label, float value, float min, float max) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(10f, 34f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(34f) }); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 120f, ((Rect)(ref rect)).height), $"{label}: {value:0.##}", Theme.LabelDim); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x + 124f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 8f) * 0.5f, Mathf.Max(40f, ((Rect)(ref rect)).width - 140f), 8f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref val)).x, ((Rect)(ref rect)).y + 4f, ((Rect)(ref val)).width, ((Rect)(ref rect)).height - 8f); Event current = Event.current; if (current != null && ((int)current.type == 0 || (int)current.type == 3) && ((Rect)(ref val2)).Contains(current.mousePosition)) { float num = Mathf.Clamp01((current.mousePosition.x - ((Rect)(ref val)).x) / Mathf.Max(1f, ((Rect)(ref val)).width)); value = Mathf.Lerp(min, max, num); current.Use(); } GUI.Box(val, GUIContent.none, Theme.SliderBar); float num2 = Mathf.InverseLerp(min, max, value); Rect val3 = new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, Mathf.Clamp01(num2) * ((Rect)(ref val)).width, ((Rect)(ref val)).height); if ((Object)(object)_sliderFillTex == (Object)null) { _sliderFillTex = Theme.Tex(Theme.Accent); } GUI.DrawTexture(val3, (Texture)(object)_sliderFillTex); float num3 = 18f; GUI.Box(new Rect(((Rect)(ref val)).x + num2 * ((Rect)(ref val)).width - num3 * 0.5f, ((Rect)(ref val)).center.y - num3 * 0.5f, num3, num3), GUIContent.none, Theme.SliderThumb); return Mathf.Clamp(value, min, max); } private static void TipLast(string tip) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Event.current != null && !string.IsNullOrWhiteSpace(tip)) { Rect lastRect = GUILayoutUtility.GetLastRect(); if (((Rect)(ref lastRect)).Contains(Event.current.mousePosition)) { _hoverTip = tip; } } } private static void DrawItemFavoriteControls() { GUILayout.BeginHorizontal(Array.Empty()); _itemFavoritesOnly = ToggleCompact(Ru ? "Только избранные" : "Favorites only", _itemFavoritesOnly); bool flag = (GUI.enabled = _selItem >= 0 && _selItem < GameApi.ItemNames.Count) && IsFavoriteItem(_selItem); if (GUILayout.Button((!flag) ? (Ru ? "В избранное" : "Add favorite") : (Ru ? "Убрать из избранного" : "Remove favorite"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(156f), GUILayout.Height(28f) })) { SetFavoriteItem(_selItem, !flag); } GUI.enabled = true; if (GUILayout.Button(Ru ? "Очистить" : "Clear", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(90f), GUILayout.Height(28f) })) { ModConfig.FavoriteItemIds.Value = ""; } GUILayout.EndHorizontal(); TipLast(Ru ? "Избранные предметы сохраняются по игровому itemID." : "Favorite items are saved by the game's itemID."); } private static bool IsFavoriteItem(int itemIndex) { if (ModConfig.FavoriteItemIds == null) { return false; } ushort num = GameApi.ItemIdAt(itemIndex); if (num == ushort.MaxValue) { return false; } EnsureFavoriteItems(); return _favoriteItemIds.Contains(num); } private static void SetFavoriteItem(int itemIndex, bool enabled) { if (ModConfig.FavoriteItemIds == null) { return; } ushort num = GameApi.ItemIdAt(itemIndex); if (num != ushort.MaxValue) { EnsureFavoriteItems(); if (enabled) { _favoriteItemIds.Add(num); } else { _favoriteItemIds.Remove(num); } List list = new List(_favoriteItemIds); list.Sort(); string[] array = new string[list.Count]; for (int i = 0; i < list.Count; i++) { array[i] = list[i].ToString(); } string text = string.Join(",", array); ModConfig.FavoriteItemIds.Value = text; _favoriteItemSource = text; } } private static void EnsureFavoriteItems() { string text = ModConfig.FavoriteItemIds?.Value ?? ""; if (string.Equals(text, _favoriteItemSource, StringComparison.Ordinal)) { return; } _favoriteItemIds.Clear(); string[] array = text.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { if (ushort.TryParse(array[i].Trim(), out var result)) { _favoriteItemIds.Add(result); } } _favoriteItemSource = text; } private static bool DrawItemListRow(int index, string name, bool active) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(10f, 32f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(32f) }); bool result = GUI.Button(rect, GUIContent.none, active ? Theme.ListItemActive : Theme.ListItem); Texture2D val = GameApi.ItemIcon(index); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + 7f, ((Rect)(ref rect)).y + 4f, 24f, 24f); float num = ((Rect)(ref rect)).x + 38f; if ((Object)(object)val != (Object)null) { GUI.DrawTexture(val2, (Texture)(object)val, (ScaleMode)2, true); } else { GUI.Box(val2, GUIContent.none, active ? Theme.ChipActive : Theme.Chip); string text = (string.IsNullOrWhiteSpace(name) ? "?" : name.Substring(0, 1).ToUpperInvariant()); GUI.Label(val2, text, ItemIconFallbackStyle()); } GUI.Label(new Rect(num, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - (num - ((Rect)(ref rect)).x) - 10f, ((Rect)(ref rect)).height), name, active ? Theme.RowLabel : Theme.Label); if (((Rect)(ref rect)).Contains(Event.current.mousePosition)) { _hoverTip = (Ru ? "Выбрать предмет для спавна или приколов." : "Select this item for spawning or pranks."); } return result; } private static void DrawItemCategoryBar(ref int selected) { string[] labels = ((!Ru) ? new string[8] { "All", "Favorites", "Food", "Consum.", "Gear", "Back", "Mystic", "Other" } : new string[8] { "Все", "Избранное", "Еда", "Расход", "Снаряж.", "Спина", "Мистика", "Другое" }); DrawChipBar(ref selected, labels); } private static bool DrawItemTileGrid(string search, int category, int selectedIndex, Action select) { bool result = false; int num = TileColumns(116f); float num2 = TileWidth(num); int num3 = 0; bool flag = false; string search2 = (search ?? "").Trim().ToLowerInvariant(); for (int i = 0; i < GameApi.ItemNames.Count; i++) { string name = GameApi.ItemNames[i] ?? ""; if (ItemMatchesFilter(i, name, search2, category)) { if (!flag) { GUILayout.BeginHorizontal(Array.Empty()); flag = true; } if (DrawItemTile(i, name, selectedIndex == i, num2)) { select?.Invoke(i); result = true; } num3++; if (num3 >= num) { GUILayout.EndHorizontal(); GUILayout.Space(8f); num3 = 0; flag = false; } else { GUILayout.Space(8f); } } } if (flag) { while (num3 < num) { GUILayout.Space(num2); num3++; if (num3 < num) { GUILayout.Space(8f); } } GUILayout.EndHorizontal(); } return result; } private static bool DrawItemTile(int index, string name, bool active, float width) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(width, 88f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(88f) }); bool result = GUI.Button(rect, GUIContent.none, active ? Theme.ListItemActive : Theme.ListItem); Texture2D val = GameApi.ItemIcon(index); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + (((Rect)(ref rect)).width - 38f) * 0.5f, ((Rect)(ref rect)).y + 8f, 38f, 38f); if ((Object)(object)val != (Object)null) { GUI.DrawTexture(val2, (Texture)(object)val, (ScaleMode)2, true); } else { GUI.Label(val2, ItemFallbackLetter(name), ItemIconFallbackStyle()); } GUI.Label(new Rect(((Rect)(ref rect)).x + 7f, ((Rect)(ref rect)).y + 50f, ((Rect)(ref rect)).width - 14f, 32f), name, active ? ItemTileLabelActiveStyle() : ItemTileLabelStyle()); if (Event.current != null && ((Rect)(ref rect)).Contains(Event.current.mousePosition)) { _hoverTip = (Ru ? "Выбрать предмет для спавна, ESP или приколов." : "Select this item for spawning, ESP, or pranks."); } return result; } private static bool ItemMatchesFilter(int index, string name, string search, int category) { if (search.Length > 0 && (name ?? "").ToLowerInvariant().IndexOf(search, StringComparison.Ordinal) < 0) { return false; } switch (category) { case 0: return true; case 1: return IsFavoriteItem(index); default: { string value = ItemHaystack(index, name); switch (category) { case 2: return ContainsAny(value, "food", "berry", "mushroom", "marshmallow", "hot dog", "hotdog", "coconut", "banana", "apple", "soup", "ration", "еда", "ягод", "гриб"); case 3: return ContainsAny(value, "drink", "cure", "heal", "medical", "bandage", "antidote", "fuel", "flare", "lantern", "torch", "consum", "леч", "топлив", "фонар", "факел"); case 4: return ContainsAny(value, "rope", "piton", "climb", "hook", "compass", "map", "radio", "bugle", "equipment", "снаряж", "верев", "крюк", "компас"); case 5: return ContainsAny(value, "backpack", "fannypack", "jetpack", "rocketpack", "pack", "рюкзак", "ранец"); case 6: return ContainsAny(value, "cursed", "curse", "skull", "pandora", "effigy", "faerie", "amulet", "medallion", "talisman", "charm", "mystical", "прокля", "череп", "амулет", "медальон", "талисман"); default: if (!ItemMatchesFilter(index, name, "", 2) && !ItemMatchesFilter(index, name, "", 3) && !ItemMatchesFilter(index, name, "", 4) && !ItemMatchesFilter(index, name, "", 5)) { return !ItemMatchesFilter(index, name, "", 6); } return false; } } } } private static string ItemHaystack(int index, string name) { try { Item val = ((index >= 0 && index < GameApi.Items.Count) ? GameApi.Items[index] : null); return (name + " " + (((Object)(object)val != (Object)null) ? ((Object)val).name : "") + " " + (((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) ? ((Object)((Component)val).gameObject).name : "") + " " + (((Object)(object)val != (Object)null) ? ((object)val).GetType().Name : "") + " " + (((Object)(object)val != (Object)null) ? ((object)Unsafe.As(ref val.itemTags)/*cast due to .constrained prefix*/).ToString() : "")).ToLowerInvariant(); } catch { return (name ?? "").ToLowerInvariant(); } } private static bool ContainsAny(string value, params string[] needles) { if (string.IsNullOrWhiteSpace(value) || needles == null) { return false; } foreach (string value2 in needles) { if (!string.IsNullOrWhiteSpace(value2) && value.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static string ItemFallbackLetter(string name) { if (string.IsNullOrWhiteSpace(name)) { return "?"; } return name.Substring(0, 1).ToUpperInvariant(); } private static GUIStyle ItemIconFallbackStyle() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0041: Expected O, but got Unknown if (_itemIconText == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 11, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; _itemIconText = val; } return _itemIconText; } private static GUIStyle ItemTileLabelStyle() { //IL_000c: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (_itemTileLabel == null) { _itemTileLabel = new GUIStyle(Theme.LabelDim) { alignment = (TextAnchor)1, fontSize = 10, wordWrap = true, clipping = (TextClipping)1 }; } return _itemTileLabel; } private static GUIStyle ItemTileLabelActiveStyle() { //IL_000c: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003a: Expected O, but got Unknown if (_itemTileLabelActive == null) { _itemTileLabelActive = new GUIStyle(Theme.Label) { alignment = (TextAnchor)1, fontSize = 10, fontStyle = (FontStyle)1, wordWrap = true, clipping = (TextClipping)1 }; } return _itemTileLabelActive; } private static void DrawTooltipFooter(Rect rect) { //IL_0000: 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) GUI.Box(rect, GUIContent.none, Theme.Panel9); string text = FooterTooltipText(); DrawScrollableTooltipText(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 7f, ((Rect)(ref rect)).width - 24f, ((Rect)(ref rect)).height - 12f), text, Theme.TipText); } private static string DefaultTooltipText() { if (!Ru) { return "Hover a button, item, or player - the hint appears here."; } return "Наведи курсор на кнопку, предмет или игрока - подсказка появится здесь."; } private static string HoverTooltipText() { if (string.IsNullOrWhiteSpace(_hoverTip)) { return null; } RememberTooltip(_hoverTip); return _hoverTip; } private static string FooterTooltipText() { string text = HoverTooltipText(); if (!string.IsNullOrWhiteSpace(text)) { return text; } if (!string.IsNullOrWhiteSpace(_lastTip) && Time.realtimeSinceStartup <= _lastTipUntil) { return _lastTip; } return DefaultTooltipText(); } private static void RememberTooltip(string tip) { //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) if (!string.IsNullOrWhiteSpace(tip)) { if (!string.Equals(_lastTip, tip, StringComparison.Ordinal)) { _tipScroll = Vector2.zero; } _lastTip = tip; _lastTipUntil = Time.realtimeSinceStartup + 0.3f; } } private static void DrawTooltipBox(string tip, Vector2 mouse, bool avoidWindow) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_01e4: 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) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(tip)) { return; } float num = VirtualScreenWidth(); float num2 = VirtualScreenHeight(); float num3 = Mathf.Min(560f, Mathf.Max(320f, num * 0.44f)); float num4 = Mathf.Max(140f, num2 * 0.72f); float num5 = num3 - 24f; float num6 = Mathf.Clamp(Theme.Tooltip.CalcHeight(new GUIContent(tip), num5) + 22f, 44f, num4); float num7 = mouse.x + 18f; float num8 = mouse.y + 20f; if (num7 + num3 > num - 10f) { num7 = mouse.x - num3 - 18f; } if (num8 + num6 > num2 - 10f) { num8 = mouse.y - num6 - 18f; } Rect val = default(Rect); ((Rect)(ref val))..ctor(num7, num8, num3, num6); if (avoidWindow && ((Rect)(ref val)).Overlaps(_rect)) { float num9 = ((Rect)(ref _rect)).xMax + 14f; float num10 = ((Rect)(ref _rect)).xMin - num3 - 14f; float num11 = ((Rect)(ref _rect)).yMax + 12f; float num12 = ((Rect)(ref _rect)).yMin - num6 - 12f; if (num9 + num3 <= num - 10f) { ((Rect)(ref val)).x = num9; } else if (num10 >= 10f) { ((Rect)(ref val)).x = num10; } else if (num11 + num6 <= num2 - 10f) { ((Rect)(ref val)).y = num11; } else if (num12 >= 10f) { ((Rect)(ref val)).y = num12; } } ((Rect)(ref val)).x = Mathf.Clamp(((Rect)(ref val)).x, 10f, num - num3 - 10f); ((Rect)(ref val)).y = Mathf.Clamp(((Rect)(ref val)).y, 10f, num2 - num6 - 10f); int depth = GUI.depth; GUI.depth = -10000; GUI.Box(val, GUIContent.none, Theme.Tooltip); DrawScrollableTooltipText(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 24f, ((Rect)(ref val)).height - 18f), tip, Theme.Tooltip); GUI.depth = depth; } private static void DrawScrollableTooltipText(Rect rect, string text, GUIStyle style) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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 (!string.IsNullOrWhiteSpace(text)) { float num = 16f; float num2 = style.CalcHeight(new GUIContent(text), Mathf.Max(1f, ((Rect)(ref rect)).width - num)); if (num2 <= ((Rect)(ref rect)).height) { GUI.Label(rect, text, style); return; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, Mathf.Max(1f, ((Rect)(ref rect)).width - num), num2); _tipScroll = GUI.BeginScrollView(rect, _tipScroll, val, GUIStyle.none, GUI.skin.verticalScrollbar); GUI.Label(val, text, style); GUI.EndScrollView(); } } private static void LinkButton(string label, string url) { if (GUILayout.Button(label, Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { OpenUrl(url); } } private static Character TargetPicker(ref int sel) { if (sel >= GameApi.PlayerChars.Count) { sel = -1; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Цель:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(TargetName(sel), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _targetPickerOpen = !_targetPickerOpen; } TipLast(Ru ? "Открыть список игроков и выбрать цель действия." : "Open the player list and choose a target."); if (GUILayout.Button(Ru ? "Обновить" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(86f), GUILayout.Height(28f) })) { GameApi.RefreshPlayers(); } GUILayout.EndHorizontal(); if (_targetPickerOpen) { if (GUILayout.Button(Ru ? "Себе" : "Me", (sel < 0) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { sel = -1; _targetPickerOpen = false; } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val = GameApi.PlayerChars[i]; bool flag = false; try { flag = (Object)(object)val != (Object)null && val.IsLocal; } catch { } if (!flag) { if (GUILayout.Button((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?", (sel == i) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { sel = i; _targetPickerOpen = false; } TipLast(GameApi.PlayerDetails(val, Ru)); } } } if (sel < 0 || sel >= GameApi.PlayerChars.Count) { return Character.localCharacter; } return GameApi.PlayerChars[sel]; } private static string TargetName(int sel) { if (sel >= 0 && sel < GameApi.PlayerNames.Count) { return GameApi.PlayerNames[sel]; } if (!Ru) { return "Me"; } return "Себе"; } private static Character InventoryTargetPicker() { if (_invTarget >= GameApi.PlayerChars.Count) { _invTarget = -1; } GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Ru ? "Кому:" : "Target:", Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); if (GUILayout.Button(TargetName(_invTarget), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _inventoryTargetPickerOpen = !_inventoryTargetPickerOpen; } TipLast(Ru ? "Выбрать, чей инвентарь смотреть и редактировать." : "Choose whose inventory to inspect and edit."); if (GUILayout.Button(Ru ? "Обновить" : "Refresh", Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(86f), GUILayout.Height(28f) })) { GameApi.RefreshPlayers(); } GUILayout.EndHorizontal(); if (_inventoryTargetPickerOpen) { if (GUILayout.Button(Ru ? "Себе" : "Me", (_invTarget < 0) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _invTarget = -1; _inventoryTargetPickerOpen = false; } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { Character val = GameApi.PlayerChars[i]; bool flag = false; try { flag = (Object)(object)val != (Object)null && val.IsLocal; } catch { } if (!flag) { if (GUILayout.Button((i < GameApi.PlayerNames.Count) ? GameApi.PlayerNames[i] : "?", (_invTarget == i) ? Theme.ListItemActive : Theme.ListItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _invTarget = i; _inventoryTargetPickerOpen = false; } TipLast(GameApi.PlayerDetails(val, Ru)); } } } if (_invTarget < 0 || _invTarget >= GameApi.PlayerChars.Count) { return null; } return GameApi.PlayerChars[_invTarget]; } private static void SyncThemeTextureCache(bool force = false) { if (force || _themeVersion != Theme.Version) { _themeVersion = Theme.Version; _lineTex = null; _sliderFillTex = null; _headerTex = null; _accentTex = null; _brandIconTex = null; _tileBg = null; _frameOn = null; _frameOff = null; _badgeTileOn = null; _badgeTileOff = null; _badgeTileBg = null; _badgeStripeOn = null; _badgeStripeOff = null; } } private static void HLine() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_lineTex == (Object)null) { _lineTex = Theme.Tex(Theme.PanelLight); } GUI.DrawTexture(GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), (Texture)(object)_lineTex); } private static void DrawBrandMark(float size) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if ((Object)(object)_brandIconTex == (Object)null) { _brandIconTex = BuildBrandIcon(64); } if (_brandIconText == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; _brandIconText = val; } Rect rect = GUILayoutUtility.GetRect(size, size, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(size), GUILayout.Height(size) }); GUI.DrawTexture(rect, (Texture)(object)_brandIconTex, (ScaleMode)2, true); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + size * 0.45f, ((Rect)(ref rect)).width, size * 0.34f), "MX", _brandIconText); } private static Texture2D BuildBrandIcon(int size) { //IL_0004: 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_0012: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; Color bg = Theme.Bg; Color accent = Theme.Accent; Color accentDim = Theme.AccentDim; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.851f, 0.4f, 1f); float num = (float)size * 0.18f; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor((float)size * 0.5f, (float)size * 0.5f); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num2 = Mathf.Max(Mathf.Abs((float)j - val3.x) - ((float)size * 0.5f - num), 0f); float num3 = Mathf.Max(Mathf.Abs((float)i - val3.y) - ((float)size * 0.5f - num), 0f); float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(num - num4 + 1f); Color val4 = bg; if (j < 3 || i < 3 || j >= size - 3 || i >= size - 3) { val4 = accent; } float num6 = (float)i / (float)(size - 1); float num7 = (float)j / (float)(size - 1); float num8 = Mathf.InverseLerp(0.12f, 0.5f, num7); float num9 = Mathf.InverseLerp(0.88f, 0.5f, num7); float num10 = Mathf.Min(num8, num9); if (num6 < num10 * 0.52f + 0.18f && num6 > 0.15f) { val4 = accentDim; } if (num6 < num10 * 0.18f + 0.18f && num7 > 0.4f && num7 < 0.6f) { val4 = val2; } val4.a *= num5; val.SetPixel(j, i, val4); } } val.Apply(); return val; } private static void OpenUrl(string url) { try { Application.OpenURL(url); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("OpenURL failed: " + ex.Message)); } } } private static void DrawDonationSupportPanel(bool compact) { GUILayout.Label(Ru ? "Спасибо всем, кто поддерживает разработку PEAK-MX!" : "Thank you to everyone supporting PEAK-MX!", Theme.Label, Array.Empty()); } private static Texture2D QrTexture() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown if ((Object)(object)_qrTex != (Object)null) { return _qrTex; } if (_qrBytes == null) { try { _qrBytes = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAAAAADuvYBWAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAA4bSURBVHja7Z19bFbVGcDft28LNGV8DRZkM5QxMMYSZxW3MdC8urLsgw+zqDi3OoRtycJWs4Qt6DTZktIlJMYiMZkr8pEYcImj4GI2HDBlLpFq3ULNQkVoQ2QmbWw7C+1K3/fd3/c5JM89p+e+99729/vvPHnOc849v/feW3Iv52YycdFcClLwUrW+pNFm9GlT+9TrAx8qWdMc19JXZGDKgXSkA9IB6YB0QDogHZAOSAekA9IB6YB0QDogHVQqJ9sB/VQGnsmVZdw331RTdmeTK30winFe36BecxzGHayVkc5OGXnag/STasalFXqVVlX60bujWPs5Yc702fH8/hyGHUzM1C7FtgYqQ9zTAelIB6QD0gHpgHRAOiAdkA5IB6QD0gHpMGFCvERx+T2Huvd6+DWdHpWROx0ePf5NT3lNzWiIx07xhEOnWxZ5kP7eWoeRh2smfshPt8vIWVV6fasIPKXPfqs+lfFcLNJHXJb+uA/p6WI1V2/u6YB0QDrSAemAdEA6IB2QDkgHpAPSAemAdPBOyh6t9sc07oAMfDqL9EhYdbOMrPBRdocMtMhA/ssi8JcFMqVnMdIjYbsMHPZSdvOyYPt9Q3pmp5TOPR2QDkgHpAPSAemAdEA6IB2QDkgHpAPSAelTm0n3/9NLPlJKSE8Tnfqla7kMzJWBUz6uf3ORnmR2bQm2r03zUfXuI9zTAemAdEA6IB2QDkgHpAPSAemAdKQD0gHpgHRIL0l+nv7Lj5I7t6f0lEdkYH82PdLvHXao6+ETLpnudhk5uyTY7q+VGfVv2I8zXbSr9APe2yQjh9aJwEyj0z5r6TUuS1/tQ3pFTXJOMDGV/mh+bTUeOo1Gcbzc0wHpgHRAOiAd6YB0QDogHZAOSAekA9IB6RAT13m0+npMUzmmp1y4YF9lnXiK3WXU+HxdsF16xai6PjlrEI30DfE4L5rjdoj2eSOldZUIrDRSxqqC7be2yow2IX3cnMl4rixrsCG2Mz051M0Q0s2UO4LNAtdu7umAdEA60gHpgHRAOiAdkA5IB6QD0gHpgHSIgEQ/Wh3wUaS/TJP9T4qkN8c18s16yiIZMCb7BR9FakU71+xwQXzIYQXiWvtsYj5MVAzxcsrZOiWhEOLK1b1s4pPd3eTQqZCUeyn3dP6QA6QD0gHpgHRAOiAdkA5IB6QD0gHpgHSwpbLo8MPw0icb28ctiglZ+1KpPKegcbyVIZ5in14dbPcv0PsMi28SHDM2WWh+XASWGEUu+jhko+zySKpeVDMMWp6QkaNRbHMyNMeQnpwbjbEXzH1epJ8T24/s3eqj6qnFwXbXCplx6xHu6YB0QDogHZAOSAekA9JBl15iDaae9CxrwOUdkA5IB6QD0iEdxPc8veM++z5PysD6zZPKxr59asofxT+3dv3DQfqInjNdtOeH6CM+xJFZJ/sMLNKLyD7txh4fedHOmVMT71BkfvCwCFwyXqXJv2p9fC784uci0LXSvshAu5qybZeU7jJ7hz5Zp1WaEUGPXC5TFqUhTrhyXWZncE8HpCMdkA5IB6QD0gHpgHRAOiAdkA5IB6TDBKk8bIS+I55AXzjjUPd+8QDz3LsORdqte5Re8rIqh9WMb33KvsimpEi/zmvvg7OD7dfWOtTVtx9x4awMzP1ssF0o1yPqHrETxeh5mWFsTaF/zuNt4yWKxu0yIj9o8niLzDh+gwhUL5VnerouTHVJndgMObPR+A5Y7cM9nT/kAOmAdEA6IB2QDsmVzk4UU1A6O1FweQekA9IB6YB0SAnXebQ6OOihbn//JF+4Xg9rdKU8w/aGkF4rA63247zjUKQpo/aZq164WiMxfKBTXSQHnn9CPeB5MnDbgNpHbvEx5DTX0yVrGo0iHVqXgjnwSCkh1Hv56RRE1WYj46g6E/Nn36d1GeSeDkhHOiAdkA5IB6QD0gHpgHRAOiAdkA5IhwkT6v+ny6eexnvTBYciGR99HN7gLhUzPg4nGuTI2YoySTceHq+RgR07xTpW6kUcvlSRqVYzWn9mXfSFrTLStiXYvjZNPxydTocDNrbraDwgAkuNn2zWi/STPrYfeSOS7Udi40zOtsdodSQT6eCeDkgHpAPSAelIB6QD0gHpgHRAOiAdkA5IB6RDWaicXIdTaHDo9OKLiT2eS/dEIn3MCInv9mS+Nubh8rBuzL7PA+32fU7pKd21wXbP8igWdsaYw1X16DeC7bGZ0ZzpVWpKtsrDOF6KeKIquaOITmPRTI17On/IAdIB6YB0QDogHZAOSAekA9IB6YB0QDrYYr5EcazPR93Dk2uZ9vsoskXN6Nsbk/TX9viouzUeObluGfnxKfsq+d+JwCYvh7NZXFYfvV8kDBl7tDT+Siu6r0VGjteKwHJderpZlqAqGgsXisDbfmYi+gxxTwekIx2QDkgHpAPSAemAdEA6IB2QDkgHpMOEmWyPVt/3lBMFH8jA0gr7uS6LS/qOpWVZpD+1y0ibDMj3AwrmrhJqnxA0XVNTjNcsNn5bBJqNgS/foFU9eFBGitm4zvQt5ZFuRL5UZ1+lUezu4PJGUqOa0aUvUjP3dEA6IB2QDkgHpAPSAemAdEA60gHpgHRAOqQWt0er+uNlucV9aTxj3cfLRMLl2FIsxDNuJjMel/SWFjVluCbYfmWD2mXJBeuJ9NbqOdPUjLwMLFS77GlSU9qnqePIy2xlXq36T72qPHeyeT9n+uTi4fK8E5L5q3Yv/eJJtcY8I/KH+UqXWSe5pwPSkQ5IB6QD0gHpgHRAOiAdkA5IB6QD0gHpYE3l7cmZiz6VRyIZ97nn1JQzuVhW5Mpdes7X1Yx7dknpnXrZ019RfzpqjfX6az6VF9UUfbL1Z7SM/Vvtq8aGOTW5jk/qbzGtsteVyWS0n3nJQ41M0c8y5TKTmwoPe85wT+cPOUA6IB2QDkgHpAPSAemAdEA6IB2QDkgHW1w2JbjapufsjeuAdk9yYc96WJMwT2dPrw62+xfIjLnvisBTB+2ntuSUCDzWrvZplbua1OrjdIsdPMZCfNRlXDym//gTkfDJCtll4zMysth+TXpl4LYBGelRi9T6ONOvw+K4iog+BYc+Lh9vmie3AemKZk1C1KjRth8Z4p4OSEc6IB2QDkgHpAPSAemAdEA6IB2QDkiHCRPq0WpXeebSVZ4+//NwOB8OOEytTrQvDflYtY8+EoEbZ2tdsl50zf1YBF79r32Rh/SUQ2qf+u0i8Pwp+5nkfyQjD4p12t3ksEoFcVnd+UQk587xhmD72stOZ7o937TvUgwhvU6cLL1myiYp3WX6mybTxbxqE/d0QDrSAemAdEA6IB3SI73EGkw96VnWgMs7IB2QDkgHpEM68PRodTQxBzSa3KJjMS1BrsqH9I0y0F4dyeyNcarULp3VahGDdjXjq50+qlaXx/laGdj2rI+yO0pBihFNf6Sk0BPm/NKKdBtd8jKl3kjp0aqOJOdqvk3OjXs6f8gB0gHpgHRAOiAdkA5IB6QD0gHpgHRAOiAdVCpZAifyMvDbB1IkveDQSf4HiWzBx1Ry9l0Wy4FL0fyIO2Rgj7H9SIgXSexXaWSmntM3z1ZXptLL9d1HkaKPgQvRnBoViSoz4arc0/lDDpAOSAekA9IB6YB0QDogHZAOSAekA9LBlsqdcY18831qytMy8P0bg+1+h+82nHhLzzEWZYe6x+IF+4U88m8ZaVg5yX9uzXJ/hMuSjUafsx52omhzmey4KNLqUqQgijQbGUdFxnCIqn0laxL0utQNXHe5pwPSAemAdEA6IB2QjnRAOiAdkA5IB6QD0iGhpGsnitG3Yxr43fSs0eB5F+lHI5nLBvsuP9ksAleNF0taayc+jEn+MRH49Up1kRwGbqiTkVv0TsbAs0S7a42L9LtnR+D8mEOfBhk4bOasDzY97USxXko3Mm5dLJbaYRSnd6PWefg4Lvd0/pADpAPSAemAdEA6JFd6iTWYetKzrAGXd0A6IB2QDkiHdBDiJYriiEPdGvsuV1zmfyWSVYmm6oiPIlc9rHQI6SfWOsxt2HouxRCfrmiUgSb5WY1648WErH3VgzPVlGkOazLTh3SjSN/8YLu60Yf0BLFdKO09aKQcsK9615Zg+5pZ9YVcatbodn0FuKfzhxwgHZAOSAekA9IB6YB0QDogHZAOSAekA9JBJV3P0++KpOr27WrKghQrHlqSKukj04Ptlx7yUHTLoyJwfrlMyZ8QgTs6Izm+ywuD7XeMvSka96tF9DeDBtJ1pmdjKppNzPFFMhPu6fwhB0gHpAPSAemAdEiudLYfmYLS2X6EyzsgHZAOSAekQ0pI9KPV30RR9M9vpMnP4zKwU7QPnEuz9Io+Gflhi9qp9bsioP8L9MMWH7Ptsd/q5c6L9sOYe2I0iyM815LqM31+2TrFNlvu6YB0QDogHZAOSAekA9IB6YB0pAPSAemAdEgpCXq0+vdoiqwuy+Q/+ZeMTF+pdvrgA/uB3iyP9FuOO9Sttu5RXGOE9IEXiXbBLDJWJX4EetUqGdhVkJHPiHavMfDGIyLw+6IIdKxRZ9L4PRF4UO9jHN9aB+mLFsV17q+ZEUHRm26y73OPj4HvlYGOEJ0aHAYSfYa4pwPSkQ5IB6QD0gHpgHRAOiAdkA5IB6QD0mHCXO/R6lBSJ3vtqkMno8+sMm2dZyzjbB9FIpI+J7G/0Jf1z3nUrxKB94zD6V5Wlsm2GwMXxGX1c9vUInsOqilGkVlS8bbkGGwuBSmYKSMi5ZBetV50KeWNlO5SBJwNccQF66rDIar22U+Wezp/yAHSAemAdEA6IB2QDkgHpAPSAemAdEA6IB1U/g8haNnaidoBbwAAAABJRU5ErkJggg=="); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[QR] embedded decode failed: " + ex.Message)); } } } if (_qrBytes != null) { Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; if (LoadImage(val, _qrBytes)) { _qrTex = val; } _qrBytes = null; } return _qrTex; } private static bool LoadImage(Texture2D tex, byte[] data) { if (!_loadImageResolved) { _loadImageResolved = true; _loadImage = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); } if (_loadImage == null) { return false; } try { return (bool)_loadImage.Invoke(null, new object[2] { tex, data }); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[QR] LoadImage: " + ex.Message)); } return false; } } private static void DrawQr(float size) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = QrTexture(); Rect rect = GUILayoutUtility.GetRect(size, size, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(size), GUILayout.Height(size) }); if ((Object)(object)val != (Object)null) { GUI.DrawTexture(rect, (Texture)(object)val, (ScaleMode)2); } } private static string EntitySectionName() { return Localization.Pick(Localization.Current, "Сущности", "Entities", "实体", "實體", "Сутності", "エンティティ", "개체", "Entidades", "Entidades", "Kreaturen", "Créatures", "Entità", "Istoty", "Varlıklar"); } private static void DrawEntitySpawner() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (!BeginSection("inventory.redesign.entities", EntitySectionName(), defaultOpen: false)) { return; } EntitySpawner.EnsureCatalog(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Поиск:", "Search:", "搜索:", "搜尋:"), Theme.LabelDim, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) }); _entitySearch = GUILayout.TextField(_entitySearch, Theme.TextInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); if (GUILayout.Button(Tx("Обновить", "Reload", "刷新", "重新整理"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(86f), GUILayout.Height(30f) })) { EntitySpawner.LoadCatalog(); } GUILayout.EndHorizontal(); if ((int)Event.current.type == 8 && (_entityFilterSearch != _entitySearch || _entityFilterLanguage != Localization.Current)) { _entityFilterSearch = _entitySearch; _entityFilterLanguage = Localization.Current; _visibleEntities.Clear(); for (int i = 0; i < EntitySpawner.Entities.Count; i++) { EntityDefinition entityDefinition = EntitySpawner.Entities[i]; string text = (_entitySearch ?? "").Trim(); if (text.Length == 0 || entityDefinition.Name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0 || entityDefinition.ResourcePath.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0) { _visibleEntities.Add(i); } } } _entityScroll = BeginVerticalScroll(_entityScroll, GUILayout.Height(176f)); int num = TileColumns(); float num2 = TileWidth(num); for (int j = 0; j < _visibleEntities.Count; j += num) { GUILayout.BeginHorizontal(Array.Empty()); for (int k = 0; k < num; k++) { int num3 = j + k; if (num3 < _visibleEntities.Count) { int num4 = _visibleEntities[num3]; EntityDefinition entityDefinition2 = EntitySpawner.Entities[num4]; bool enabled = GUI.enabled; GUI.enabled = enabled && (Object)(object)entityDefinition2.Prefab != (Object)null; if (DrawTile(entityDefinition2.Name, entityDefinition2.ResourcePath, _entitySelection == num4, num2, 48f, (_entitySelection == num4) ? Theme.ListItemActive : Theme.ListItem)) { _entitySelection = num4; } GUI.enabled = enabled; } else { GUILayout.Space(num2); } if (k < num - 1) { GUILayout.Space(8f); } } GUILayout.EndHorizontal(); GUILayout.Space(6f); } if (_visibleEntities.Count == 0) { GUILayout.Label(Tx("Ничего не найдено", "No matches", "没有匹配项", "沒有符合項目"), Theme.LabelDim, Array.Empty()); } GUILayout.EndScrollView(); _entitySelection = Mathf.Clamp(_entitySelection, 0, EntitySpawner.Entities.Count - 1); GUILayout.Label(EntitySpawner.Entities[_entitySelection].Name, Theme.LabelDim, Array.Empty()); Character target = TargetPicker(ref _entityTarget); DrawChipBar(ref _entityPlacement, new string[2] { Localization.Pick(Localization.Current, "Перед игроком", "In front of player", "玩家前方", "玩家前方", "Перед гравцем", "プレイヤーの前", "플레이어 앞", "Frente al jugador", "À frente do jogador", "Vor dem Spieler", "Devant le joueur", "Davanti al giocatore", "Przed graczem", "Oyuncunun önünde"), Localization.Pick(Localization.Current, "В точке прицела", "At crosshair", "准星位置", "準星位置", "У точці прицілу", "照準の位置", "조준점", "En la mira", "Na mira", "Am Fadenkreuz", "Au viseur", "Al mirino", "Na celowniku", "Nişangâhta") }); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(Tx("Количество", "Amount", "数量", "數量"), Theme.LabelDim, Array.Empty()); GUILayout.FlexibleSpace(); bool enabled2 = GUI.enabled; GUI.enabled = enabled2 && _entityAmount > 1; if (GUILayout.Button("-", Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(30f) })) { _entityAmount--; } GUI.enabled = enabled2; GUILayout.Label(_entityAmount.ToString(), Theme.Label, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(28f), GUILayout.Height(30f) }); GUI.enabled = enabled2 && _entityAmount < 5; if (GUILayout.Button("+", Theme.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(30f) })) { _entityAmount++; } GUI.enabled = enabled2; GUILayout.EndHorizontal(); DrawActionTiles(new ActionTileSpec(Localization.Pick(Localization.Current, "Создать", "Spawn", "生成", "生成", "Створити", "スポーン", "생성", "Crear", "Criar", "Erzeugen", "Créer", "Genera", "Utwórz", "Oluştur"), Tx("Создать выбранную сущность в лобби.", "Spawn the selected entity in the lobby.", "在大厅中生成所选实体。", "在房間中生成所選實體。"), delegate { _entityResult = EntitySpawner.Spawn(_entitySelection, target, (EntityPlacement)_entityPlacement, _entityAmount); }, 1)); if (_entityResult.HasValue) { GUILayout.Label(EntityResultText(_entityResult.Value), Theme.LabelDim, Array.Empty()); } int aliveCount = EntitySpawner.AliveCount; GUILayout.Label(Tx("Создано сейчас: ", "Currently spawned: ", "当前生成数量: ", "目前生成數量: ") + aliveCount + "/" + 30, Theme.LabelDim, Array.Empty()); enabled2 = GUI.enabled; GUI.enabled = enabled2 && aliveCount > 0; DrawActionTiles(new ActionTileSpec(Localization.Pick(Localization.Current, "Удалить созданных", "Remove spawned", "移除已生成实体", "移除已生成實體", "Видалити створених", "生成した個体を削除", "생성한 개체 제거", "Eliminar creados", "Remover criados", "Erzeugte entfernen", "Supprimer les créations", "Rimuovi le entità create", "Usuń utworzone", "Oluşturulanları kaldır"), Tx("Удаляет только сущности, созданные здесь в текущем лобби.", "Removes only entities spawned here in the current lobby.", "仅移除在当前大厅中通过此处生成的实体。", "僅移除目前房間中在此處生成的實體。"), delegate { _entityResult = EntitySpawner.ClearSpawned(); }, 2)); GUI.enabled = enabled2; EndSection(); } private static string EntityResultText(EntitySpawnResult result) { switch (result.Status) { case EntitySpawnStatus.Spawned: { string text2 = Tx("Создано: ", "Spawned: ", "已生成: ", "已生成: "); int count = result.Count; string text3 = count.ToString(); count = result.Requested; return text2 + text3 + "/" + count; } case EntitySpawnStatus.Cleared: { string text = Tx("Удалено: ", "Removed: ", "已移除: ", "已移除: "); int count = result.Count; return text + count; } case EntitySpawnStatus.Locked: return Tx("Инструменты заблокированы античитом хоста.", "Tools are blocked by the host's anti-cheat.", "工具已被房主的反作弊锁定。", "工具已被房主的反作弊鎖定。"); case EntitySpawnStatus.NoRoom: return Tx("Сначала войди в лобби.", "Join a lobby first.", "请先加入大厅。", "請先加入房間。"); case EntitySpawnStatus.NoPlayer: return Tx("Персонаж ещё не готов.", "The character is not ready yet.", "角色尚未就绪。", "角色尚未就緒。"); case EntitySpawnStatus.Unavailable: return Tx("Эта сущность недоступна в текущей версии игры.", "This entity is unavailable in the current game version.", "当前游戏版本中此实体不可用。", "目前遊戲版本中此實體不可用。"); case EntitySpawnStatus.SceneNotReady: return Tx("Менеджер сущностей недоступен на этой карте.", "The entity manager is unavailable on this map.", "此地图没有可用的实体管理器。", "此地圖沒有可用的實體管理器。"); case EntitySpawnStatus.HostRequired: return Tx("Эту сущность может создать только хост.", "Only the host can spawn this entity.", "只有房主可以生成此实体。", "只有房主可以生成此實體。"); case EntitySpawnStatus.NoTornadoPath: return Tx("На этой карте нет маршрута для торнадо.", "This map has no tornado route.", "此地图没有龙卷风路径。", "此地圖沒有龍捲風路徑。"); case EntitySpawnStatus.NoGround: return Tx("В выбранной точке нет подходящей поверхности.", "No suitable surface at the selected position.", "所选位置没有合适的表面。", "所選位置沒有合適的表面。"); case EntitySpawnStatus.Limit: return Tx("Достигнут лимит созданных сущностей: ", "Spawned entity limit reached: ", "已达到生成实体上限: ", "已達到生成實體上限: ") + 30; case EntitySpawnStatus.Cooldown: return Tx("Подожди немного перед следующим спавном.", "Wait briefly before spawning again.", "请稍等片刻再生成。", "請稍等片刻再生成。"); default: return Tx("Не удалось создать сущность. Подробности в локальном логе.", "Could not spawn the entity. See the local log for details.", "无法生成实体。详情见本地日志。", "無法生成實體。詳情見本機日誌。"); } } private static void DrawManyPlayersAdmin() { if (BeginSection("admin.many_players", Tx("Много игроков", "Many players", "多人大厅", "多人房間"), defaultOpen: false)) { GUILayout.Label(ManyPlayers.StatusText(Localization.Current), Theme.LabelDim, Array.Empty()); ModConfig.ManyPlayersEnabled.Value = ToggleRaw(Tx("Включить большие лобби", "Enable larger lobbies", "启用大型大厅", "啟用大型房間"), Tx("Меняет лимит комнаты при создании лобби. Лучше включать до создания комнаты.", "Changes the room limit when hosting. Best enabled before creating a room.", "创建房间时修改人数上限。最好在创建房间前启用。", "建立房間時修改人數上限。最好在建立房間前啟用。"), ModConfig.ManyPlayersEnabled.Value); ModConfig.ManyPlayersMaxPlayers.Value = Mathf.RoundToInt(NumberField(Tx("Макс. игроков", "Max players", "最大玩家数", "最大玩家數"), ModConfig.ManyPlayersMaxPlayers.Value, 1f, 30f)); ModConfig.ManyPlayersHostOnlyKiosk.Value = ToggleRaw(Tx("Старт только хостом", "Host-only start", "仅房主可开始", "僅房主可開始"), Tx("Блокирует запуск экспедиции с киоска для игроков, которые не являются хостом.", "Blocks airport kiosk start actions for non-host players.", "阻止非房主玩家通过机场终端开始探险。", "阻止非房主玩家透過機場終端開始探險。"), ModConfig.ManyPlayersHostOnlyKiosk.Value); ModConfig.ManyPlayersLobbyDetails.Value = ToggleRaw(Tx("Лог входов и выходов", "Join/leave log", "加入/离开日志", "加入/離開紀錄"), Tx("Пишет события большого лобби в админ-лог PEAK-MX.", "Writes large-lobby events to the PEAK-MX admin log.", "把大型大厅的加入和离开事件写入 PEAK-MX 管理日志。", "把大型房間的加入和離開事件寫入 PEAK-MX 管理紀錄。"), ModConfig.ManyPlayersLobbyDetails.Value); ModConfig.ManyPlayersVoiceFix.Value = ToggleRaw(Tx("Фикс голосовых групп", "Voice group fix", "语音分组修复", "語音分組修復"), Tx("Переиспользует 4 голосовые группы, чтобы игроки после четвертого не ломали голос.", "Reuses the four voice groups so players after the fourth do not break voice routing.", "复用 4 个语音分组,避免第 5 名之后的玩家语音路由损坏。", "重複使用 4 個語音分組,避免第 5 名之後的玩家語音路由損壞。"), ModConfig.ManyPlayersVoiceFix.Value); ModConfig.ManyPlayersUiFix.Value = ToggleRaw(Tx("Фикс UI игроков", "Player UI fix", "玩家界面修复", "玩家介面修復"), Tx("Расширяет простые списки имен и ожидания игроков, когда это возможно.", "Expands simple name/waiting UI lists where possible.", "尽可能扩展玩家姓名和等待列表界面。", "盡可能擴展玩家姓名和等待列表介面。"), ModConfig.ManyPlayersUiFix.Value); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Еда + рюкзаки", "Food + backpacks", "食物 + 背包", "食物 + 背包"), Theme.DonateBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnCampfireSuppliesForLobby(); } TipLast(Tx("Спавнит у костра еду под размер лобби и рюкзаки примерно на четверть игроков.", "Spawns campfire food for the lobby size and backpacks for roughly a quarter of players.", "按大厅人数生成营火食物,并按约四分之一玩家数生成背包。", "按房間人數生成營火食物,並按約四分之一玩家數生成背包。")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Tx("Еда у костра", "Food at campfire", "营火食物", "營火食物"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnCampfireFoodForLobby(); } TipLast(Tx("Спавнит у костра хот-доги или маршмеллоу под размер лобби.", "Spawns hot dogs or marshmallows at the campfire for the lobby size.", "按大厅人数在营火旁生成热狗或棉花糖。", "按房間人數在營火旁生成熱狗或棉花糖。")); if (GUILayout.Button(Tx("Рюкзаки у костра", "Backpacks at campfire", "营火背包", "營火背包"), Theme.LinkBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { GameApi.SpawnCampfireBackpacksForLobby(); } TipLast(Tx("Спавнит рюкзаки у костра: примерно один на четырех игроков.", "Spawns backpacks at the campfire: roughly one per four players.", "在营火旁生成背包:约每 4 名玩家 1 个。", "在營火旁生成背包:約每 4 名玩家 1 個。")); GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.Label(Tx("После изменения лимита пересоздай лобби. Для уже созданной комнаты Photon обычно оставляет старый лимит.", "Recreate the lobby after changing the limit. Photon usually keeps the old limit for an existing room.", "修改人数上限后请重新创建大厅。Photon 通常会保留已有房间的旧上限。", "修改人數上限後請重新建立房間。Photon 通常會保留既有房間的舊上限。"), Theme.LabelDim, Array.Empty()); EndSection(); } } } public static class ModConfig { public static ConfigEntry MenuToggleKey; public static ConfigEntry Language; public static ConfigEntry ShowDonateNotice; public static ConfigEntry ManyPlayersEnabled; public static ConfigEntry ManyPlayersMaxPlayers; public static ConfigEntry ManyPlayersHostOnlyKiosk; public static ConfigEntry ManyPlayersLobbyDetails; public static ConfigEntry ManyPlayersVoiceFix; public static ConfigEntry ManyPlayersUiFix; public static ConfigEntry ManyPlayersPluginAudit; public static ConfigEntry ManyPlayersPluginAuditKick; public static ConfigEntry AntiCheatEnabledEntry; public static ConfigEntry AntiCheatLockClients; public static ConfigEntry AntiCheatKickMissingData; public static ConfigEntry MxAhgRequireAgent; public static ConfigEntry MxAhgExactPack; public static ConfigEntry MxAhgKickMissing; public static ConfigEntry MxAhgKickMismatch; public static ConfigEntry MxAhgKickSuspicious; public static ConfigEntry MxAhgKickStale; public static ConfigEntry MxAhgGraceSeconds; public static ConfigEntry MxAhgRecheckSeconds; public static ConfigEntry MxAhgDeniedKeywords; public const string DefaultMxAhgDeniedKeywords = "cheat;trainer;hack;godmode;exploit;injector"; public const int QuickActionSlotCount = 8; public static ConfigEntry[] QuickActionKeys; public static ConfigEntry[] QuickActionIds; public static bool SpeedMod; public static float SpeedAmount = 1f; public static bool JumpMod; public static float JumpAmount = 1.5f; public static bool InfiniteJumps; public static bool ClimbMod; public static float ClimbAmount = 1f; public static bool VineClimbMod; public static float VineClimbAmount = 1f; public static bool RopeClimbMod; public static float RopeClimbAmount = 1f; public static bool GodMode; public static bool InfiniteStamina; public static bool NoFallDamage; public static bool NoFallingRagdoll; public static bool NoWeight; public static bool LockStatus; public static bool NoStatusEffects; public static bool NoInjury; public static bool NoHunger; public static bool NoCold; public static bool NoPoison; public static bool NoCurse; public static bool NoDrowsy; public static bool NoHot; public static bool NoCrab; public static bool NoThorns; public static bool NoSpores; public static bool NoWeb; public static bool NoArrows; public static bool NoPetrify; public static bool NoFlyTrap; public static bool TeleportToPing; public static bool NoSlipperySurfaces; public static bool LongInteraction; public static float InteractionDistance = 12f; public static bool CinematicCamera; public static float CinematicCameraSpeed = 8f; public static float CinematicCameraFov = 65f; public static bool GlobalVoice; public static bool PlayerEsp; public static float PlayerEspDistance = 1000f; public static bool PlayerEspBoxes = true; public static bool PlayerEspLines = true; public static bool ItemEsp; public static float ItemEspDistance = 350f; public static bool ItemEspLines = true; public static int ItemEspSelectedIndex = -1; public static string ItemEspSearch = ""; public static ConfigEntry WorldEsp; public static ConfigEntry WorldEspDistance; public static ConfigEntry WorldEspLines; public static ConfigEntry WorldEspDangers; public static ConfigEntry WorldEspCampfires; public static ConfigEntry WorldEspBackItems; public static ConfigEntry WorldEspAmulets; public static float StaminaConsumptionPercent = 100f; public static float StaminaRegenPercent = 100f; public static bool StaminaRegenDelayMod; public static float StaminaRegenDelay = 1f; public static float ClimbStaminaConsumptionPercent = 100f; public static float ExtraStaminaPercent = 100f; public static float StatusIncreasePercent = 25f; public static float InjuryIncreasePercent = 25f; public static float HungerIncreasePercent = 25f; public static float ColdIncreasePercent = 25f; public static float PoisonIncreasePercent = 25f; public static float CrabIncreasePercent = 25f; public static float CurseIncreasePercent = 25f; public static float DrowsyIncreasePercent = 25f; public static float HotIncreasePercent = 25f; public static float ThornsIncreasePercent = 25f; public static float SporesIncreasePercent = 25f; public static float WebIncreasePercent = 25f; public static float ArrowsIncreasePercent = 25f; public static float PetrifyIncreasePercent = 25f; public static float FlyTrapIncreasePercent = 25f; public static bool GameSpeedMod; public static float GameSpeed = 1f; public static float PingHandSizeMultiplier = 1f; public static ConfigEntry AdminProtectionEnabledEntry; public static ConfigEntry AdminWarnOnlyEntry; public static ConfigEntry AdminDetectExtremeMovementEntry; public static ConfigEntry AdminIgnoreDownwardMovementEntry; public static ConfigEntry AdminDetectRareItemBurstsEntry; public static ConfigEntry AdminAutoKickSessionBansEntry; public static ConfigEntry AdminMaxSpeedEntry; public static ConfigEntry AdminSpeedStrikesEntry; private static bool _adminProtectionEnabled; private static bool _adminWarnOnly = true; private static bool _adminDetectExtremeMovement = true; private static bool _adminIgnoreDownwardMovement = true; private static bool _adminDetectRareItemBursts = true; private static bool _adminAutoKickSessionBans = true; private static float _adminMaxSpeed = 25f; private static int _adminSpeedStrikes = 3; public static bool Fly; public static bool Noclip; public static float FlySpeed = 10f; public static float FlyAcceleration = 30f; public static float RechargeValue = 100f; public static bool InfiniteItems; public static bool UnlimitedLanternFuel; public static float LanternFuelConsumptionPercent = 100f; public static bool UnlimitedItemUses; public static ConfigEntry UiScale; public static ConfigEntry AdvancedUi; public static ConfigEntry WindowX; public static ConfigEntry WindowY; public static ConfigEntry WindowWidth; public static ConfigEntry WindowHeight; public static ConfigEntry AccentColorHex; public static ConfigEntry ActionColorHex; public static ConfigEntry FavoriteItemIds; public static ConfigEntry FavoriteActionIds; public static bool RapidRandomOutfitColor; public static float RapidRandomOutfitColorInterval = 0.15f; public static bool OverrideExpeditionTime; public static float ExpeditionTimeSeconds; public static bool AntiCheatEnabled { get { if (AntiCheatEnabledEntry == null) { return false; } return AntiCheatEnabledEntry.Value; } set { if (AntiCheatEnabledEntry != null) { AntiCheatEnabledEntry.Value = value; } } } public static bool AdminProtectionEnabled { get { if (AdminProtectionEnabledEntry == null) { return _adminProtectionEnabled; } return AdminProtectionEnabledEntry.Value; } set { _adminProtectionEnabled = value; if (AdminProtectionEnabledEntry != null) { AdminProtectionEnabledEntry.Value = value; } } } public static bool AdminWarnOnly { get { if (AdminWarnOnlyEntry == null) { return _adminWarnOnly; } return AdminWarnOnlyEntry.Value; } set { _adminWarnOnly = value; if (AdminWarnOnlyEntry != null) { AdminWarnOnlyEntry.Value = value; } } } public static bool AdminDetectExtremeMovement { get { if (AdminDetectExtremeMovementEntry == null) { return _adminDetectExtremeMovement; } return AdminDetectExtremeMovementEntry.Value; } set { _adminDetectExtremeMovement = value; if (AdminDetectExtremeMovementEntry != null) { AdminDetectExtremeMovementEntry.Value = value; } } } public static bool AdminIgnoreDownwardMovement { get { if (AdminIgnoreDownwardMovementEntry == null) { return _adminIgnoreDownwardMovement; } return AdminIgnoreDownwardMovementEntry.Value; } set { _adminIgnoreDownwardMovement = value; if (AdminIgnoreDownwardMovementEntry != null) { AdminIgnoreDownwardMovementEntry.Value = value; } } } public static bool AdminDetectRareItemBursts { get { if (AdminDetectRareItemBurstsEntry == null) { return _adminDetectRareItemBursts; } return AdminDetectRareItemBurstsEntry.Value; } set { _adminDetectRareItemBursts = value; if (AdminDetectRareItemBurstsEntry != null) { AdminDetectRareItemBurstsEntry.Value = value; } } } public static bool AdminAutoKickSessionBans { get { if (AdminAutoKickSessionBansEntry == null) { return _adminAutoKickSessionBans; } return AdminAutoKickSessionBansEntry.Value; } set { _adminAutoKickSessionBans = value; if (AdminAutoKickSessionBansEntry != null) { AdminAutoKickSessionBansEntry.Value = value; } } } public static float AdminMaxSpeed { get { if (AdminMaxSpeedEntry == null) { return _adminMaxSpeed; } return AdminMaxSpeedEntry.Value; } set { _adminMaxSpeed = value; if (AdminMaxSpeedEntry != null) { AdminMaxSpeedEntry.Value = value; } } } public static int AdminSpeedStrikes { get { if (AdminSpeedStrikesEntry == null) { return _adminSpeedStrikes; } return AdminSpeedStrikesEntry.Value; } set { _adminSpeedStrikes = value; if (AdminSpeedStrikesEntry != null) { AdminSpeedStrikesEntry.Value = value; } } } public static void Init(ConfigFile cfg) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Expected O, but got Unknown //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Expected O, but got Unknown //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Expected O, but got Unknown //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) MenuToggleKey = cfg.Bind("General", "MenuToggleKey", (KeyCode)277, "Key to toggle the PEAK-MX overlay."); ShowDonateNotice = cfg.Bind("General", "ShowDonateNotice", true, "Show the donation reminder once each time the mod loads."); ManyPlayersEnabled = cfg.Bind("ManyPlayers", "Enabled", false, "Allow rooms above the base game player limit."); ManyPlayersMaxPlayers = cfg.Bind("ManyPlayers", "MaxPlayers", 20, new ConfigDescription("Maximum lobby size.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 30), Array.Empty())); ManyPlayersHostOnlyKiosk = cfg.Bind("ManyPlayers", "HostOnlyKiosk", true, "Only the room host can start the expedition from the airport kiosk."); ManyPlayersLobbyDetails = cfg.Bind("ManyPlayers", "LobbyDetails", true, "Write extra join/leave details to the PEAK-MX admin log."); ManyPlayersVoiceFix = cfg.Bind("ManyPlayers", "VoiceFix", true, "Reuse voice mixer groups safely when more than four players are in a room."); ManyPlayersUiFix = cfg.Bind("ManyPlayers", "UiFix", true, "Expand simple lobby/name UI arrays for larger rooms where possible."); ManyPlayersPluginAudit = cfg.Bind("ManyPlayers", "PluginAudit", false, "Publish and compare a local hash of BepInEx plugin DLLs. Everyone needs PEAK-MX for this check."); ManyPlayersPluginAuditKick = cfg.Bind("ManyPlayers", "PluginAuditKick", false, "Host kicks players whose PEAK-MX plugin hash differs from the host."); AntiCheatEnabledEntry = cfg.Bind("AntiCheat", "Enabled", false, "Host master switch for movement, rare-item and session protection. MX-AHG validation is an optional strict mode."); AntiCheatLockClients = cfg.Bind("AntiCheat", "LockClientTools", true, "When host anti-cheat is enabled, non-host PEAK-MX clients can only use About and Anti-cheat tabs."); AntiCheatKickMissingData = cfg.Bind("AntiCheat", "KickMissingDllData", true, "Legacy setting retained for config compatibility. MX-AHG KickMissingAgent is used instead."); MxAhgRequireAgent = cfg.Bind("MX-AHG", "RequireAgent", false, "Require remote players to run the standalone MX-AHG agent."); MxAhgExactPack = cfg.Bind("MX-AHG", "ExactHostPack", true, "Compare client DLLs, loaded plugins and Harmony patch owners against the host set."); MxAhgKickMissing = cfg.Bind("MX-AHG", "KickMissingAgent", true, "Kick players without a responding MX-AHG agent when RequireAgent is enabled."); MxAhgKickMismatch = cfg.Bind("MX-AHG", "KickPackMismatch", true, "Kick MX-AHG clients whose mod set differs from the host when ExactHostPack is enabled."); MxAhgKickSuspicious = cfg.Bind("MX-AHG", "KickSuspiciousNames", false, "Kick clients whose reported plugin data contains a denied keyword. Disabled by default to avoid false positives."); MxAhgKickStale = cfg.Bind("MX-AHG", "KickStaleHeartbeat", false, "Kick an MX-AHG client whose heartbeat stops for more than 20 seconds."); MxAhgGraceSeconds = cfg.Bind("MX-AHG", "JoinGraceSeconds", 18f, new ConfigDescription("Time allowed for the agent to answer after a player joins.", (AcceptableValueBase)(object)new AcceptableValueRange(8f, 90f), Array.Empty())); MxAhgRecheckSeconds = cfg.Bind("MX-AHG", "RecheckSeconds", 60f, new ConfigDescription("How often the host requests a fresh full report.", (AcceptableValueBase)(object)new AcceptableValueRange(20f, 300f), Array.Empty())); MxAhgDeniedKeywords = cfg.Bind("MX-AHG", "DeniedKeywords", "cheat;trainer;hack;godmode;exploit;injector", "Semicolon-separated words that mark a DLL, plugin or Harmony owner as suspicious."); AdminProtectionEnabledEntry = cfg.Bind("AntiCheat", "AdminProtection", false, "Enable host-side checks for suspicious behavior from other players."); AdminWarnOnlyEntry = cfg.Bind("AntiCheat", "WarnOnly", true, "Only write suspicious events to the admin log without automatic kicks."); AdminDetectExtremeMovementEntry = cfg.Bind("AntiCheat", "DetectExtremeMovement", true, "Detect suspiciously large remote movement jumps."); AdminIgnoreDownwardMovementEntry = cfg.Bind("AntiCheat", "IgnoreDownwardMovement", true, "When detecting movement cheats, ignore pure downward falling movement so the threshold can be stricter."); AdminDetectRareItemBurstsEntry = cfg.Bind("AntiCheat", "DetectRareItemBursts", true, "Detect suspicious bursts of cursed items and amulets appearing in player inventories."); AdminAutoKickSessionBansEntry = cfg.Bind("AntiCheat", "AutoKickSessionBans", true, "Keep session bans enforced while the banned player remains or rejoins."); AdminMaxSpeedEntry = cfg.Bind("AntiCheat", "MaxSpeed", 25f, new ConfigDescription("Movement speed threshold for admin protection.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 300f), Array.Empty())); AdminSpeedStrikesEntry = cfg.Bind("AntiCheat", "SpeedStrikes", 3, new ConfigDescription("Number of speed detections before kicking when WarnOnly is false.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); QuickActionKeys = new ConfigEntry[8]; QuickActionIds = new ConfigEntry[8]; for (int i = 0; i < 8; i++) { KeyCode val = (KeyCode)(i switch { 0 => 287, 1 => 288, 2 => 289, _ => 0, }); string text = i switch { 0 => "toggle_fly", 1 => "full_stamina", 2 => "anti_stuck", _ => "none", }; int num = i + 1; QuickActionKeys[i] = cfg.Bind("QuickActions", $"Slot{num}Key", val, "Keyboard shortcut for this quick action slot. Set to None to disable."); QuickActionIds[i] = cfg.Bind("QuickActions", $"Slot{num}Action", text, "Action id executed by this quick action slot."); } UiScale = cfg.Bind("UI", "Scale", 1f, new ConfigDescription("Menu size multiplier (0.6–2.0).", (AcceptableValueBase)(object)new AcceptableValueRange(0.6f, 2f), Array.Empty())); AdvancedUi = cfg.Bind("UI", "AdvancedMode", false, "Show precise slots, tuning controls and uncommon actions. Simple mode displays one task group at a time."); WindowX = cfg.Bind("UI", "WindowX", 80f, "Saved horizontal menu position in scaled screen coordinates."); WindowY = cfg.Bind("UI", "WindowY", 80f, "Saved vertical menu position in scaled screen coordinates."); WindowWidth = cfg.Bind("UI", "WindowWidth", 680f, "Saved menu width in scaled screen coordinates."); WindowHeight = cfg.Bind("UI", "WindowHeight", 580f, "Saved menu height in scaled screen coordinates."); AccentColorHex = cfg.Bind("UI", "AccentColor", "#41D58A", "Main menu accent color in #RRGGBB format."); ActionColorHex = cfg.Bind("UI", "ActionColor", "#599FF4", "Primary action button color in #RRGGBB format."); FavoriteItemIds = cfg.Bind("Inventory", "FavoriteItemIds", "", "Comma-separated PEAK item ids marked as favorites in the inventory UI."); FavoriteActionIds = cfg.Bind("UI", "FavoriteActions", "full_stamina;anti_stuck;toggle_fly", "Semicolon-separated quick action ids pinned to the Favorites page."); Language = cfg.Bind("UI", "Language", 1, new ConfigDescription("0=English, 1=Russian, 2=Ukrainian, 3=zh-CN, 4=zh-TW, 5=ja, 6=ko, 7=es, 8=pt-BR, 9=de, 10=fr, 11=it, 12=pl, 13=tr", (AcceptableValueBase)(object)new AcceptableValueRange(0, 13), Array.Empty())); WorldEsp = cfg.Bind("ESP", "WorldEsp", false, "Show danger/campfire/back-item/amulet markers through walls."); WorldEspDistance = cfg.Bind("ESP", "WorldEspDistance", 600f, new ConfigDescription("Maximum distance for world ESP markers.", (AcceptableValueBase)(object)new AcceptableValueRange(25f, 2500f), Array.Empty())); WorldEspLines = cfg.Bind("ESP", "WorldEspLines", true, "Draw lines from the screen bottom to world ESP markers."); WorldEspDangers = cfg.Bind("ESP", "WorldEspDangers", true, "Include hazard-like objects in world ESP."); WorldEspCampfires = cfg.Bind("ESP", "WorldEspCampfires", true, "Include campfires in world ESP."); WorldEspBackItems = cfg.Bind("ESP", "WorldEspBackItems", true, "Include backpacks, fannypacks, jetpacks and rocketpacks in world ESP."); WorldEspAmulets = cfg.Bind("ESP", "WorldEspAmulets", true, "Include amulets and charm-like items in world ESP."); } } internal sealed class MxAhgRow { public int ActorNumber; public string PlayerName = ""; public string AgentVersion = ""; public bool HasAgent; public bool HeartbeatStale; public bool HasReport; public bool ReportValid; public bool Matches; public bool Suspicious; public bool Trusted; public bool PolicyAccepted; public float HeartbeatAge; public string InvalidReason = ""; public string DeclaredSignature = ""; public int DeclaredFileCount; public readonly List Missing = new List(); public readonly List Extra = new List(); public readonly List Changed = new List(); public readonly List PatchDifferences = new List(); public readonly List SuspiciousFindings = new List(); public bool Accepted { get { if (!Trusted) { return PolicyAccepted; } return true; } } public int DifferenceCount => Missing.Count + Extra.Count + Changed.Count + PatchDifferences.Count; public string StatusText(Lang lang) { if (Trusted) { return Localization.Pick(lang, "доверен хостом", "trusted by host", "房主已信任", "房主已信任"); } if (!HasAgent) { return Localization.Pick(lang, "агент не найден", "agent not found", "未找到代理", "未找到代理"); } if (HeartbeatStale) { return Localization.Pick(lang, "heartbeat потерян", "heartbeat lost", "心跳已丢失", "心跳已遺失"); } if (!HasReport) { return Localization.Pick(lang, "ожидание отчёта", "waiting for report", "等待报告", "等待報告"); } if (!ReportValid) { return Localization.Pick(lang, "отчёт недействителен", "invalid report", "报告无效", "報告無效"); } if (Suspicious) { return Localization.Pick(lang, $"подозрительно ({SuspiciousFindings.Count})", $"suspicious ({SuspiciousFindings.Count})", $"可疑 ({SuspiciousFindings.Count})", $"可疑 ({SuspiciousFindings.Count})"); } if (!Matches) { if (PolicyAccepted) { return Localization.Pick(lang, $"проверен, различия разрешены ({DifferenceCount})", $"verified, differences allowed ({DifferenceCount})", $"已验证,允许差异 ({DifferenceCount})", $"已驗證,允許差異 ({DifferenceCount})"); } return Localization.Pick(lang, $"набор отличается ({DifferenceCount})", $"pack differs ({DifferenceCount})", $"模组包不同 ({DifferenceCount})", $"模組包不同 ({DifferenceCount})"); } return Localization.Pick(lang, "проверка пройдена", "verified clean", "验证通过", "驗證通過"); } } internal static class MxAhgHost { private sealed class AgentState { public int ActorNumber; public string PlayerName = ""; public string AgentVersion = ""; public int ProtocolVersion; public bool HasAgent; public int Heartbeat; public float LastHeartbeatAt; public float JoinedAt; public float LastChallengeAt; public float LastReportAt; public int ReportHeartbeat; public string ExpectedNonce = ""; public string DeclaredSignature = ""; public int DeclaredFileCount; public string DeclaredLoadedSignature = ""; public int DeclaredLoadedCount; public string DeclaredSelfHash = ""; public string ComparableSignature = ""; public int ComparableFileCount; public Snapshot Report; public bool ReportValid; public string InvalidReason = ""; public bool Matches; public bool Suspicious; public readonly List Missing = new List(); public readonly List Extra = new List(); public readonly List Changed = new List(); public readonly List PatchDifferences = new List(); public readonly List SuspiciousFindings = new List(); public string LastLoggedStatus = ""; } private sealed class PendingKick { public string Reason = ""; public float DueAt; } private const float HeartbeatStaleSeconds = 20f; private const float KickDelaySeconds = 2.5f; private static readonly Dictionary States = new Dictionary(); private static readonly Dictionary PendingKicks = new Dictionary(); private static readonly HashSet TrustedActors = new HashSet(); private static readonly List RowsInternal = new List(); private static bool _subscribed; private static float _nextTick; private static float _nextLocalScan; private static string _roomName = ""; private static Snapshot _localSnapshot; public static IReadOnlyList Rows => RowsInternal; public static string LocalSignature { get { if (_localSnapshot != null) { return Protocol.Short(_localSnapshot.FileSignature); } return "?"; } } public static int LocalFileCount => _localSnapshot?.Files.Count ?? 0; public static string LocalError => _localSnapshot?.Error ?? ""; public static void Init() { EnsureSubscribed(); RefreshLocal(); } public static void Dispose() { if (_subscribed) { try { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } catch { } } _subscribed = false; ResetRoom(); } public static void Tick() { EnsureSubscribed(); if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { ResetRoom(); return; } string text = PhotonNetwork.CurrentRoom.Name ?? "room"; if (!string.Equals(text, _roomName, StringComparison.Ordinal)) { ResetRoom(); _roomName = text; } if (!PhotonNetwork.IsMasterClient) { RowsInternal.Clear(); } else if (!(Time.realtimeSinceStartup < _nextTick)) { _nextTick = Time.realtimeSinceStartup + 1f; RefreshStates(); ConfigEntry mxAhgRequireAgent = ModConfig.MxAhgRequireAgent; if ((mxAhgRequireAgent != null && mxAhgRequireAgent.Value) || HasAgentState()) { EnsureLocalSnapshot(force: false); } BuildRows(); EnforcePolicy(); ProcessPendingKicks(); } } private static bool HasAgentState() { foreach (AgentState value in States.Values) { if (value.HasAgent) { return true; } } return false; } public static bool HasLiveAgent(int actorNumber) { if (!States.TryGetValue(actorNumber, out var value) || !value.HasAgent || !value.ReportValid) { return false; } if (value.LastHeartbeatAt <= 0f || Time.realtimeSinceStartup - value.LastHeartbeatAt > 20f) { return false; } if (TrustedActors.Contains(actorNumber)) { return true; } if (ModConfig.AntiCheatEnabled) { return value.Matches; } return true; } public static void RefreshLocal() { try { _localSnapshot = Scanner.Scan(typeof(Plugin).Assembly.Location, excludePeakMx: true); _nextLocalScan = Time.realtimeSinceStartup + 30f; foreach (AgentState value in States.Values) { if (value.ReportValid) { Compare(value); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[MX-AHG] host scan failed: " + ex.Message)); } } } public static void RequestAll() { EnsureLocalSnapshot(force: true); if (PhotonNetwork.PlayerList == null) { return; } for (int i = 0; i < PhotonNetwork.PlayerList.Length; i++) { Player val = PhotonNetwork.PlayerList[i]; if (val != null && !val.IsLocal) { RequestReport(val.ActorNumber); } } } public static void RequestReport(int actorNumber, bool force = true) { if (!States.TryGetValue(actorNumber, out var value)) { Player val = FindPlayer(actorNumber); if (val == null) { return; } value = CreateState(val); States[actorNumber] = value; } RequestReportInternal(value, force); } public static bool IsTrusted(int actorNumber) { return TrustedActors.Contains(actorNumber); } public static void SetTrusted(int actorNumber, bool trusted) { if (trusted) { TrustedActors.Add(actorNumber); PendingKicks.Remove(actorNumber); } else { TrustedActors.Remove(actorNumber); } BuildRows(); } public static void Kick(int actorNumber, string reason = "mxahg_admin") { Player val = FindPlayer(actorNumber); if (val != null) { GameApi.KickPhotonPlayer(val, reason); } } public static void KickRejected() { for (int i = 0; i < RowsInternal.Count; i++) { if (!RowsInternal[i].Accepted) { Kick(RowsInternal[i].ActorNumber, "mxahg_rejected"); } } } public static string BuildReport(Lang lang) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("MX-AHG host report"); stringBuilder.AppendLine(Localization.Pick(lang, "Эталон хоста: ", "Host baseline: ", "房主基准: ", "房主基準: ") + LocalSignature + $" ({LocalFileCount} DLL)"); if (!string.IsNullOrWhiteSpace(LocalError)) { stringBuilder.AppendLine(Localization.Pick(lang, "Ошибка сканирования: ", "Scan note: ", "扫描提示: ", "掃描提示: ") + LocalError); } for (int i = 0; i < RowsInternal.Count; i++) { MxAhgRow mxAhgRow = RowsInternal[i]; stringBuilder.AppendLine(); stringBuilder.AppendLine($"{mxAhgRow.PlayerName} [actor {mxAhgRow.ActorNumber}] - {mxAhgRow.StatusText(lang)}"); if (!string.IsNullOrWhiteSpace(mxAhgRow.AgentVersion)) { stringBuilder.AppendLine("Agent: " + mxAhgRow.AgentVersion); } if (!string.IsNullOrWhiteSpace(mxAhgRow.DeclaredSignature)) { stringBuilder.AppendLine($"Set: {mxAhgRow.DeclaredSignature} ({mxAhgRow.DeclaredFileCount} DLL)"); } AppendList(stringBuilder, "Missing", mxAhgRow.Missing); AppendList(stringBuilder, "Extra", mxAhgRow.Extra); AppendList(stringBuilder, "Changed", mxAhgRow.Changed); AppendList(stringBuilder, "Harmony", mxAhgRow.PatchDifferences); AppendList(stringBuilder, "Suspicious", mxAhgRow.SuspiciousFindings); if (!string.IsNullOrWhiteSpace(mxAhgRow.InvalidReason)) { stringBuilder.AppendLine("Invalid: " + mxAhgRow.InvalidReason); } } return stringBuilder.ToString(); } private static void EnsureSubscribed() { if (_subscribed || PhotonNetwork.NetworkingClient == null) { return; } try { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; _subscribed = true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[MX-AHG] subscribe failed: " + ex.Message)); } } } private static void EnsureLocalSnapshot(bool force) { if (force || _localSnapshot == null || Time.realtimeSinceStartup >= _nextLocalScan) { RefreshLocal(); } } private static void RefreshStates() { if (PhotonNetwork.PlayerList == null) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; HashSet hashSet = new HashSet(); for (int i = 0; i < PhotonNetwork.PlayerList.Length; i++) { Player val = PhotonNetwork.PlayerList[i]; if (val == null || val.IsLocal) { continue; } hashSet.Add(val.ActorNumber); if (!States.TryGetValue(val.ActorNumber, out var value)) { value = CreateState(val); States[val.ActorNumber] = value; } value.PlayerName = PlayerName(val); value.AgentVersion = ReadString(val, "mxahg_v"); value.ProtocolVersion = ReadInt(val, "mxahg_p"); value.HasAgent = !string.IsNullOrWhiteSpace(value.AgentVersion) && value.ProtocolVersion == 1; value.DeclaredSignature = ReadString(val, "mxahg_s"); value.DeclaredFileCount = ReadInt(val, "mxahg_c"); value.DeclaredLoadedSignature = ReadString(val, "mxahg_l"); value.DeclaredLoadedCount = ReadInt(val, "mxahg_lc"); value.DeclaredSelfHash = ReadString(val, "mxahg_i"); int num = ReadInt(val, "mxahg_h"); if (value.HasAgent && (value.LastHeartbeatAt <= 0f || num != value.Heartbeat)) { value.Heartbeat = num; value.LastHeartbeatAt = realtimeSinceStartup; } if (value.Report != null && value.Heartbeat != value.ReportHeartbeat) { if (!string.Equals(value.DeclaredSignature, Protocol.Short(value.Report.FileSignature), StringComparison.OrdinalIgnoreCase) || !string.Equals(value.DeclaredLoadedSignature, Protocol.Short(value.Report.LoadedSignature), StringComparison.OrdinalIgnoreCase)) { value.ReportValid = false; value.InvalidReason = "reported state changed"; } else { value.ReportHeartbeat = value.Heartbeat; } } float num2 = ModConfig.MxAhgRecheckSeconds?.Value ?? 60f; if (value.HasAgent && (!value.ReportValid || realtimeSinceStartup - value.LastReportAt >= num2)) { RequestReportInternal(value, force: false); } } List list = new List(); foreach (int key in States.Keys) { if (!hashSet.Contains(key)) { list.Add(key); } } for (int j = 0; j < list.Count; j++) { States.Remove(list[j]); PendingKicks.Remove(list[j]); TrustedActors.Remove(list[j]); } } private static AgentState CreateState(Player player) { return new AgentState { ActorNumber = player.ActorNumber, PlayerName = PlayerName(player), JoinedAt = Time.realtimeSinceStartup }; } private static void RequestReportInternal(AgentState state, bool force) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (state == null || !PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (force || !(realtimeSinceStartup - state.LastChallengeAt < 6f)) { string text = Guid.NewGuid().ToString("N"); object[] array = new object[4] { "MX_AHG", 1, 1, text }; RaiseEventOptions val = new RaiseEventOptions(); val.TargetActors = new int[1] { state.ActorNumber }; RaiseEventOptions val2 = val; if (PhotonNetwork.RaiseEvent((byte)172, (object)array, val2, SendOptions.SendReliable)) { state.ExpectedNonce = text; state.LastChallengeAt = realtimeSinceStartup; } } } private static void OnEvent(EventData data) { try { if (data == null || data.Code != 172 || !PhotonNetwork.IsMasterClient || !(data.CustomData is object[] array) || array.Length < 14 || !string.Equals(array[0]?.ToString(), "MX_AHG", StringComparison.Ordinal) || Convert.ToInt32(array[1]) != 1 || Convert.ToInt32(array[2]) != 2) { return; } Player val = FindPlayer(data.Sender); if (val == null) { return; } if (!States.TryGetValue(data.Sender, out var value)) { value = CreateState(val); States[data.Sender] = value; } string text = Protocol.Limit(array[3]?.ToString() ?? "", 96); if (string.IsNullOrWhiteSpace(value.ExpectedNonce) || !string.Equals(text, value.ExpectedNonce, StringComparison.Ordinal)) { return; } Snapshot snapshot = new Snapshot(); snapshot.Files.AddRange(Protocol.ParseFiles(array[4])); snapshot.Plugins.AddRange(Protocol.ParsePlugins(array[5])); string[] array2 = Protocol.ReadStringArray(array[6]); for (int i = 0; i < array2.Length; i++) { if (snapshot.HarmonyOwners.Count >= 256) { break; } string text2 = Protocol.Limit(array2[i], 180); if (!string.IsNullOrWhiteSpace(text2)) { snapshot.HarmonyOwners.Add(text2); } } snapshot.SelfHash = Protocol.Limit(array[9]?.ToString() ?? "", 64); snapshot.Error = Protocol.Limit(array[11]?.ToString() ?? "", 500); snapshot.Truncated = Convert.ToBoolean(array[13]); snapshot.Recalculate(); string a = Protocol.Limit(array[7]?.ToString() ?? "", 64); string a2 = Protocol.Limit(array[8]?.ToString() ?? "", 64); string a3 = Protocol.Limit(array[10]?.ToString() ?? "", 64); string b = Protocol.ComputeProof(text, snapshot); bool flag = string.Equals(a, snapshot.FileSignature, StringComparison.OrdinalIgnoreCase) && string.Equals(a2, snapshot.LoadedSignature, StringComparison.OrdinalIgnoreCase) && string.Equals(a3, b, StringComparison.OrdinalIgnoreCase); value.AgentVersion = Protocol.Limit(array[12]?.ToString() ?? value.AgentVersion, 40); value.Report = snapshot; value.ReportValid = flag; value.InvalidReason = (flag ? "" : "signature or nonce proof mismatch"); value.LastReportAt = Time.realtimeSinceStartup; value.ReportHeartbeat = value.Heartbeat; value.ExpectedNonce = ""; if (flag) { Compare(value); } LogStatusIfChanged(value); BuildRows(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[MX-AHG] report failed: " + ex.Message)); } } } private static void Compare(AgentState state) { EnsureLocalSnapshot(force: false); state.Missing.Clear(); state.Extra.Clear(); state.Changed.Clear(); state.PatchDifferences.Clear(); state.SuspiciousFindings.Clear(); if (_localSnapshot == null || state.Report == null) { state.Matches = false; return; } Snapshot snapshot = BuildComparableSnapshot(_localSnapshot); Snapshot snapshot2 = BuildComparableSnapshot(state.Report); state.ComparableSignature = snapshot2.FileSignature; state.ComparableFileCount = snapshot2.Files.Count; Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < snapshot2.Files.Count; i++) { string key = NormalizePath(snapshot2.Files[i].RelativePath); if (!dictionary.ContainsKey(key)) { dictionary[key] = snapshot2.Files[i]; } else { AddUnique(state.SuspiciousFindings, "duplicate DLL path: " + snapshot2.Files[i].RelativePath); } } HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); for (int j = 0; j < snapshot.Files.Count; j++) { FileEntry fileEntry = snapshot.Files[j]; string text = NormalizePath(fileEntry.RelativePath); string item = text; dictionary.TryGetValue(text, out var value); if (value == null) { AddUnique(state.Missing, fileEntry.RelativePath); continue; } hashSet.Add(item); if (!string.Equals(fileEntry.Sha256, value.Sha256, StringComparison.OrdinalIgnoreCase)) { AddUnique(state.Changed, value.RelativePath + " (SHA-256)"); } } foreach (KeyValuePair item2 in dictionary) { if (!hashSet.Contains(item2.Key)) { AddUnique(state.Extra, item2.Value.RelativePath); } } Dictionary dictionary2 = new Dictionary(StringComparer.OrdinalIgnoreCase); for (int k = 0; k < snapshot2.Plugins.Count; k++) { string text2 = snapshot2.Plugins[k].Guid ?? ""; if (!dictionary2.ContainsKey(text2)) { dictionary2[text2] = snapshot2.Plugins[k]; } else { AddUnique(state.SuspiciousFindings, "duplicate plugin GUID: " + text2); } } HashSet hashSet2 = new HashSet(StringComparer.OrdinalIgnoreCase); for (int l = 0; l < snapshot.Plugins.Count; l++) { PluginEntry pluginEntry = snapshot.Plugins[l]; if (!dictionary2.TryGetValue(pluginEntry.Guid, out var value2)) { AddUnique(state.Missing, "plugin: " + pluginEntry.Guid); continue; } hashSet2.Add(pluginEntry.Guid); bool num = !string.Equals(pluginEntry.Version, value2.Version, StringComparison.OrdinalIgnoreCase); bool flag = !string.IsNullOrWhiteSpace(pluginEntry.Sha256) && !string.IsNullOrWhiteSpace(value2.Sha256) && !string.Equals(pluginEntry.Sha256, value2.Sha256, StringComparison.OrdinalIgnoreCase); if (num || flag) { AddUnique(state.Changed, "plugin: " + value2.Guid + " " + value2.Version); } } foreach (KeyValuePair item3 in dictionary2) { if (!hashSet2.Contains(item3.Key)) { AddUnique(state.Extra, "plugin: " + item3.Key + " " + item3.Value.Version); } } HashSet hashSet3 = new HashSet(snapshot.HarmonyOwners, StringComparer.OrdinalIgnoreCase); HashSet hashSet4 = new HashSet(snapshot2.HarmonyOwners, StringComparer.OrdinalIgnoreCase); foreach (string item4 in hashSet3) { if (!hashSet4.Contains(item4)) { AddUnique(state.PatchDifferences, "missing owner: " + item4); } } foreach (string item5 in hashSet4) { if (!hashSet3.Contains(item5)) { AddUnique(state.PatchDifferences, "extra owner: " + item5); } } FindDeniedKeywords(state); if (state.Report.Truncated) { AddUnique(state.SuspiciousFindings, "agent report was truncated"); } state.Suspicious = state.SuspiciousFindings.Count > 0; state.Matches = state.Missing.Count == 0 && state.Extra.Count == 0 && state.Changed.Count == 0 && state.PatchDifferences.Count == 0; } private static void FindDeniedKeywords(AgentState state) { string[] array = (ModConfig.MxAhgDeniedKeywords?.Value ?? "").Split(new char[4] { ';', ',', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length < 3) { continue; } for (int j = 0; j < state.Report.Files.Count; j++) { FileEntry fileEntry = state.Report.Files[j]; if (Contains(fileEntry.RelativePath, text) || Contains(fileEntry.AssemblyName, text)) { AddUnique(state.SuspiciousFindings, "keyword '" + text + "': " + fileEntry.RelativePath); } } for (int k = 0; k < state.Report.Plugins.Count; k++) { PluginEntry pluginEntry = state.Report.Plugins[k]; if (Contains(pluginEntry.Guid, text) || Contains(pluginEntry.Name, text) || Contains(pluginEntry.RelativePath, text)) { AddUnique(state.SuspiciousFindings, "keyword '" + text + "': " + pluginEntry.Guid); } } for (int l = 0; l < state.Report.HarmonyOwners.Count; l++) { if (Contains(state.Report.HarmonyOwners[l], text)) { AddUnique(state.SuspiciousFindings, "keyword '" + text + "': " + state.Report.HarmonyOwners[l]); } } } } private static void BuildRows() { RowsInternal.Clear(); float realtimeSinceStartup = Time.realtimeSinceStartup; using (Dictionary.ValueCollection.Enumerator enumerator = States.Values.GetEnumerator()) { AgentState current; MxAhgRow obj; int policyAccepted; MxAhgRow mxAhgRow; for (; enumerator.MoveNext(); obj.PolicyAccepted = (byte)policyAccepted != 0, obj.HeartbeatAge = ((current.LastHeartbeatAt <= 0f) ? (-1f) : (realtimeSinceStartup - current.LastHeartbeatAt)), obj.InvalidReason = current.InvalidReason, obj.DeclaredSignature = (string.IsNullOrWhiteSpace(current.ComparableSignature) ? current.DeclaredSignature : current.ComparableSignature), obj.DeclaredFileCount = ((current.Report == null) ? current.DeclaredFileCount : current.ComparableFileCount), mxAhgRow = obj, mxAhgRow.Missing.AddRange(current.Missing), mxAhgRow.Extra.AddRange(current.Extra), mxAhgRow.Changed.AddRange(current.Changed), mxAhgRow.PatchDifferences.AddRange(current.PatchDifferences), mxAhgRow.SuspiciousFindings.AddRange(current.SuspiciousFindings), RowsInternal.Add(mxAhgRow)) { current = enumerator.Current; obj = new MxAhgRow { ActorNumber = current.ActorNumber, PlayerName = current.PlayerName, AgentVersion = current.AgentVersion, HasAgent = current.HasAgent, HeartbeatStale = (current.HasAgent && (current.LastHeartbeatAt <= 0f || realtimeSinceStartup - current.LastHeartbeatAt > 20f)), HasReport = (current.Report != null), ReportValid = current.ReportValid, Matches = current.Matches, Suspicious = current.Suspicious, Trusted = TrustedActors.Contains(current.ActorNumber) }; if (current.HasAgent && current.LastHeartbeatAt > 0f && realtimeSinceStartup - current.LastHeartbeatAt <= 20f && current.ReportValid) { ConfigEntry mxAhgExactPack = ModConfig.MxAhgExactPack; if ((mxAhgExactPack != null && !mxAhgExactPack.Value) || current.Matches) { ConfigEntry mxAhgKickSuspicious = ModConfig.MxAhgKickSuspicious; policyAccepted = ((mxAhgKickSuspicious == null || !mxAhgKickSuspicious.Value || !current.Suspicious) ? 1 : 0); continue; } } policyAccepted = 0; } } RowsInternal.Sort((MxAhgRow a, MxAhgRow b) => string.Compare(a.PlayerName, b.PlayerName, StringComparison.OrdinalIgnoreCase)); } private static void EnforcePolicy() { if (ModConfig.MxAhgRequireAgent == null || !ModConfig.MxAhgRequireAgent.Value) { PendingKicks.Clear(); return; } float realtimeSinceStartup = Time.realtimeSinceStartup; float num = ModConfig.MxAhgGraceSeconds?.Value ?? 18f; foreach (AgentState value in States.Values) { if (TrustedActors.Contains(value.ActorNumber)) { PendingKicks.Remove(value.ActorNumber); continue; } if (realtimeSinceStartup - value.JoinedAt < num) { continue; } string text = ""; if (!value.HasAgent) { ConfigEntry mxAhgKickMissing = ModConfig.MxAhgKickMissing; if (mxAhgKickMissing == null || mxAhgKickMissing.Value) { text = "mxahg_missing_agent"; goto IL_018e; } } if (value.HasAgent && (value.Report == null || !value.ReportValid)) { ConfigEntry mxAhgKickMissing2 = ModConfig.MxAhgKickMissing; if (mxAhgKickMissing2 == null || mxAhgKickMissing2.Value) { text = "mxahg_invalid_report"; goto IL_018e; } } if (value.HasAgent && realtimeSinceStartup - value.LastHeartbeatAt > 20f) { ConfigEntry mxAhgKickStale = ModConfig.MxAhgKickStale; if (mxAhgKickStale != null && mxAhgKickStale.Value) { text = "mxahg_stale_heartbeat"; goto IL_018e; } } if (value.ReportValid && value.Suspicious) { ConfigEntry mxAhgKickSuspicious = ModConfig.MxAhgKickSuspicious; if (mxAhgKickSuspicious != null && mxAhgKickSuspicious.Value) { text = "mxahg_suspicious_plugin"; goto IL_018e; } } if (value.ReportValid && !value.Matches) { ConfigEntry mxAhgExactPack = ModConfig.MxAhgExactPack; if (mxAhgExactPack == null || mxAhgExactPack.Value) { ConfigEntry mxAhgKickMismatch = ModConfig.MxAhgKickMismatch; if (mxAhgKickMismatch == null || mxAhgKickMismatch.Value) { text = "mxahg_pack_mismatch"; } } } goto IL_018e; IL_018e: if (string.IsNullOrWhiteSpace(text)) { PendingKicks.Remove(value.ActorNumber); } else { ScheduleKick(value, text); } } } private static void ScheduleKick(AgentState state, string reason) { if (!PendingKicks.TryGetValue(state.ActorNumber, out var value) || !string.Equals(value.Reason, reason, StringComparison.Ordinal)) { PendingKicks[state.ActorNumber] = new PendingKick { Reason = reason, DueAt = Time.realtimeSinceStartup + 2.5f }; GameApi.AddAdminLog("MX-AHG: " + state.PlayerName + " -> " + reason); } } private static void ProcessPendingKicks() { if (PendingKicks.Count == 0) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; List list = new List(); foreach (KeyValuePair pendingKick in PendingKicks) { if (!(realtimeSinceStartup < pendingKick.Value.DueAt)) { Player val = FindPlayer(pendingKick.Key); if (val != null) { GameApi.KickPhotonPlayer(val, pendingKick.Value.Reason); } list.Add(pendingKick.Key); } } for (int i = 0; i < list.Count; i++) { PendingKicks.Remove(list[i]); } } private static void LogStatusIfChanged(AgentState state) { string text = ((!state.ReportValid) ? "invalid" : (state.Suspicious ? "suspicious" : (state.Matches ? "clean" : "mismatch"))); if (!string.Equals(text, state.LastLoggedStatus, StringComparison.Ordinal)) { state.LastLoggedStatus = text; GameApi.AddAdminLog("MX-AHG: " + state.PlayerName + " -> " + text, text != "clean"); } } private static void ResetRoom() { States.Clear(); PendingKicks.Clear(); TrustedActors.Clear(); RowsInternal.Clear(); _roomName = ""; _nextTick = 0f; } private static Player FindPlayer(int actorNumber) { if (PhotonNetwork.PlayerList == null) { return null; } for (int i = 0; i < PhotonNetwork.PlayerList.Length; i++) { Player val = PhotonNetwork.PlayerList[i]; if (val != null && val.ActorNumber == actorNumber) { return val; } } return null; } private static string ReadString(Player player, string key) { try { if (((player != null) ? player.CustomProperties : null) != null && ((Dictionary)(object)player.CustomProperties).TryGetValue((object)key, out object value)) { return value?.ToString() ?? ""; } } catch { } return ""; } private static int ReadInt(Player player, string key) { try { if (((player != null) ? player.CustomProperties : null) != null && ((Dictionary)(object)player.CustomProperties).TryGetValue((object)key, out object value)) { if (value is int result) { return result; } if (int.TryParse(value?.ToString(), out var result2)) { return result2; } } } catch { } return 0; } private static string PlayerName(Player player) { if (!string.IsNullOrWhiteSpace((player != null) ? player.NickName : null)) { return player.NickName; } return "Player " + ((player != null) ? player.ActorNumber : 0); } private static Snapshot BuildComparableSnapshot(Snapshot source) { Snapshot snapshot = new Snapshot { Error = (source?.Error ?? ""), Truncated = (source?.Truncated ?? false) }; if (source == null) { snapshot.Recalculate(); return snapshot; } for (int i = 0; i < source.Files.Count; i++) { FileEntry fileEntry = source.Files[i]; if (fileEntry != null && !Scanner.IsTechnicalFile(fileEntry.RelativePath)) { snapshot.Files.Add(fileEntry); } } for (int j = 0; j < source.Plugins.Count; j++) { PluginEntry pluginEntry = source.Plugins[j]; if (pluginEntry != null && !Scanner.IsTechnicalPlugin(pluginEntry.Guid)) { snapshot.Plugins.Add(pluginEntry); } } for (int k = 0; k < source.HarmonyOwners.Count; k++) { string text = source.HarmonyOwners[k]; if (!Scanner.IsTechnicalPlugin(text) && !Scanner.IsUnstableHarmonyOwner(text)) { snapshot.HarmonyOwners.Add(text); } } snapshot.Recalculate(); return snapshot; } private static string NormalizePath(string value) { return (value ?? "").Replace('/', '\\').TrimStart(new char[1] { '\\' }).ToLowerInvariant(); } private static bool Contains(string value, string part) { if (!string.IsNullOrWhiteSpace(value)) { return value.IndexOf(part, StringComparison.OrdinalIgnoreCase) >= 0; } return false; } private static void AddUnique(List list, string value) { if (string.IsNullOrWhiteSpace(value)) { return; } for (int i = 0; i < list.Count; i++) { if (string.Equals(list[i], value, StringComparison.OrdinalIgnoreCase)) { return; } } list.Add(value); } private static void AppendList(StringBuilder sb, string label, IReadOnlyList values) { if (values != null && values.Count != 0) { sb.AppendLine(label + ":"); for (int i = 0; i < values.Count; i++) { sb.AppendLine(" - " + values[i]); } } } } [HarmonyPatch(typeof(Character), "Update")] public static class FlyPatch { private static bool _flying; private static Vector3 _vel = Vector3.zero; private static readonly List _noclipColliders = new List(); private static readonly List _noclipBodies = new List(); private static CharacterController _noclipController; private static bool _noclipApplied; private static void Postfix(Character __instance) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance == (Object)null || !__instance.IsLocal) { return; } if (!ModConfig.Fly) { if (_flying) { _flying = false; _vel = Vector3.zero; } RestoreColliders(); return; } if (!_flying) { _flying = true; _vel = Vector3.zero; } __instance.data.isGrounded = true; __instance.data.sinceGrounded = 0f; __instance.data.sinceJump = 0f; Vector3 val = Vector2.op_Implicit(__instance.input.movementInput); Vector3 normalized = ((Vector3)(ref __instance.data.lookDirection_Flat)).normalized; Vector3 val2 = Vector3.Cross(Vector3.up, normalized); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; Vector3 val3 = normalized * val.y + normalized2 * val.x; if (__instance.input.jumpIsPressed) { val3 += Vector3.up; } if (__instance.input.crouchIsPressed) { val3 += Vector3.down; } float flySpeed = ModConfig.FlySpeed; float flyAcceleration = ModConfig.FlyAcceleration; _vel = Vector3.Lerp(_vel, ((Vector3)(ref val3)).normalized * flySpeed, Time.deltaTime * flyAcceleration); List partList = __instance.refs.ragdoll.partList; for (int i = 0; i < partList.Count; i++) { Rigidbody val4 = (((Object)(object)partList[i] != (Object)null) ? partList[i].Rig : null); if ((Object)(object)val4 != (Object)null) { val4.linearVelocity = _vel; } } if (ModConfig.Noclip) { ApplyNoclip(__instance); } else { RestoreColliders(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[FlyPatch] " + ex.Message)); } } } private static void ApplyNoclip(Character c) { if (!_noclipApplied) { _noclipApplied = true; _noclipColliders.Clear(); _noclipBodies.Clear(); _noclipController = ((Component)c).GetComponent(); } DisableColliders(((Component)c).GetComponentsInChildren(true)); DisableBodies(((Component)c).GetComponentsInChildren(true)); List list = c.refs?.ragdoll?.partList; if (list != null) { for (int i = 0; i < list.Count; i++) { Bodypart val = list[i]; if (!((Object)(object)val == (Object)null)) { if ((Object)(object)val.Rig != (Object)null) { TrackBody(val.Rig); val.Rig.detectCollisions = false; } DisableColliders(((Component)val).GetComponentsInChildren(true)); } } } if ((Object)(object)_noclipController != (Object)null) { ((Collider)_noclipController).enabled = false; } } private static void DisableColliders(Collider[] colliders) { if (colliders == null) { return; } foreach (Collider val in colliders) { if (!((Object)(object)val == (Object)null)) { if (!_noclipColliders.Contains(val)) { _noclipColliders.Add(val); } val.enabled = false; } } } private static void DisableBodies(Rigidbody[] bodies) { if (bodies == null) { return; } foreach (Rigidbody val in bodies) { if (!((Object)(object)val == (Object)null)) { TrackBody(val); val.detectCollisions = false; } } } private static void TrackBody(Rigidbody body) { if ((Object)(object)body != (Object)null && !_noclipBodies.Contains(body)) { _noclipBodies.Add(body); } } private static void RestoreColliders() { if (!_noclipApplied) { return; } _noclipApplied = false; for (int i = 0; i < _noclipColliders.Count; i++) { Collider val = _noclipColliders[i]; if ((Object)(object)val != (Object)null) { val.enabled = true; } } for (int j = 0; j < _noclipBodies.Count; j++) { Rigidbody val2 = _noclipBodies[j]; if ((Object)(object)val2 != (Object)null) { val2.detectCollisions = true; } } if ((Object)(object)_noclipController != (Object)null) { ((Collider)_noclipController).enabled = true; } _noclipColliders.Clear(); _noclipBodies.Clear(); _noclipController = null; } } internal static class MenuInputBlocker { private static readonly MethodInfo ResetInputMethod = AccessTools.Method(typeof(CharacterInput), "ResetInput", (Type[])null, (Type[])null); public static void Suppress(CharacterInput input) { //IL_0035: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) try { if (Plugin.IsMenuOpen && !((Object)(object)input == (Object)null)) { if (ResetInputMethod != null) { ResetInputMethod.Invoke(input, null); return; } input.movementInput = Vector2.zero; input.lookInput = Vector2.zero; input.scrollInput = 0f; input.crouchIsPressed = false; input.crouchWasPressed = false; input.crouchToggleWasPressed = false; input.sprintIsPressed = false; input.sprintToggleIsPressed = false; input.sprintWasPressed = false; input.sprintToggleWasPressed = false; input.jumpWasPressed = false; input.jumpIsPressed = false; input.interactWasPressed = false; input.interactIsPressed = false; input.interactWasReleased = false; input.dropWasPressed = false; input.dropIsPressed = false; input.dropWasReleased = false; input.usePrimaryWasPressed = false; input.usePrimaryIsPressed = false; input.usePrimaryWasReleased = false; input.useSecondaryWasPressed = false; input.useSecondaryIsPressed = false; input.useSecondaryWasReleased = false; input.pingWasPressed = false; input.selectSlotForwardWasPressed = false; input.selectSlotBackwardWasPressed = false; input.unselectSlotWasPressed = false; input.selectBackpackWasPressed = false; input.scrollBackwardWasPressed = false; input.scrollForwardWasPressed = false; input.scrollBackwardIsPressed = false; input.scrollForwardIsPressed = false; input.emoteIsPressed = false; input.spectateLeftWasPressed = false; input.spectateRightWasPressed = false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[MenuInputBlocker] " + ex.Message)); } } } } [HarmonyPatch(typeof(CharacterInput), "Sample")] public static class MenuInputSamplePatch { private static void Postfix(CharacterInput __instance) { MenuInputBlocker.Suppress(__instance); } } [HarmonyPatch(typeof(CharacterInput), "SampleAlways")] public static class MenuInputSampleAlwaysPatch { private static void Postfix(CharacterInput __instance) { MenuInputBlocker.Suppress(__instance); } } [HarmonyPatch(typeof(PointPinger), "ReceivePoint_Rpc")] public static class PointPingPatch { private static void Postfix(Vector3 point, Vector3 hitNormal, PointPinger __instance) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) try { if (!ModConfig.TeleportToPing) { return; } Character val = (((Object)(object)__instance != (Object)null) ? __instance.character : null); if ((Object)(object)val == (Object)null) { return; } PhotonView photonView = ((MonoBehaviourPun)val).photonView; Player val2 = ((photonView != null) ? photonView.Owner : null); if (val2 != null && val2 == PhotonNetwork.LocalPlayer) { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !localCharacter.data.dead) { Vector3 val3 = point + Vector3.up; ((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val3, true }); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[PointPingPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(RunManager), "Update")] public static class RunTimerHoldPatch { private static void Postfix(RunManager __instance) { try { if (!((Object)(object)__instance == (Object)null) && ModConfig.OverrideExpeditionTime) { if (ModConfig.ExpeditionTimeSeconds <= 0.01f) { ModConfig.ExpeditionTimeSeconds = GameApi.RunTimeSeconds(__instance); } GameApi.SetRunTimeLocal(__instance, ModConfig.ExpeditionTimeSeconds); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[RunTimerHoldPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(CustomizationOption), "get_IsLocked")] public static class CosmeticUnlockPatch { private static void Postfix(CustomizationOption __instance, ref bool __result) { try { if (GameApi.IsCosmeticLocallyUnlocked(__instance)) { __result = false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[CosmeticUnlockPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "UseStamina")] public static class StaminaUsePatch { private static bool Prefix(Character __instance, ref float usage, ref bool __result) { try { if ((Object)(object)__instance == (Object)null || !__instance.IsLocal) { return true; } if (ModConfig.InfiniteStamina || usage <= 0f) { __result = true; return false; } float num = (((Object)(object)__instance.data != (Object)null && (__instance.data.isClimbing || __instance.data.isRopeClimbing || __instance.data.isVineClimbing || (Object)(object)__instance.data.currentClimbHandle != (Object)null)) ? ModConfig.ClimbStaminaConsumptionPercent : ModConfig.StaminaConsumptionPercent); usage *= Mathf.Clamp(num, 0f, 500f) / 100f; if (usage <= 0f) { __result = true; return false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[StaminaUsePatch] " + ex.Message)); } } return true; } } [HarmonyPatch(typeof(Character), "AddStamina")] public static class StaminaRegenPatch { private static void Prefix(Character __instance, ref float add) { try { if (!((Object)(object)__instance == (Object)null) && __instance.IsLocal && !(add <= 0f)) { add *= Mathf.Clamp(ModConfig.StaminaRegenPercent, 0f, 500f) / 100f; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[StaminaRegenPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "CanRegenStamina")] public static class StaminaRegenDelayPatch { private static void Postfix(Character __instance, ref bool __result) { try { if (ModConfig.StaminaRegenDelayMod && !((Object)(object)__instance == (Object)null) && __instance.IsLocal && !((Object)(object)__instance.data == (Object)null) && !((Object)(object)__instance.data.currentClimbHandle != (Object)null) && !__instance.IsStuck() && __instance.data.sinceUseStamina < Mathf.Clamp(ModConfig.StaminaRegenDelay, 0f, 10f)) { __result = false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[StaminaRegenDelayPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "Fall")] public static class NoFallingRagdollPatch { private static bool Prefix(Character __instance) { try { if (ModConfig.NoFallingRagdoll && (Object)(object)__instance != (Object)null && __instance.IsLocal) { if ((Object)(object)__instance.data != (Object)null) { __instance.data.fallSeconds = 0f; } return false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[NoFallingRagdollPatch] " + ex.Message)); } } return true; } } [HarmonyPatch(typeof(CharacterMovement), "CheckFallDamage")] public static class NoFallDamagePatch { private static bool Prefix(Character ___character) { try { if (ModConfig.NoFallDamage && (Object)(object)___character != (Object)null && ___character.IsLocal) { if ((Object)(object)___character.data != (Object)null) { ___character.data.fallSeconds = 0f; } return false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[NoFallDamagePatch] " + ex.Message)); } } return true; } } [HarmonyPatch(typeof(CharacterMovement), "FallFactor")] public static class NoFallDamageFactorPatch { private static void Postfix(Character ___character, ref float __result) { try { if (ModConfig.NoFallDamage && (Object)(object)___character != (Object)null && ___character.IsLocal) { __result = 0f; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[NoFallDamageFactorPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(CharacterMovement), "MaxVelDmg")] public static class NoFallDamageVelocityPatch { private static void Postfix(Character ___character, ref float __result) { try { if (ModConfig.NoFallDamage && (Object)(object)___character != (Object)null && ___character.IsLocal) { __result = 0f; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[NoFallDamageVelocityPatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(CharacterMovement), "AcceptableAngle")] public static class NoSlipperySurfacesPatch { private static void Postfix(ref bool __result) { if (ModConfig.NoSlipperySurfaces) { __result = true; } } } [HarmonyPatch(typeof(Lantern), "UpdateFuel")] public static class LanternFuelPatch { private static readonly FieldRef FuelRef = AccessTools.FieldRefAccess("fuel"); private static bool Prefix(Lantern __instance) { try { if (!ModConfig.UnlimitedLanternFuel || (Object)(object)__instance == (Object)null) { return true; } SetFuel(__instance, Mathf.Max(FuelRef.Invoke(__instance), __instance.startingFuel)); return false; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[LanternFuelPatch:Prefix] " + ex.Message)); } return true; } } private static void Postfix(Lantern __instance) { try { if (!((Object)(object)__instance == (Object)null) && !ModConfig.UnlimitedLanternFuel) { float num = Mathf.Clamp(ModConfig.LanternFuelConsumptionPercent, 0f, 500f); if (!(Mathf.Abs(num - 100f) < 0.01f)) { float num2 = FuelRef.Invoke(__instance); num2 += Time.deltaTime * (1f - num / 100f); SetFuel(__instance, Mathf.Clamp(num2, 0f, Mathf.Max(0.01f, __instance.startingFuel))); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[LanternFuelPatch:Postfix] " + ex.Message)); } } } private static void SetFuel(Lantern lantern, float fuel) { FuelRef.Invoke(lantern) = fuel; try { ((ItemComponent)lantern).GetData((DataEntryKey)10).Value = fuel; } catch { } try { Item item = ((ItemComponent)lantern).item; if ((Object)(object)item != (Object)null) { item.SetUseRemainingPercentage(fuel / Mathf.Max(0.01f, lantern.startingFuel)); } } catch { } } } [HarmonyPatch(typeof(Item), "CanUsePrimary")] public static class UnlimitedItemUsePrimaryPatch { private static void Postfix(ref bool __result) { if (ModConfig.UnlimitedItemUses) { __result = true; } } } [HarmonyPatch(typeof(Item), "CanUseSecondary")] public static class UnlimitedItemUseSecondaryPatch { private static void Postfix(ref bool __result) { if (ModConfig.UnlimitedItemUses) { __result = true; } } } [HarmonyPatch(typeof(Action_ReduceUses), "RunAction")] public static class UnlimitedItemReduceUsesPatch { private static bool Prefix() { return !ModConfig.UnlimitedItemUses; } } [HarmonyPatch(typeof(CharacterVoiceHandler), "Update")] public static class GlobalVoicePatch { private static readonly FieldInfo CharacterField = AccessTools.Field(typeof(CharacterVoiceHandler), "m_character"); private static readonly FieldInfo SourceField = AccessTools.Field(typeof(CharacterVoiceHandler), "m_source"); private static readonly FieldInfo AudioLevelField = AccessTools.Field(typeof(CharacterVoiceHandler), "audioLevel"); private static readonly FieldInfo LastFalloffField = AccessTools.Field(typeof(CharacterVoiceHandler), "_lastMeasuredFalloff"); private static void Postfix(CharacterVoiceHandler __instance) { try { if ((Object)(object)__instance == (Object)null) { return; } object? obj = CharacterField?.GetValue(__instance); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val != (Object)null && val.IsLocal) { return; } object obj2 = SourceField?.GetValue(__instance); if (obj2 == null) { obj2 = ((Component)__instance).GetComponent("AudioSource"); } if (obj2 == null) { return; } AudioSource source = (AudioSource)((obj2 is AudioSource) ? obj2 : null); if (!VoiceControl.ShouldForceAudible(val)) { VoiceControl.RestoreVoiceSource(source); return; } float audioLevel = 1f; if (AudioLevelField != null && AudioLevelField.GetValue(__instance) is float num) { audioLevel = Mathf.Clamp01(num); } VoiceControl.ApplyVoiceSource(source, audioLevel); VoiceControl.DisableEcho(((Component)__instance).GetComponent()); LastFalloffField?.SetValue(__instance, 1f); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GlobalVoicePatch] " + ex.Message)); } } } } [HarmonyPatch(typeof(VoiceObscuranceFilter), "Update")] public static class GlobalVoiceNoEchoPatch { private static readonly FieldInfo VoiceHandlerField = AccessTools.Field(typeof(VoiceObscuranceFilter), "_voiceHandler"); private static readonly FieldInfo CharacterField = AccessTools.Field(typeof(CharacterVoiceHandler), "m_character"); private static void Postfix(VoiceObscuranceFilter __instance) { try { if (!((Object)(object)__instance == (Object)null)) { object? obj = VoiceHandlerField?.GetValue(__instance); CharacterVoiceHandler val = (CharacterVoiceHandler)(((obj is CharacterVoiceHandler) ? obj : null) ?? ((Component)__instance).GetComponent()); if (!((Object)(object)val == (Object)null) && VoiceControl.ShouldForceAudible((Character)/*isinst with value type is only supported in some contexts*/)) { VoiceControl.DisableEcho(__instance); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[GlobalVoiceNoEchoPatch] " + ex.Message)); } } } } internal static class PlayerEsp { private static readonly HashSet Seen = new HashSet(); private static readonly List Characters = new List(); private static readonly GUIContent LabelContent = new GUIContent(); private static GUIStyle _label; private static Texture2D _pixel; private static float _nextRefresh; private static int _focusInstanceId; public static void Focus(Character character) { try { _focusInstanceId = (((Object)(object)character != (Object)null) ? ((Object)character).GetInstanceID() : 0); if (_focusInstanceId != 0) { ModConfig.PlayerEsp = true; } } catch { _focusInstanceId = 0; } } public static void ClearFocus() { _focusInstanceId = 0; } public static void Draw() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) try { if (!ModConfig.PlayerEsp || (Event.current != null && (int)Event.current.type != 7)) { return; } Camera val = Camera.main ?? Camera.current; if ((Object)(object)val == (Object)null) { return; } Theme.EnsureBuilt(); EnsureStyle(); RefreshCharacters(); if (!EspPositions.TryObserver(val, out var position)) { return; } float num = Mathf.Max(1f, ModConfig.PlayerEspDistance); float num2 = num * num; for (int i = 0; i < Characters.Count; i++) { Character val2 = Characters[i]; if ((Object)(object)val2 == (Object)null || IsLocal(val2) || !EspPositions.TryCharacter(val2, out var position2)) { continue; } Vector3 val3 = position2 - position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (!(sqrMagnitude > num2)) { float num3 = Mathf.Sqrt(sqrMagnitude); Vector3 val4 = HeadPosition(val2, position2); bool offscreen; Vector2 val5 = ProjectToScreenEdge(val, val4, out offscreen); Rect box = CharacterBox(val, val2, position2, val4, val5, offscreen); bool flag = _focusInstanceId != 0 && ((Object)val2).GetInstanceID() == _focusInstanceId; string arg = (IsDead(val2) ? " [dead]" : ""); string text = $"{GameApi.PlayerDisplayName(val2)} {num3:0}m{arg}"; if (flag) { text = ">> " + text; } DrawMarker(val5, text, num3, box, offscreen, flag); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[PlayerEsp] " + ex.Message)); } } } private static void RefreshCharacters() { if (Time.realtimeSinceStartup < _nextRefresh) { return; } _nextRefresh = Time.realtimeSinceStartup + 0.75f; Characters.Clear(); Seen.Clear(); try { GameApi.RefreshPlayers(); } catch { } for (int i = 0; i < GameApi.PlayerChars.Count; i++) { AddCharacter(GameApi.PlayerChars[i]); } try { Character[] array = Object.FindObjectsByType((FindObjectsSortMode)0); for (int j = 0; j < array.Length; j++) { AddCharacter(array[j]); } } catch { } } private static void AddCharacter(Character character) { if ((Object)(object)character == (Object)null) { return; } int instanceID = ((Object)character).GetInstanceID(); if (Seen.Contains(instanceID)) { return; } try { if (character.isBot || character.isZombie || character.isScoutmaster) { return; } } catch { } Seen.Add(instanceID); Characters.Add(character); } private static void DrawMarker(Vector2 center, string text, float distance, Rect box, bool offscreen, bool focused) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_01ea: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(1.15f - distance / Mathf.Max(50f, ModConfig.PlayerEspDistance)); Color color = (focused ? Theme.Donate : Theme.Accent); color.a = Mathf.Lerp(0.55f, 1f, num); Color color2 = default(Color); ((Color)(ref color2))..ctor(0.02f, 0.025f, 0.03f, Mathf.Lerp(0.42f, 0.82f, num)); if (ModConfig.PlayerEspLines || focused) { DrawLine(new Vector2((float)Screen.width * 0.5f, (float)Screen.height - 18f), (Vector2)(offscreen ? center : new Vector2(((Rect)(ref box)).center.x, ((Rect)(ref box)).yMax)), color, focused ? 2.5f : 1.5f); } if (ModConfig.PlayerEspBoxes) { if (offscreen) { DrawEdgeMarker(center, color); } else { DrawBox(box, color, focused ? 2.5f : 1.5f); } } LabelContent.text = text; Vector2 val = _label.CalcSize(LabelContent); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(Mathf.Clamp(center.x - val.x * 0.5f - 8f, 4f, (float)Screen.width - val.x - 16f), Mathf.Clamp(center.y - 34f, 4f, (float)Screen.height - 26f), val.x + 16f, 24f); DrawRect(val2, color2); DrawRect(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).yMax - 2f, ((Rect)(ref val2)).width, 2f), color); GUI.Label(val2, text, _label); float num2 = Mathf.Clamp(24f - distance * 0.02f, 8f, 24f); DrawRect(new Rect(center.x - num2 * 0.5f, center.y - 1f, num2, 2f), color); DrawRect(new Rect(center.x - 1f, center.y - num2 * 0.5f, 2f, num2), color); } private static Vector2 ProjectToScreenEdge(Camera camera, Vector3 world, out bool offscreen) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = camera.WorldToViewportPoint(world); bool flag = val.z <= 0.01f; if (flag) { val.x = 1f - val.x; val.y = 1f - val.y; } offscreen = flag || val.x < 0f || val.x > 1f || val.y < 0f || val.y > 1f; if (offscreen) { val.x = Mathf.Clamp(val.x, 0.04f, 0.96f); val.y = Mathf.Clamp(val.y, 0.06f, 0.94f); } return new Vector2(val.x * (float)Screen.width, (1f - val.y) * (float)Screen.height); } private static Rect CharacterBox(Camera camera, Character character, Vector3 position, Vector3 head, Vector2 fallback, bool offscreen) { //IL_0004: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (offscreen) { return new Rect(fallback.x - 12f, fallback.y - 12f, 24f, 24f); } float minX = float.MaxValue; float minY = float.MaxValue; float maxX = float.MinValue; float maxY = float.MinValue; int count = 0; try { List list = character.refs?.ragdoll?.partList; if (list != null) { for (int i = 0; i < list.Count; i++) { if (!((Object)(object)list[i] == (Object)null)) { AddPoint(camera.WorldToScreenPoint(((Component)list[i]).transform.position)); } } } } catch { } AddPoint(camera.WorldToScreenPoint(head + Vector3.up * 0.15f)); AddPoint(camera.WorldToScreenPoint(position + Vector3.down * 0.8f)); if (count == 0) { return new Rect(fallback.x - 16f, fallback.y - 32f, 32f, 64f); } float num = Mathf.Max(maxX - minX, 28f); float num2 = Mathf.Max(maxY - minY, 42f); float num3 = (minX + maxX) * 0.5f; float num4 = (minY + maxY) * 0.5f; return new Rect(num3 - num * 0.5f - 4f, num4 - num2 * 0.5f - 4f, num + 8f, num2 + 8f); void AddPoint(Vector3 screen) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!(screen.z <= 0.01f)) { float x = screen.x; float num5 = (float)Screen.height - screen.y; minX = Mathf.Min(minX, x); minY = Mathf.Min(minY, num5); maxX = Mathf.Max(maxX, x); maxY = Mathf.Max(maxY, num5); count++; } } } private static void DrawBox(Rect rect, Color color, float thickness) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_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_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) DrawRect(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin, ((Rect)(ref rect)).width, thickness), color); DrawRect(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax - thickness, ((Rect)(ref rect)).width, thickness), color); DrawRect(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin, thickness, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).xMax - thickness, ((Rect)(ref rect)).yMin, thickness, ((Rect)(ref rect)).height), color); } private static void DrawEdgeMarker(Vector2 center, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0049: 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_0054: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) float num = 10f; DrawRect(new Rect(center.x - num, center.y - num, num * 2f, 2f), color); DrawRect(new Rect(center.x - num, center.y + num, num * 2f, 2f), color); DrawRect(new Rect(center.x - num, center.y - num, 2f, num * 2f), color); DrawRect(new Rect(center.x + num, center.y - num, 2f, num * 2f), color); } private static void DrawLine(Vector2 a, Vector2 b, Color color, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004a: 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_0069: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 matrix = GUI.matrix; Color color2 = GUI.color; float num = Mathf.Atan2(b.y - a.y, b.x - a.x) * 57.29578f; float num2 = Vector2.Distance(a, b); GUI.color = color; GUIUtility.RotateAroundPivot(num, a); GUI.DrawTexture(new Rect(a.x, a.y - width * 0.5f, num2, width), (Texture)(object)_pixel); GUI.matrix = matrix; GUI.color = color2; } private static void EnsureStyle() { //IL_0029: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if ((Object)(object)_pixel == (Object)null) { _pixel = Texture2D.whiteTexture; } if (_label == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 12, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; val.clipping = (TextClipping)1; _label = val; } } private static void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private static Vector3 HeadPosition(Character character, Vector3 center) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_002c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = character.Head + Vector3.up * 0.25f; if (EspPositions.IsFinite(val)) { return val; } } catch { } return center + Vector3.up * 0.7f; } private static bool IsLocal(Character character) { try { return character.IsLocal || (Object)(object)character == (Object)(object)Character.localCharacter; } catch { return (Object)(object)character == (Object)(object)Character.localCharacter; } } private static bool IsDead(Character character) { try { return (Object)(object)character.data != (Object)null && character.data.dead; } catch { return false; } } } internal static class PlayerMeta { public const string VersionKey = "pmx_ver"; private static float _nextPublish; public static void Tick() { //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_008c: Expected O, but got Unknown //IL_008d: Expected O, but got Unknown try { if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { _nextPublish = 0f; } else if (!(Time.realtimeSinceStartup < _nextPublish)) { _nextPublish = Time.realtimeSinceStartup + 10f; if (PhotonNetwork.LocalPlayer.CustomProperties == null || !((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"pmx_ver", out object value) || !string.Equals(value as string, "1.1.2", StringComparison.Ordinal)) { Hashtable val = new Hashtable(); ((Dictionary)val).Add((object)"pmx_ver", (object)"1.1.2"); Hashtable val2 = val; PhotonNetwork.LocalPlayer.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[PlayerMeta] " + ex.Message)); } } } } [BepInPlugin("com.maxkir041.peakmx", "PEAK-MX", "1.1.2")] public class Plugin : BaseUnityPlugin { public const string Guid = "com.maxkir041.peakmx"; public const string Name = "PEAK-MX"; public const string Version = "1.1.2"; internal static ManualLogSource Log; private static bool _menuOpen; private float _lastMenuToggleAt = -999f; private bool _loadedLobbyItems; private bool _updateNoticeDismissed; private Harmony _harmony; private CursorLockMode _savedLock; private bool _savedCursor; internal static bool IsMenuOpen => _menuOpen; private void Awake() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ModConfig.Init(((BaseUnityPlugin)this).Config); Localization.Current = (Lang)ModConfig.Language.Value; UpdateChecker.Init(); VoiceControl.Init(); MxAhgHost.Init(); _harmony = new Harmony("com.maxkir041.peakmx"); _harmony.PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"PEAK-MX v1.1.2 loaded."); } private void OnDestroy() { VoiceControl.Dispose(); MxAhgHost.Dispose(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (!Menu.IsCapturingHotkey && (Input.GetKeyDown(ModConfig.MenuToggleKey.Value) || (_menuOpen && Input.GetKeyDown((KeyCode)27)))) { ToggleMenu(); } try { bool inRoom = PhotonNetwork.InRoom; if (inRoom && !_loadedLobbyItems) { VoiceControl.Init(); GameApi.EnsureItemsLoaded(); GameApi.RefreshPlayers(); _loadedLobbyItems = true; } else if (!inRoom) { _loadedLobbyItems = false; } } catch { } if (_menuOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } AntiCheat.Tick(); MxAhgHost.Tick(); GameApi.TickScheduledActions(); Features.Tick(); PlayerMeta.Tick(); QuickActions.Tick(_menuOpen); } private void ToggleMenu() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!(Time.realtimeSinceStartup - _lastMenuToggleAt < 0.12f)) { _lastMenuToggleAt = Time.realtimeSinceStartup; _menuOpen = !_menuOpen; if (_menuOpen) { _savedLock = Cursor.lockState; _savedCursor = Cursor.visible; } else { Cursor.lockState = _savedLock; Cursor.visible = _savedCursor; } } } private void LateUpdate() { if (_menuOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void OnGUI() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_011c: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (_menuOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; Event current = Event.current; if (!Menu.IsCapturingHotkey && current != null && (int)current.type == 4 && current.keyCode == ModConfig.MenuToggleKey.Value) { GUI.FocusControl((string)null); ToggleMenu(); current.Use(); return; } } Menu.DrawDonateNotice(); if (UpdateChecker.UpdateAvailable && !_updateNoticeDismissed) { float num = Mathf.Min(360f, (float)Screen.width - 24f); Rect val = default(Rect); ((Rect)(ref val))..ctor((float)Screen.width - num - 12f, 12f, num, 84f); GUI.Box(val, "PEAK-MX " + UpdateChecker.LatestVersion); if (GUI.Button(new Rect(((Rect)(ref val)).x + 8f, ((Rect)(ref val)).y + 30f, num - 48f, 38f), "GitHub Releases")) { Application.OpenURL("https://github.com/maxkir041/PEAK-MX/releases"); } if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 34f, ((Rect)(ref val)).y + 30f, 26f, 38f), "X")) { _updateNoticeDismissed = true; } } Menu.DrawAdminNotice(); PlayerEsp.Draw(); ItemEsp.Draw(); WorldEsp.Draw(); if (_menuOpen) { Menu.Draw(); if (Menu.ConsumeCloseRequest()) { ToggleMenu(); } } } } internal static class QuickActions { public struct Definition { public readonly string Id; public readonly string Ru; public readonly string En; public readonly string TipRu; public readonly string TipEn; public Definition(string id, string ru, string en, string tipRu, string tipEn) { Id = id; Ru = ru; En = en; TipRu = tipRu; TipEn = tipEn; } } private static readonly HashSet FavoriteIds = new HashSet(StringComparer.OrdinalIgnoreCase); private static string _favoriteSource; public static readonly Definition[] Actions = new Definition[20] { new Definition("none", "Нет", "None", "Слот выключен.", "This slot is disabled."), new Definition("toggle_fly", "Переключить полет", "Toggle fly", "Включает или выключает полет.", "Turns fly mode on or off."), new Definition("toggle_noclip", "Переключить noclip", "Toggle noclip", "Включает или выключает прохождение через стены во время полета.", "Turns fly noclip on or off."), new Definition("toggle_god", "Переключить бессмертие", "Toggle god mode", "Включает или выключает бессмертие.", "Turns god mode on or off."), new Definition("toggle_infinite_stamina", "Переключить стамину", "Toggle stamina", "Включает или выключает бесконечную стамину.", "Turns infinite stamina on or off."), new Definition("full_stamina", "Заполнить стамину", "Fill stamina", "Сразу заполняет стамину локального персонажа.", "Immediately fills the local character stamina."), new Definition("revive_self", "Воскресить себя", "Revive self", "Пробует воскресить локального персонажа.", "Tries to revive the local character."), new Definition("clear_status", "Вылечить себя", "Cure self", "Очищает все недуги локального персонажа.", "Clears every affliction from the local character."), new Definition("warp_spawn", "Телепорт на спавн", "Warp to spawn", "Телепортирует тебя на твою точку спавна.", "Warps you to your spawn point."), new Definition("toggle_ping_tp", "Переключить ТП к пингу", "Toggle ping TP", "Включает или выключает телепорт к пингу.", "Turns teleport-to-ping on or off."), new Definition("anti_stuck", "Анти-застревание", "Anti-stuck", "Сбрасывает скорость/падение и поднимает персонажа вверх.", "Resets velocity/fall state and lifts the character up."), new Definition("toggle_player_esp", "ESP игроков", "Player ESP", "Включает или выключает ESP игроков.", "Turns player ESP on or off."), new Definition("toggle_item_esp", "ESP предметов", "Item ESP", "Включает или выключает ESP предметов.", "Turns item ESP on or off."), new Definition("toggle_world_esp", "ESP опасностей", "Danger ESP", "Включает или выключает ESP опасностей и важных объектов.", "Turns danger/object ESP on or off."), new Definition("toggle_hear_everyone", "Слышно всех", "Hear everyone", "Включает или выключает локальную слышимость всех игроков.", "Turns local hear-everyone mode on or off."), new Definition("random_outfit", "Случайная одежда", "Random outfit", "Случайно меняет одежду, цвет и остальные категории косметики.", "Randomizes outfit, color, and cosmetic categories."), new Definition("campfire_food", "Еда у костра", "Campfire food", "Спавнит еду у костра под размер лобби.", "Spawns campfire food for the lobby size."), new Definition("campfire_backpacks", "Рюкзаки у костра", "Campfire backpacks", "Спавнит рюкзаки у костра примерно на четверть игроков.", "Spawns campfire backpacks for roughly a quarter of the lobby."), new Definition("campfire_supplies", "Еда + рюкзаки", "Campfire supplies", "Спавнит еду и рюкзаки у костра.", "Spawns campfire food and backpacks."), new Definition("force_win", "Завершить забег", "Force win", "Пробует мгновенно завершить текущий забег победой.", "Tries to instantly finish the current run as a win.") }; public static int FavoriteCount { get { EnsureFavorites(); return FavoriteIds.Count; } } public static void Tick(bool menuOpen) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (menuOpen || Menu.IsCapturingHotkey || AntiCheat.ClientToolsLocked || ModConfig.QuickActionKeys == null || ModConfig.QuickActionIds == null) { return; } for (int i = 0; i < 8; i++) { ConfigEntry obj = ModConfig.QuickActionKeys[i]; KeyCode val = (KeyCode)((obj != null) ? ((int)obj.Value) : 0); if ((int)val != 0 && Input.GetKeyDown(val)) { Execute(ModConfig.QuickActionIds[i]?.Value); } } } public static int IndexOf(string id) { string b = NormalizeId(id); for (int i = 0; i < Actions.Length; i++) { if (string.Equals(Actions[i].Id, b, StringComparison.OrdinalIgnoreCase)) { return i; } } return 0; } public static string NormalizeId(string id) { if (string.IsNullOrWhiteSpace(id)) { return "none"; } string text = id.Trim().ToLowerInvariant(); if (IndexOfKnown(text) < 0) { return "none"; } return text; } public static string Label(string id, bool russian) { int num = IndexOf(id); Definition definition = Actions[Mathf.Clamp(num, 0, Actions.Length - 1)]; if (!russian) { return definition.En; } return definition.Ru; } public static string Tip(string id, bool russian) { int num = IndexOf(id); Definition definition = Actions[Mathf.Clamp(num, 0, Actions.Length - 1)]; if (!russian) { return definition.TipEn; } return definition.TipRu; } public static void SetSlotAction(int slot, string id) { if (slot >= 0 && slot < 8 && ModConfig.QuickActionIds != null) { ModConfig.QuickActionIds[slot].Value = NormalizeId(id); } } public static bool IsFavorite(string id) { EnsureFavorites(); return FavoriteIds.Contains(NormalizeId(id)); } public static void SetFavorite(string id, bool favorite) { string text = NormalizeId(id); if (text == "none" || ModConfig.FavoriteActionIds == null) { return; } EnsureFavorites(); if (favorite) { FavoriteIds.Add(text); } else { FavoriteIds.Remove(text); } List list = new List(); for (int i = 1; i < Actions.Length; i++) { if (FavoriteIds.Contains(Actions[i].Id)) { list.Add(Actions[i].Id); } } string text2 = string.Join(";", list.ToArray()); ModConfig.FavoriteActionIds.Value = text2; _favoriteSource = text2; } private static int IndexOfKnown(string id) { for (int i = 0; i < Actions.Length; i++) { if (string.Equals(Actions[i].Id, id, StringComparison.OrdinalIgnoreCase)) { return i; } } return -1; } public static void Execute(string id) { string text = NormalizeId(id); if (text == "none") { return; } try { Character localCharacter = Character.localCharacter; switch (text) { case "toggle_fly": ModConfig.Fly = !ModConfig.Fly; break; case "toggle_noclip": ModConfig.Noclip = !ModConfig.Noclip; if (ModConfig.Noclip) { ModConfig.Fly = true; } break; case "toggle_god": ModConfig.GodMode = !ModConfig.GodMode; break; case "toggle_infinite_stamina": ModConfig.InfiniteStamina = !ModConfig.InfiniteStamina; break; case "full_stamina": GameApi.FullStamina(localCharacter); break; case "revive_self": GameApi.ReviveSelf(); break; case "clear_status": GameApi.ClearAllStatus(localCharacter); break; case "warp_spawn": GameApi.WarpToSpawn(); break; case "toggle_ping_tp": ModConfig.TeleportToPing = !ModConfig.TeleportToPing; break; case "anti_stuck": GameApi.AntiStuck(localCharacter); break; case "toggle_player_esp": ModConfig.PlayerEsp = !ModConfig.PlayerEsp; break; case "toggle_item_esp": ModConfig.ItemEsp = !ModConfig.ItemEsp; break; case "toggle_world_esp": if (ModConfig.WorldEsp != null) { ModConfig.WorldEsp.Value = !ModConfig.WorldEsp.Value; } break; case "toggle_hear_everyone": ModConfig.GlobalVoice = !ModConfig.GlobalVoice; break; case "random_outfit": GameApi.RandomizeOutfitAndColor(); break; case "campfire_food": GameApi.SpawnCampfireFoodForLobby(); break; case "campfire_backpacks": GameApi.SpawnCampfireBackpacksForLobby(); break; case "campfire_supplies": GameApi.SpawnCampfireSuppliesForLobby(); break; case "force_win": GameApi.ForceWin(); break; } GameApi.AddAdminLog("quick action: " + Label(text, Localization.Current == Lang.Russian)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[QuickActions] " + ex.Message)); } } } private static void EnsureFavorites() { string text = ModConfig.FavoriteActionIds?.Value ?? ""; if (string.Equals(text, _favoriteSource, StringComparison.Ordinal)) { return; } FavoriteIds.Clear(); string[] array = text.Split(new char[4] { ';', ',', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text2 = NormalizeId(array[i]); if (text2 != "none") { FavoriteIds.Add(text2); } } _favoriteSource = text; } } public static class SteamAch { private readonly struct LinkedAchievement { public readonly STEAMSTATTYPE Stat; public readonly int RequiredValue; public LinkedAchievement(STEAMSTATTYPE stat, int requiredValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Stat = stat; RequiredValue = requiredValue; } } private static ACHIEVEMENTTYPE[] _all; private static readonly Dictionary _iconCache = new Dictionary(); private static readonly Dictionary _nameCache = new Dictionary(); private static readonly Dictionary _descCache = new Dictionary(); private static readonly Dictionary _linked = new Dictionary { { (ACHIEVEMENTTYPE)51, new LinkedAchievement((STEAMSTATTYPE)18, 1) }, { (ACHIEVEMENTTYPE)52, new LinkedAchievement((STEAMSTATTYPE)19, 1) }, { (ACHIEVEMENTTYPE)53, new LinkedAchievement((STEAMSTATTYPE)20, 1) }, { (ACHIEVEMENTTYPE)54, new LinkedAchievement((STEAMSTATTYPE)21, 1) }, { (ACHIEVEMENTTYPE)55, new LinkedAchievement((STEAMSTATTYPE)22, 1) }, { (ACHIEVEMENTTYPE)56, new LinkedAchievement((STEAMSTATTYPE)23, 1) }, { (ACHIEVEMENTTYPE)57, new LinkedAchievement((STEAMSTATTYPE)24, 100) }, { (ACHIEVEMENTTYPE)58, new LinkedAchievement((STEAMSTATTYPE)25, 1) }, { (ACHIEVEMENTTYPE)59, new LinkedAchievement((STEAMSTATTYPE)26, 1) }, { (ACHIEVEMENTTYPE)60, new LinkedAchievement((STEAMSTATTYPE)27, 1) }, { (ACHIEVEMENTTYPE)61, new LinkedAchievement((STEAMSTATTYPE)28, 1) }, { (ACHIEVEMENTTYPE)62, new LinkedAchievement((STEAMSTATTYPE)29, 1) }, { (ACHIEVEMENTTYPE)63, new LinkedAchievement((STEAMSTATTYPE)30, 1) }, { (ACHIEVEMENTTYPE)64, new LinkedAchievement((STEAMSTATTYPE)31, 1) }, { (ACHIEVEMENTTYPE)65, new LinkedAchievement((STEAMSTATTYPE)32, 1) }, { (ACHIEVEMENTTYPE)66, new LinkedAchievement((STEAMSTATTYPE)33, 1) }, { (ACHIEVEMENTTYPE)68, new LinkedAchievement((STEAMSTATTYPE)34, 1) }, { (ACHIEVEMENTTYPE)69, new LinkedAchievement((STEAMSTATTYPE)35, 1) }, { (ACHIEVEMENTTYPE)70, new LinkedAchievement((STEAMSTATTYPE)36, 1) }, { (ACHIEVEMENTTYPE)71, new LinkedAchievement((STEAMSTATTYPE)37, 1) }, { (ACHIEVEMENTTYPE)72, new LinkedAchievement((STEAMSTATTYPE)38, 1) } }; private static readonly Dictionary _ruNames = new Dictionary { { (ACHIEVEMENTTYPE)1, "Ты старался" }, { (ACHIEVEMENTTYPE)2, "Пляжный сборщик" }, { (ACHIEVEMENTTYPE)3, "Первопроходец" }, { (ACHIEVEMENTTYPE)4, "Альпинист" }, { (ACHIEVEMENTTYPE)5, "Вулканолог" }, { (ACHIEVEMENTTYPE)6, "Повар" }, { (ACHIEVEMENTTYPE)7, "Счастливый турист" }, { (ACHIEVEMENTTYPE)8, "Боулдеринг" }, { (ACHIEVEMENTTYPE)9, "Токсиколог" }, { (ACHIEVEMENTTYPE)10, "Собиратель" }, { (ACHIEVEMENTTYPE)11, "Эзотерика" }, { (ACHIEVEMENTTYPE)12, "Покоритель пика" }, { (ACHIEVEMENTTYPE)13, "Одинокий волк" }, { (ACHIEVEMENTTYPE)14, "Спасение в последний момент" }, { (ACHIEVEMENTTYPE)15, "Воздухоплаватель" }, { (ACHIEVEMENTTYPE)16, "Не оставляй следов" }, { (ACHIEVEMENTTYPE)17, "Скоростной альпинист" }, { (ACHIEVEMENTTYPE)18, "Бинг-Бонг" }, { (ACHIEVEMENTTYPE)19, "Натуралист" }, { (ACHIEVEMENTTYPE)20, "Гурман" }, { (ACHIEVEMENTTYPE)21, "Микология" }, { (ACHIEVEMENTTYPE)22, "Первая помощь" }, { (ACHIEVEMENTTYPE)23, "Выживальщик" }, { (ACHIEVEMENTTYPE)24, "Серенада животным" }, { (ACHIEVEMENTTYPE)25, "Древовед" }, { (ACHIEVEMENTTYPE)26, "Наставник" }, { (ACHIEVEMENTTYPE)27, "Вязание узлов" }, { (ACHIEVEMENTTYPE)28, "Готовность к ЧС" }, { (ACHIEVEMENTTYPE)29, "Восхождение" }, { (ACHIEVEMENTTYPE)30, "Расхититель" }, { (ACHIEVEMENTTYPE)31, "Книжный червь" }, { (ACHIEVEMENTTYPE)32, "Выносливость" }, { (ACHIEVEMENTTYPE)40, "Находчивость" }, { (ACHIEVEMENTTYPE)41, "Кочевник" }, { (ACHIEVEMENTTYPE)42, "Абсолют" }, { (ACHIEVEMENTTYPE)43, "Спокойствие" }, { (ACHIEVEMENTTYPE)44, "Игла" }, { (ACHIEVEMENTTYPE)45, "Аэронавтика" }, { (ACHIEVEMENTTYPE)46, "Чистое золото" }, { (ACHIEVEMENTTYPE)47, "Сорвиголова" }, { (ACHIEVEMENTTYPE)48, "Мегаэнтомология" }, { (ACHIEVEMENTTYPE)49, "Астрономия" }, { (ACHIEVEMENTTYPE)50, "Теплее некуда" }, { (ACHIEVEMENTTYPE)51, "Лесничий" }, { (ACHIEVEMENTTYPE)52, "Лёгкий шаг" }, { (ACHIEVEMENTTYPE)53, "Защита от паутины" }, { (ACHIEVEMENTTYPE)54, "Встреча с нежитью" }, { (ACHIEVEMENTTYPE)55, "Продвинутая микология" }, { (ACHIEVEMENTTYPE)56, "Реакция на бедствие" }, { (ACHIEVEMENTTYPE)57, "Кальциевая диета" }, { (ACHIEVEMENTTYPE)58, "Соревновательное обжорство" }, { (ACHIEVEMENTTYPE)59, "Прикладная эзотерика" }, { (ACHIEVEMENTTYPE)60, "Микоакробатика" }, { (ACHIEVEMENTTYPE)61, "Криптогастрономия" }, { (ACHIEVEMENTTYPE)62, "Странник" }, { (ACHIEVEMENTTYPE)63, "Звонарь" }, { (ACHIEVEMENTTYPE)64, "Хорошо отдохнул" }, { (ACHIEVEMENTTYPE)65, "Шут" }, { (ACHIEVEMENTTYPE)66, "Дельтапланеризм" }, { (ACHIEVEMENTTYPE)68, "Средневековая история" }, { (ACHIEVEMENTTYPE)69, "Последний шанс" }, { (ACHIEVEMENTTYPE)70, "Экзорцист" }, { (ACHIEVEMENTTYPE)71, "Стрельба из лука" }, { (ACHIEVEMENTTYPE)72, "Правило ноль" } }; public static ACHIEVEMENTTYPE[] AllTypes { get { //IL_0030: 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_0036: 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) if (_all != null) { return _all; } List list = new List(); foreach (ACHIEVEMENTTYPE value in Enum.GetValues(typeof(ACHIEVEMENTTYPE))) { if (IsVisibleAchievement(value)) { list.Add(value); } } _all = list.ToArray(); return _all; } } private static bool Ready { get { try { return SteamAPI.IsSteamRunning() && SteamUser.BLoggedOn(); } catch { return false; } } } private static AchievementManager Manager { get { try { return Singleton.Instance; } catch { return null; } } } public unsafe static string Id(ACHIEVEMENTTYPE t) { return ((object)(*(ACHIEVEMENTTYPE*)(&t))/*cast due to .constrained prefix*/).ToString(); } private static bool IsVisibleAchievement(ACHIEVEMENTTYPE t) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)t == 0 || t - 33 <= 6 || (int)t == 67) { return false; } return true; } public static bool IsUnlocked(ACHIEVEMENTTYPE t) { //IL_000a: 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_0015: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return false; } try { int value; if (TryGetLinked(t, out var linked)) { return TryGetStat(linked.Stat, out value) && value >= linked.RequiredValue; } bool flag = default(bool); return SteamUserStats.GetAchievement(Id(t), ref flag) && flag; } catch { return false; } } public static void Unlock(ACHIEVEMENTTYPE t, bool track = true) { //IL_0055: 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_0013: 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_001e: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } try { if (!IsUnlocked(t)) { if (TryGetLinked(t, out var linked)) { SetStat(linked.Stat, linked.RequiredValue); return; } SteamUserStats.SetAchievement(Id(t)); SteamUserStats.StoreStats(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[Ach] Unlock {t}: {ex.Message}"); } } } public static void Revoke(ACHIEVEMENTTYPE t, bool track = true) { //IL_004e: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } try { if (IsUnlocked(t)) { if (TryGetLinked(t, out var linked)) { SetStat(linked.Stat, 0); } SteamUserStats.ClearAchievement(Id(t)); SteamUserStats.StoreStats(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[Ach] Revoke {t}: {ex.Message}"); } } } public static void Toggle(ACHIEVEMENTTYPE t) { //IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references) if (IsUnlocked(t)) { Revoke(t); } else { Unlock(t); } } public static void UnlockAll() { //IL_0018: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } try { int num = 0; ACHIEVEMENTTYPE[] allTypes = AllTypes; foreach (ACHIEVEMENTTYPE t in allTypes) { if (!IsUnlocked(t)) { Unlock(t, track: false); num++; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[Ach] UnlockAll: " + ex.Message)); } } } public static void RevokeAll() { //IL_0018: 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_0021: Unknown result type (might be due to invalid IL or missing references) if (!Ready) { return; } try { int num = 0; ACHIEVEMENTTYPE[] allTypes = AllTypes; foreach (ACHIEVEMENTTYPE t in allTypes) { if (IsUnlocked(t)) { Revoke(t, track: false); num++; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[Ach] RevokeAll: " + ex.Message)); } } } public static int UnlockedCount() { int num = 0; ACHIEVEMENTTYPE[] allTypes = AllTypes; for (int i = 0; i < allTypes.Length; i++) { if (IsUnlocked(allTypes[i])) { num++; } } return num; } public static string DisplayName(ACHIEVEMENTTYPE t) { //IL_001e: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) if (Localization.Current == Lang.Russian && _ruNames.TryGetValue(t, out var value)) { return value; } if (_nameCache.TryGetValue(t, out var value2)) { return value2; } string text = null; if (Ready) { try { string achievementDisplayAttribute = SteamUserStats.GetAchievementDisplayAttribute(Id(t), "name"); if (!string.IsNullOrEmpty(achievementDisplayAttribute)) { text = achievementDisplayAttribute; } } catch { } } if (text == null) { text = Prettify(Id(t)); } _nameCache[t] = text; return text; } public static string Desc(ACHIEVEMENTTYPE t) { //IL_0023: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (Localization.Current == Lang.Russian) { return "Достижение PEAK: " + DisplayName(t) + "."; } if (_descCache.TryGetValue(t, out var value)) { return value; } string text = ""; if (Ready) { try { text = SteamUserStats.GetAchievementDisplayAttribute(Id(t), "desc") ?? ""; } catch { } } _descCache[t] = text; return text; } public static Texture2D Icon(ACHIEVEMENTTYPE t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) string text = Id(t); if (_iconCache.TryGetValue(text, out var value)) { return value; } if (!Ready) { return null; } try { int achievementIcon = SteamUserStats.GetAchievementIcon(text); if (achievementIcon == 0) { return null; } uint num = default(uint); uint num2 = default(uint); if (!SteamUtils.GetImageSize(achievementIcon, ref num, ref num2) || num == 0 || num2 == 0) { return null; } byte[] array = new byte[num * num2 * 4]; if (!SteamUtils.GetImageRGBA(achievementIcon, array, array.Length)) { return null; } Texture2D val = new Texture2D((int)num, (int)num2, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1 }; int num3 = (int)num; int num4 = (int)num2; Color32[] array2 = (Color32[])(object)new Color32[num3 * num4]; for (int i = 0; i < num4; i++) { int num5 = i * num3 * 4; int num6 = (num4 - 1 - i) * num3; for (int j = 0; j < num3; j++) { int num7 = num5 + j * 4; array2[num6 + j] = new Color32(array[num7], array[num7 + 1], array[num7 + 2], array[num7 + 3]); } } val.SetPixels32(array2); val.Apply(); _iconCache[text] = val; return val; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"[Ach] Icon {t}: {ex.Message}"); } return null; } } public static void SetMaxAscent(int value) { SetStat((STEAMSTATTYPE)13, value); } public static void SetStatValue(STEAMSTATTYPE stat, int value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetStat(stat, value); } public static void UnlockAllCosmetics() { UnlockAll(); if (!TryGetStat((STEAMSTATTYPE)13, out var value) || value < 8) { SetMaxAscent(8); SetStat((STEAMSTATTYPE)6, 1); } } private static bool TryGetLinked(ACHIEVEMENTTYPE t, out LinkedAchievement linked) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return _linked.TryGetValue(t, out linked); } private unsafe static bool TryGetStat(STEAMSTATTYPE stat, out int value) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) value = 0; AchievementManager manager = Manager; if ((Object)(object)manager != (Object)null) { try { return manager.GetSteamStatInt(stat, ref value); } catch { } } if (!Ready) { return false; } try { return SteamUserStats.GetStat(((object)(*(STEAMSTATTYPE*)(&stat))/*cast due to .constrained prefix*/).ToString(), ref value); } catch { return false; } } private unsafe static void SetStat(STEAMSTATTYPE stat, int value) { //IL_0012: 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_007f: Unknown result type (might be due to invalid IL or missing references) bool flag = false; AchievementManager manager = Manager; if ((Object)(object)manager != (Object)null) { try { manager.SetSteamStat(stat, value); flag = true; } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"[Ach] Manager SetStat {stat}: {ex.Message}"); } } } if (!Ready) { return; } try { if (!flag) { SteamUserStats.SetStat(((object)(*(STEAMSTATTYPE*)(&stat))/*cast due to .constrained prefix*/).ToString(), value); } SteamUserStats.StoreStats(); } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)$"[Ach] SetStat {stat}: {ex2.Message}"); } } } private static string Prettify(string enumName) { if (string.IsNullOrEmpty(enumName)) { return enumName; } if (enumName.EndsWith("Badge")) { enumName = enumName.Substring(0, enumName.Length - 5); } StringBuilder stringBuilder = new StringBuilder(enumName.Length + 6); for (int i = 0; i < enumName.Length; i++) { char c = enumName[i]; if (i > 0 && char.IsUpper(c) && !char.IsUpper(enumName[i - 1])) { stringBuilder.Append(' '); } stringBuilder.Append(c); } return stringBuilder.ToString(); } } public static class Theme { public const string DefaultAccentHex = "#41D58A"; public const string DefaultActionHex = "#599FF4"; public static readonly Color Bg = C(0.071f, 0.082f, 0.098f); public static Color HeaderBg = C(0.114f, 0.255f, 0.18f); public static Color HeaderDim = C(0.078f, 0.157f, 0.122f); public static readonly Color Panel = C(0.133f, 0.149f, 0.176f); public static readonly Color PanelLight = C(0.18f, 0.2f, 0.231f); public static readonly Color PanelHi = C(0.235f, 0.259f, 0.298f); public static Color Accent = C(0.255f, 0.835f, 0.541f); public static Color AccentHi = C(0.345f, 0.918f, 0.616f); public static Color AccentDim = C(0.157f, 0.392f, 0.282f); public static readonly Color Text = C(0.949f, 0.957f, 0.965f); public static readonly Color TextDim = C(0.722f, 0.753f, 0.792f); public static Color Donate = C(0.349f, 0.624f, 0.957f); public static Color DonateHi = C(0.447f, 0.71f, 1f); public static readonly Color Gold = C(1f, 0.851f, 0.4f); public static Color DarkOnAccent = C(0.043f, 0.094f, 0.067f); public static Color TextOnAction = Color.white; public static GUIStyle Window; public static GUIStyle Title; public static GUIStyle Subtitle; public static GUIStyle Section; public static GUIStyle Label; public static GUIStyle LabelDim; public static GUIStyle DonateText; public static GUIStyle TipText; public static GUIStyle NavItem; public static GUIStyle NavItemActive; public static GUIStyle Toggle; public static GUIStyle ToggleOn; public static GUIStyle DonateBtn; public static GUIStyle LinkBtn; public static GUIStyle CloseBtn; public static GUIStyle DangerBtn; public static GUIStyle SuccessBtn; public static GUIStyle SliderBar; public static GUIStyle SliderThumb; public static GUIStyle Panel9; public static GUIStyle Tooltip; public static GUIStyle Card; public static GUIStyle SwitchOn; public static GUIStyle SwitchOff; public static GUIStyle RowLabel; public static GUIStyle RowHover; public static GUIStyle ListItem; public static GUIStyle ListItemActive; public static GUIStyle Chip; public static GUIStyle ChipActive; public static GUIStyle FoldoutBtn; public static GUIStyle FoldoutBtnOpen; public static GUIStyle TextInput; public static GUIStyle TextArea; public static Texture2D KnobTex; private static bool _built; private static string _builtAccentHex; private static string _builtActionHex; public static int Version { get; private set; } public static void EnsureBuilt() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0215: Expected O, but got Unknown //IL_021f: 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_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_02f9: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Expected O, but got Unknown //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Expected O, but got Unknown //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Expected O, but got Unknown //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Expected O, but got Unknown //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Expected O, but got Unknown //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Expected O, but got Unknown //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Expected O, but got Unknown //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Expected O, but got Unknown //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Expected O, but got Unknown //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Expected O, but got Unknown //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Expected O, but got Unknown //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Expected O, but got Unknown //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Expected O, but got Unknown //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Expected O, but got Unknown //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Expected O, but got Unknown //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Expected O, but got Unknown //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Expected O, but got Unknown //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Expected O, but got Unknown //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Expected O, but got Unknown //IL_0800: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Expected O, but got Unknown //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0875: Expected O, but got Unknown //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Expected O, but got Unknown //IL_088d: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Expected O, but got Unknown //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_08fb: Expected O, but got Unknown //IL_0919: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_096c: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Expected O, but got Unknown //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a16: Expected O, but got Unknown //IL_0a1f: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Expected O, but got Unknown //IL_0a2e: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a9f: Unknown result type (might be due to invalid IL or missing references) //IL_0aa9: Expected O, but got Unknown //IL_0ab2: Unknown result type (might be due to invalid IL or missing references) //IL_0abc: Expected O, but got Unknown //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0b0f: Unknown result type (might be due to invalid IL or missing references) //IL_0b19: Expected O, but got Unknown //IL_0b22: Unknown result type (might be due to invalid IL or missing references) //IL_0b2c: Expected O, but got Unknown //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Unknown result type (might be due to invalid IL or missing references) //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b94: Expected O, but got Unknown //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Expected O, but got Unknown //IL_0bac: Unknown result type (might be due to invalid IL or missing references) //IL_0bb1: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0bdb: Unknown result type (might be due to invalid IL or missing references) //IL_0be6: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0bf6: Expected O, but got Unknown //IL_0bf6: Unknown result type (might be due to invalid IL or missing references) //IL_0bfb: Unknown result type (might be due to invalid IL or missing references) //IL_0c05: Expected O, but got Unknown //IL_0c05: Unknown result type (might be due to invalid IL or missing references) //IL_0c0b: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Expected O, but got Unknown //IL_0c2a: Unknown result type (might be due to invalid IL or missing references) //IL_0c2f: Unknown result type (might be due to invalid IL or missing references) //IL_0c3a: Unknown result type (might be due to invalid IL or missing references) //IL_0c45: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c54: Expected O, but got Unknown //IL_0c54: Unknown result type (might be due to invalid IL or missing references) //IL_0c5a: Unknown result type (might be due to invalid IL or missing references) //IL_0c6b: Unknown result type (might be due to invalid IL or missing references) //IL_0c71: Unknown result type (might be due to invalid IL or missing references) //IL_0c82: Unknown result type (might be due to invalid IL or missing references) //IL_0c88: Unknown result type (might be due to invalid IL or missing references) //IL_0c9e: Expected O, but got Unknown string text = NormalizeHex(ModConfig.AccentColorHex?.Value, "#41D58A"); string text2 = NormalizeHex(ModConfig.ActionColorHex?.Value, "#599FF4"); bool flag = !string.Equals(_builtAccentHex, text, StringComparison.OrdinalIgnoreCase) || !string.Equals(_builtActionHex, text2, StringComparison.OrdinalIgnoreCase); if (!_built || flag) { ApplyPalette(text, text2); _builtAccentHex = text; _builtActionHex = text2; Version++; _built = true; Window = Rounded(GUI.skin.box, Bg, 14, Text); Window.padding = new RectOffset(0, 0, 0, 0); Panel9 = Rounded(GUI.skin.box, Panel, 12, Text); Panel9.padding = new RectOffset(12, 12, 10, 10); Tooltip = Rounded(GUI.skin.box, C(0.05f, 0.058f, 0.07f, 0.98f), 8, Text); Tooltip.alignment = (TextAnchor)0; Tooltip.fontSize = 12; Tooltip.wordWrap = true; Tooltip.padding = new RectOffset(12, 12, 10, 10); GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 19, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; Title = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 11 }; val2.normal.textColor = C(0.82f, 0.92f, 0.86f); Subtitle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)1 }; val3.normal.textColor = Accent; val3.margin = new RectOffset(2, 0, 10, 4); Section = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 12 }; val4.normal.textColor = Text; val4.wordWrap = true; Label = val4; GUIStyle val5 = new GUIStyle(GUI.skin.label) { fontSize = 11 }; val5.normal.textColor = TextDim; val5.wordWrap = true; LabelDim = val5; GUIStyle val6 = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)1, wordWrap = true }; val6.normal.textColor = Gold; DonateText = val6; GUIStyle val7 = new GUIStyle(GUI.skin.label) { fontSize = 12, wordWrap = true }; val7.normal.textColor = Gold; val7.padding = new RectOffset(10, 10, 6, 6); TipText = val7; NavItem = Rounded(GUI.skin.button, Panel, 8, TextDim); NavItem.alignment = (TextAnchor)3; NavItem.fontSize = 13; NavItem.padding = new RectOffset(14, 10, 8, 8); NavItem.margin = new RectOffset(0, 2, 2, 2); SetHover(NavItem, PanelHi, Color.white); NavItemActive = Rounded(GUI.skin.button, AccentDim, 8, Color.white); NavItemActive.alignment = (TextAnchor)3; NavItemActive.fontSize = 13; NavItemActive.fontStyle = (FontStyle)1; NavItemActive.padding = new RectOffset(14, 10, 8, 8); NavItemActive.margin = new RectOffset(0, 2, 2, 2); SetHover(NavItemActive, AccentDim, Color.white); Toggle = Rounded(GUI.skin.button, PanelLight, 8, Text); Toggle.alignment = (TextAnchor)3; Toggle.fontSize = 13; Toggle.padding = new RectOffset(14, 12, 10, 10); Toggle.margin = new RectOffset(0, 8, 4, 0); SetHover(Toggle, PanelHi, Color.white); ToggleOn = Rounded(GUI.skin.button, Accent, 8, DarkOnAccent); ToggleOn.alignment = (TextAnchor)3; ToggleOn.fontSize = 13; ToggleOn.fontStyle = (FontStyle)1; ToggleOn.padding = new RectOffset(14, 12, 10, 10); ToggleOn.margin = new RectOffset(0, 8, 4, 0); SetHover(ToggleOn, AccentHi, DarkOnAccent); DonateBtn = Rounded(GUI.skin.button, Donate, 8, TextOnAction); DonateBtn.fontSize = 14; DonateBtn.wordWrap = false; DonateBtn.fontStyle = (FontStyle)1; DonateBtn.padding = new RectOffset(14, 14, 7, 7); SetHover(DonateBtn, DonateHi, TextOnAction); LinkBtn = Rounded(GUI.skin.button, PanelLight, 7, Text); LinkBtn.fontSize = 12; LinkBtn.fontStyle = (FontStyle)1; LinkBtn.padding = new RectOffset(12, 12, 7, 7); LinkBtn.margin = new RectOffset(0, 6, 2, 2); SetHover(LinkBtn, AccentDim, Color.white); TextInput = Rounded(GUI.skin.textField, PanelLight, 7, Text); TextInput.fontSize = 12; TextInput.padding = new RectOffset(10, 10, 7, 7); TextInput.margin = new RectOffset(0, 6, 2, 2); TextInput.wordWrap = false; TextInput.clipping = (TextClipping)1; TextArea = Rounded(GUI.skin.textArea, PanelLight, 7, Text); TextArea.fontSize = 12; TextArea.padding = new RectOffset(10, 10, 8, 8); TextArea.margin = new RectOffset(0, 6, 2, 2); TextArea.wordWrap = true; CloseBtn = new GUIStyle(LinkBtn) { alignment = (TextAnchor)4 }; DangerBtn = Rounded(GUI.skin.button, C(0.725f, 0.16f, 0.17f), 7, Color.white); DangerBtn.fontSize = 12; DangerBtn.fontStyle = (FontStyle)1; DangerBtn.padding = new RectOffset(12, 12, 7, 7); DangerBtn.margin = new RectOffset(0, 6, 2, 2); SetHover(DangerBtn, C(0.92f, 0.22f, 0.23f), Color.white); SuccessBtn = Rounded(GUI.skin.button, AccentDim, 7, Color.white); SuccessBtn.fontSize = 12; SuccessBtn.fontStyle = (FontStyle)1; SuccessBtn.padding = new RectOffset(12, 12, 7, 7); SuccessBtn.margin = new RectOffset(0, 6, 2, 2); SetHover(SuccessBtn, Accent, DarkOnAccent); FoldoutBtn = Rounded(GUI.skin.button, PanelLight, 9, Text); FoldoutBtn.alignment = (TextAnchor)3; FoldoutBtn.fontSize = 13; FoldoutBtn.fontStyle = (FontStyle)1; FoldoutBtn.padding = new RectOffset(12, 12, 8, 8); FoldoutBtn.margin = new RectOffset(0, 0, 0, 0); SetHover(FoldoutBtn, PanelHi, Color.white); FoldoutBtnOpen = Rounded(GUI.skin.button, AccentDim, 9, Color.white); FoldoutBtnOpen.alignment = (TextAnchor)3; FoldoutBtnOpen.fontSize = 13; FoldoutBtnOpen.fontStyle = (FontStyle)1; FoldoutBtnOpen.padding = new RectOffset(12, 12, 8, 8); FoldoutBtnOpen.margin = new RectOffset(0, 0, 0, 0); SetHover(FoldoutBtnOpen, AccentDim, Color.white); Card = Rounded(GUI.skin.box, C(0.102f, 0.117f, 0.141f), 12, Text); Card.padding = new RectOffset(14, 14, 12, 14); Card.margin = new RectOffset(0, 0, 0, 12); RowHover = Rounded(GUI.skin.box, C(0.18f, 0.2f, 0.231f, 0.55f), 8, Text); SwitchOn = Rounded(GUI.skin.box, Accent, 11, Text); SwitchOff = Rounded(GUI.skin.box, C(0.255f, 0.278f, 0.318f), 11, Text); GUIStyle val8 = new GUIStyle(GUI.skin.label) { fontSize = 13, alignment = (TextAnchor)3 }; val8.normal.textColor = Text; RowLabel = val8; ListItem = Rounded(GUI.skin.button, Panel, 7, Text); ListItem.alignment = (TextAnchor)3; ListItem.fontSize = 13; ListItem.wordWrap = false; ListItem.clipping = (TextClipping)1; ListItem.padding = new RectOffset(12, 10, 5, 5); ListItem.margin = new RectOffset(0, 8, 2, 2); SetHover(ListItem, PanelHi, Color.white); ListItemActive = Rounded(GUI.skin.button, AccentDim, 7, Color.white); ListItemActive.alignment = (TextAnchor)3; ListItemActive.fontSize = 13; ListItemActive.fontStyle = (FontStyle)1; ListItemActive.wordWrap = false; ListItemActive.clipping = (TextClipping)1; ListItemActive.padding = new RectOffset(12, 10, 5, 5); ListItemActive.margin = new RectOffset(0, 8, 2, 2); SetHover(ListItemActive, AccentDim, Color.white); Chip = Rounded(GUI.skin.button, Panel, 7, TextDim); Chip.alignment = (TextAnchor)4; Chip.fontSize = 13; Chip.padding = new RectOffset(0, 0, 4, 4); Chip.margin = new RectOffset(0, 6, 0, 0); SetHover(Chip, PanelHi, Color.white); ChipActive = Rounded(GUI.skin.button, AccentDim, 7, Color.white); ChipActive.alignment = (TextAnchor)4; ChipActive.fontSize = 13; ChipActive.fontStyle = (FontStyle)1; ChipActive.padding = new RectOffset(0, 0, 4, 4); ChipActive.margin = new RectOffset(0, 6, 0, 0); SetHover(ChipActive, AccentDim, Color.white); KnobTex = RoundedTex(Color.white, 16); GUIStyle val9 = new GUIStyle(GUI.skin.horizontalSlider) { fixedHeight = 8f, margin = new RectOffset(4, 4, 10, 4), border = new RectOffset(4, 4, 4, 4) }; val9.normal.background = RoundedTex(PanelHi, 4); SliderBar = val9; GUIStyle val10 = new GUIStyle(GUI.skin.horizontalSliderThumb) { fixedHeight = 18f, fixedWidth = 18f, border = new RectOffset(0, 0, 0, 0) }; val10.normal.background = RoundedTex(Accent, 9); val10.hover.background = RoundedTex(AccentHi, 9); val10.active.background = RoundedTex(AccentHi, 9); SliderThumb = val10; } } private static GUIStyle Rounded(GUIStyle baseStyle, Color fill, int radius, Color textColor) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0034: Expected O, but got Unknown GUIStyle val = new GUIStyle(baseStyle) { border = new RectOffset(radius, radius, radius, radius) }; val.normal.background = RoundedTex(fill, radius); val.normal.textColor = textColor; return val; } private static void SetHover(GUIStyle s, Color hoverFill, Color hoverText) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) //IL_002b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown int left = s.border.left; s.hover = new GUIStyleState { background = RoundedTex(hoverFill, left), textColor = hoverText }; s.active = new GUIStyleState { background = RoundedTex(hoverFill, left), textColor = hoverText }; s.onNormal = new GUIStyleState { background = RoundedTex(hoverFill, left), textColor = hoverText }; } private static Color C(float r, float g, float b, float a = 1f) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return new Color(r, g, b, a); } private static void ApplyPalette(string accentHex, string actionHex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) Accent = ColorFromHex(accentHex, C(0.255f, 0.835f, 0.541f)); AccentHi = Mix(Accent, Color.white, 0.16f); AccentDim = Mix(Panel, Accent, 0.42f); HeaderBg = Mix(Bg, Accent, 0.3f); HeaderDim = Mix(Bg, Accent, 0.16f); DarkOnAccent = ContrastText(Accent); Donate = ColorFromHex(actionHex, C(0.349f, 0.624f, 0.957f)); DonateHi = Mix(Donate, Color.white, 0.18f); TextOnAction = ContrastText(Donate); } private static Color Mix(Color a, Color b, float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0016: 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) Color result = Color.Lerp(a, b, Mathf.Clamp01(t)); result.a = Mathf.Lerp(a.a, b.a, Mathf.Clamp01(t)); return result; } private static Color ContrastText(Color color) { //IL_0005: 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_001e: 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_002d: Unknown result type (might be due to invalid IL or missing references) if (!(0.2126f * color.r + 0.7152f * color.g + 0.0722f * color.b > 0.54f)) { return Color.white; } return C(0.043f, 0.052f, 0.061f); } public static Color ColorFromHex(string value, Color fallback) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) string text = NormalizeHex(value, null); if (string.IsNullOrEmpty(text)) { return fallback; } try { byte b = byte.Parse(text.Substring(1, 2), NumberStyles.HexNumber); byte b2 = byte.Parse(text.Substring(3, 2), NumberStyles.HexNumber); byte b3 = byte.Parse(text.Substring(5, 2), NumberStyles.HexNumber); return new Color((float)(int)b / 255f, (float)(int)b2 / 255f, (float)(int)b3 / 255f, 1f); } catch { return fallback; } } public static string ColorToHex(Color color) { //IL_0000: 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_003a: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255); int num2 = Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255); int num3 = Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255); return "#" + num.ToString("X2") + num2.ToString("X2") + num3.ToString("X2"); } public static string NormalizeHex(string value, string fallback) { string text = (value ?? "").Trim(); if (text.StartsWith("#")) { text = text.Substring(1); } if (text.Length == 3) { text = string.Concat(text[0], text[0], text[1], text[1], text[2], text[2]); } if (text.Length == 6) { bool flag = true; foreach (char c in text) { if ((c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F')) { flag = false; break; } } if (flag) { return "#" + text.ToUpperInvariant(); } } return fallback; } public static Texture2D Tex(Color c) { //IL_0004: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } public static Texture2D GradientTex(Color top, Color bottom, int h) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //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_0037: Unknown result type (might be due to invalid IL or missing references) if (h < 2) { h = 2; } Texture2D val = new Texture2D(1, h, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; for (int i = 0; i < h; i++) { val.SetPixel(0, i, Color.Lerp(bottom, top, (float)i / (float)(h - 1))); } val.Apply(); return val; } public static Texture2D RoundedTex(Color col, int radius) { //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_001f: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (radius < 1) { radius = 1; } int num = radius * 2 + 1; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; ((Texture)val).filterMode = (FilterMode)1; int num2 = num - 1; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = 0f; float num4 = 0f; if (j < radius) { num3 = radius - j; } else if (j > num2 - radius) { num3 = j - (num2 - radius); } if (i < radius) { num4 = radius - i; } else if (i > num2 - radius) { num4 = i - (num2 - radius); } float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = Mathf.Clamp01((float)radius - num5 + 0.5f); val.SetPixel(j, i, new Color(col.r, col.g, col.b, col.a * num6)); } } val.Apply(); return val; } } public static class UpdateChecker { private sealed class Result { public bool Checked; public bool Newer; public string Version; public string Error; } [DataContract] private sealed class Release { [DataMember(Name = "tag_name")] public string Tag { get; set; } [DataMember(Name = "draft")] public bool Draft { get; set; } [DataMember(Name = "prerelease")] public bool Prerelease { get; set; } } private static volatile bool _checking; private static volatile Result _result = new Result(); public static bool IsChecking => _checking; public static bool HasChecked => _result.Checked; public static bool UpdateAvailable => _result.Newer; public static string LatestVersion => _result.Version; public static string Error => _result.Error; public static void Init() { CheckAsync(); } public static void CheckAsync(bool force = false) { if (_checking || (!force && HasChecked)) { return; } _checking = true; Task.Run(delegate { //IL_0059: Unknown result type (might be due to invalid IL or missing references) try { HttpWebRequest obj = (HttpWebRequest)WebRequest.Create("https://api.github.com/repos/maxkir041/PEAK-MX/releases/latest"); obj.UserAgent = "PEAK-MX-release-check"; obj.Accept = "application/vnd.github+json"; obj.Timeout = 10000; obj.ReadWriteTimeout = 10000; obj.AllowAutoRedirect = false; using WebResponse webResponse = obj.GetResponse(); using Stream stream = webResponse.GetResponseStream(); Release release = (Release)((XmlObjectSerializer)new DataContractJsonSerializer(typeof(Release))).ReadObject(stream); if (release == null || release.Draft || release.Prerelease || !Version.TryParse((release.Tag ?? "").TrimStart('v', 'V'), out Version result)) { throw new InvalidOperationException("Invalid release version."); } _result = new Result { Checked = true, Version = result.ToString(), Newer = (result > new Version("1.1.2")) }; } catch (Exception) { _result = new Result { Error = "GitHub release check unavailable." }; } finally { _checking = false; } }); } } internal static class VoiceControl { private struct SourceState { public float MinDistance; public float MaxDistance; public AudioRolloffMode RolloffMode; public bool HasValue; } private const byte EventCode = 171; private const string Magic = "PMX_VOICE"; private const int CommandSetActor = 1; private const int CommandSetAll = 2; private const float GlobalMaxDistance = 5000f; private static readonly HashSet ForcedActors = new HashSet(); private static readonly Dictionary SourceStates = new Dictionary(); private static bool _forceAllActors; private static bool _subscribed; public static bool ForceAllActors => _forceAllActors; public static void Init() { if (_subscribed) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; _subscribed = true; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[VoiceControl] subscribe failed: " + ex.Message)); } } } public static void Dispose() { if (_subscribed) { try { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } catch { } _subscribed = false; } } public static bool IsActorForced(Character character) { int num = ActorNumber(character); if (num > 0) { return ForcedActors.Contains(num); } return false; } public static bool ShouldForceAudible(Character character) { if ((Object)(object)character == (Object)null) { return false; } try { if (character.IsLocal) { return false; } } catch { } if (ModConfig.GlobalVoice || _forceAllActors) { return true; } int num = ActorNumber(character); if (num > 0) { return ForcedActors.Contains(num); } return false; } public static void BroadcastHearActor(Character character, bool enabled) { int num = ActorNumber(character); if (num > 0) { ApplyActor(num, enabled); Raise(1, num, enabled); } } public static void BroadcastHearAll(bool enabled) { ApplyAll(enabled); Raise(2, -1, enabled); } public static void ApplyVoiceSource(AudioSource source, float audioLevel) { //IL_0049: 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) if (!((Object)(object)source == (Object)null)) { int instanceID = ((Object)source).GetInstanceID(); if (!SourceStates.ContainsKey(instanceID)) { SourceStates[instanceID] = new SourceState { MinDistance = source.minDistance, MaxDistance = source.maxDistance, RolloffMode = source.rolloffMode, HasValue = true }; } source.spatialBlend = 1f; source.bypassReverbZones = true; source.rolloffMode = (AudioRolloffMode)1; source.minDistance = Mathf.Max(1f, source.minDistance); source.maxDistance = Mathf.Max(source.maxDistance, 5000f); source.volume = Mathf.Clamp01(audioLevel); } } public static void RestoreVoiceSource(AudioSource source) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null) { return; } int instanceID = ((Object)source).GetInstanceID(); if (SourceStates.TryGetValue(instanceID, out var value) && value.HasValue) { try { source.minDistance = value.MinDistance; source.maxDistance = value.MaxDistance; source.rolloffMode = value.RolloffMode; } catch { } SourceStates.Remove(instanceID); } } public static void DisableEcho(VoiceObscuranceFilter filter) { try { if (!((Object)(object)filter == (Object)null) && !((Object)(object)filter.echo == (Object)null)) { ((Behaviour)filter.echo).enabled = true; filter.echo.wetMix = 0f; filter.echo.dryMix = 1f; filter.echo.decayRatio = 0f; filter.echo.delay = 10f; } } catch { } } private static void Raise(int command, int actor, bool enabled) { //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) try { if (PhotonNetwork.InRoom && PhotonNetwork.NetworkingClient != null) { object[] array = new object[4] { "PMX_VOICE", command, actor, enabled }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent((byte)171, (object)array, val, SendOptions.SendReliable); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[VoiceControl] raise failed: " + ex.Message)); } } } private static void OnEvent(EventData data) { try { if (data != null && data.Code == 171 && data.CustomData is object[] array && array.Length >= 4 && array[0] is string a && string.Equals(a, "PMX_VOICE", StringComparison.Ordinal)) { int num = Convert.ToInt32(array[1]); int actor = Convert.ToInt32(array[2]); bool enabled = Convert.ToBoolean(array[3]); switch (num) { case 1: ApplyActor(actor, enabled); break; case 2: ApplyAll(enabled); break; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[VoiceControl] event failed: " + ex.Message)); } } } private static void ApplyActor(int actor, bool enabled) { if (actor > 0) { if (enabled) { ForcedActors.Add(actor); } else { ForcedActors.Remove(actor); } } } private static void ApplyAll(bool enabled) { _forceAllActors = enabled; if (!enabled) { ForcedActors.Clear(); } } private static int ActorNumber(Character character) { try { if ((Object)(object)character == (Object)null) { return 0; } PhotonView photonView = ((MonoBehaviourPun)character).photonView; if ((Object)(object)photonView != (Object)null && photonView.Owner != null) { return photonView.Owner.ActorNumber; } } catch { } return 0; } } internal static class WorldEsp { private struct Marker { public string Label; public float Distance; public Color Color; public GameObject Source; public Character Character; public Item Item; } private static readonly List Markers = new List(); private static readonly HashSet Seen = new HashSet(); private static readonly GUIContent LabelContent = new GUIContent(); private static readonly string[] BackItemKeywords = new string[5] { "backpack", "fannypack", "jetpack", "rocketpack", "rucksack" }; private static readonly string[] AmuletKeywords = new string[4] { "amulet", "charm", "talisman", "scout" }; private static readonly string[] ParentBoundaryKeywords = new string[4] { "spawner", "manager", "holder", "root" }; private static readonly string[] ArrowKeywords = new string[3] { "arrow", "dart", "projectile" }; private static readonly string[] ThornKeywords = new string[3] { "thorn", "bramble", "spike" }; private static readonly string[] SporeKeywords = new string[2] { "spore", "mushroomcloud" }; private static readonly string[] WebKeywords = new string[2] { "web", "spider" }; private static readonly string[] FlytrapKeywords = new string[2] { "flytrap", "venus" }; private static readonly string[] GloomKeywords = new string[1] { "gloom" }; private static readonly string[] RavenKeywords = new string[1] { "raven" }; private static readonly string[] ScoutmasterKeywords = new string[2] { "scoutmaster", "scout master" }; private static readonly string[] HeatKeywords = new string[3] { "lava", "magma", "kiln" }; private static readonly string[] PoisonKeywords = new string[3] { "poison", "toxic", "acid" }; private static readonly string[] ExplosionKeywords = new string[3] { "explosion", "explode", "bomb" }; private static readonly string[] DangerKeywords = new string[25] { "arrow", "dart", "projectile", "thorn", "bramble", "spike", "spore", "mushroomcloud", "web", "spider", "flytrap", "venus", "gloom", "raven", "scoutmaster", "scout master", "lava", "magma", "kiln", "poison", "toxic", "acid", "explosion", "explode", "bomb" }; private static GUIStyle _label; private static Texture2D _pixel; private static float _nextRefresh; public static void Draw() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_010a: Unknown result type (might be due to invalid IL or missing references) try { if (ModConfig.WorldEsp == null || !ModConfig.WorldEsp.Value || (Event.current != null && (int)Event.current.type != 7)) { return; } Camera val = Camera.main ?? Camera.current; if ((Object)(object)val == (Object)null) { return; } Theme.EnsureBuilt(); EnsureStyle(); RefreshMarkers(); if (!EspPositions.TryObserver(val, out var position)) { return; } float num = Mathf.Max(25f, ModConfig.WorldEspDistance?.Value ?? 600f); float num2 = num * num; for (int i = 0; i < Markers.Count; i++) { Marker marker = Markers[i]; if (TryMarkerPosition(marker, out var position2)) { Vector3 val2 = position2 - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num2)) { float num3 = Mathf.Sqrt(sqrMagnitude); DrawMarker(ProjectToScreenEdge(val, position2 + Vector3.up * 0.25f, out var offscreen), $"{marker.Label} {num3:0}m", num3, offscreen, marker.Color); } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("[WorldEsp] " + ex.Message)); } } } private static void RefreshMarkers() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00b3: Unknown result type (might be due to invalid IL or missing references) if (Time.realtimeSinceStartup < _nextRefresh) { return; } _nextRefresh = Time.realtimeSinceStartup + 1.1f; Markers.Clear(); Seen.Clear(); Vector3 local = LocalPosition(); float num = Mathf.Max(25f, ModConfig.WorldEspDistance?.Value ?? 600f); float maxSqr = num * num; ConfigEntry worldEspBackItems = ModConfig.WorldEspBackItems; if (worldEspBackItems == null || !worldEspBackItems.Value) { ConfigEntry worldEspAmulets = ModConfig.WorldEspAmulets; if (worldEspAmulets == null || !worldEspAmulets.Value) { goto IL_0086; } } AddGroundItems(local, maxSqr); goto IL_0086; IL_0086: ConfigEntry worldEspCampfires = ModConfig.WorldEspCampfires; if (worldEspCampfires != null && worldEspCampfires.Value) { AddCampfires(local, maxSqr); } ConfigEntry worldEspDangers = ModConfig.WorldEspDangers; if (worldEspDangers != null && worldEspDangers.Value) { AddDangerObjects(local, maxSqr); } Markers.Sort((Marker a, Marker b) => a.Distance.CompareTo(b.Distance)); if (Markers.Count > 80) { Markers.RemoveRange(80, Markers.Count - 80); } } private static void AddGroundItems(Vector3 local, float maxSqr) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) List aLL_ACTIVE_ITEMS = Item.ALL_ACTIVE_ITEMS; if (aLL_ACTIVE_ITEMS == null) { return; } for (int i = 0; i < aLL_ACTIVE_ITEMS.Count; i++) { Item val = aLL_ACTIVE_ITEMS[i]; if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } try { if ((int)val.itemState != 0) { continue; } } catch { } string text = ItemName(val); string value = (text + " " + ((Object)val).name + " " + ((object)val).GetType().Name).ToLowerInvariant(); bool flag = ContainsAny(value, BackItemKeywords); bool flag2 = ContainsAny(value, AmuletKeywords); if (flag) { ConfigEntry worldEspBackItems = ModConfig.WorldEspBackItems; if (worldEspBackItems != null && worldEspBackItems.Value) { goto IL_00e2; } } if (!flag2) { continue; } ConfigEntry worldEspAmulets = ModConfig.WorldEspAmulets; if (worldEspAmulets == null || !worldEspAmulets.Value) { continue; } goto IL_00e2; IL_00e2: AddMarker(((Component)val).gameObject, text, ItemPosition(val), local, maxSqr, flag ? new Color(0.42f, 0.75f, 1f, 1f) : new Color(1f, 0.78f, 0.35f, 1f)); } } private static void AddCampfires(Vector3 local, float maxSqr) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) try { Campfire[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (Campfire val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { AddMarker(((Component)val).gameObject, "Campfire", ((Component)val).transform.position, local, maxSqr, new Color(1f, 0.55f, 0.24f, 1f)); } } } catch { } } private static void AddDangerObjects(Vector3 local, float maxSqr) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) try { MonoBehaviour[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (MonoBehaviour val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null || !((Component)val).gameObject.activeInHierarchy || !LooksLikeDangerName((((object)val).GetType().Name + " " + ((Object)((Component)val).gameObject).name).ToLowerInvariant())) { continue; } GameObject val2 = InterestingDangerRoot(((Component)val).gameObject); if (!((Object)(object)val2 == (Object)null)) { string text = DangerLabel(DangerText(val2, (Component)(object)val)); if (!string.IsNullOrWhiteSpace(text)) { AddMarker(val2, text, val2.transform.position, local, maxSqr, new Color(1f, 0.36f, 0.32f, 1f)); } } } } catch { } } private static GameObject InterestingDangerRoot(GameObject obj) { if ((Object)(object)obj == (Object)null) { return null; } try { if ((Object)(object)obj.GetComponentInParent() != (Object)null) { return null; } } catch { } try { if ((Object)(object)obj.GetComponentInParent() != (Object)null) { return null; } } catch { } Transform val = obj.transform; for (int i = 0; i < 4; i++) { if (!((Object)(object)val.parent != (Object)null)) { break; } string value = ((Object)val.parent).name.ToLowerInvariant(); if (ContainsAny(value, ParentBoundaryKeywords) || !LooksLikeDangerName(value)) { break; } val = val.parent; } return ((Component)val).gameObject; } private static string DangerText(GameObject root, Component component) { string text = ""; try { text = text + ((Object)root).name + " "; } catch { } try { text = text + ((object)component).GetType().Name + " "; } catch { } try { Component[] components = root.GetComponents(); for (int i = 0; i < components.Length; i++) { if ((Object)(object)components[i] != (Object)null) { text = text + ((object)components[i]).GetType().Name + " "; } } } catch { } return text.ToLowerInvariant(); } private static string DangerLabel(string text) { if (ContainsAny(text, ArrowKeywords)) { return "Arrow trap"; } if (ContainsAny(text, ThornKeywords)) { return "Thorns"; } if (ContainsAny(text, SporeKeywords)) { return "Spores"; } if (ContainsAny(text, WebKeywords)) { return "Web"; } if (ContainsAny(text, FlytrapKeywords)) { return "Flytrap"; } if (ContainsAny(text, GloomKeywords)) { return "Gloom"; } if (ContainsAny(text, RavenKeywords)) { return "Raven"; } if (ContainsAny(text, ScoutmasterKeywords)) { return "Scoutmaster"; } if (ContainsAny(text, HeatKeywords)) { return "Heat"; } if (ContainsAny(text, PoisonKeywords)) { return "Poison"; } if (ContainsAny(text, ExplosionKeywords)) { return "Explosion"; } return ""; } private static bool LooksLikeDangerName(string value) { return ContainsAny(value, DangerKeywords); } private static void AddMarker(GameObject source, string label, Vector3 position, Vector3 local, float maxSqr, Color color) { //IL_005e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null) { return; } int instanceID = ((Object)source).GetInstanceID(); if (Seen.Contains(instanceID)) { return; } Character componentInParent = source.GetComponentInParent(); Item component = source.GetComponent(); if ((!((Object)(object)componentInParent != (Object)null) || EspPositions.TryCharacter(componentInParent, out position)) && (!((Object)(object)componentInParent == (Object)null) || !((Object)(object)component != (Object)null) || EspPositions.TryItem(component, out position))) { Vector3 val = position - local; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude > maxSqr)) { Seen.Add(instanceID); Markers.Add(new Marker { Label = label, Distance = Mathf.Sqrt(sqrMagnitude), Color = color, Source = source, Character = componentInParent, Item = component }); } } } private static bool TryMarkerPosition(Marker marker, out Vector3 position) { //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_0079: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; if ((Object)(object)marker.Source == (Object)null || !marker.Source.activeInHierarchy) { return false; } if ((Object)(object)marker.Character != (Object)null) { return EspPositions.TryCharacter(marker.Character, out position); } if ((Object)(object)marker.Item != (Object)null) { if ((int)marker.Item.itemState != 0) { return false; } return EspPositions.TryItem(marker.Item, out position); } position = marker.Source.transform.position; return EspPositions.IsFinite(position); } private static string ItemName(Item item) { try { string name = item.GetName(); if (!string.IsNullOrWhiteSpace(name)) { return name; } } catch { } try { if (item.UIData != null && !string.IsNullOrWhiteSpace(item.UIData.itemName)) { return item.UIData.itemName; } } catch { } try { return ((Object)((Component)item).gameObject).name; } catch { return "Item"; } } private static Vector3 ItemPosition(Item item) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) try { return item.Center(); } catch { } try { return item.transform.position; } catch { return Vector3.zero; } } private static Vector3 LocalPosition() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!EspPositions.TryObserver(Camera.main, out var position)) { return Vector3.zero; } return position; } private static bool ContainsAny(string value, string[] needles) { if (string.IsNullOrWhiteSpace(value)) { return false; } for (int i = 0; i < needles.Length; i++) { if (!string.IsNullOrWhiteSpace(needles[i]) && value.IndexOf(needles[i], StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static Vector2 ProjectToScreenEdge(Camera camera, Vector3 world, out bool offscreen) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = camera.WorldToViewportPoint(world); bool flag = val.z <= 0.01f; if (flag) { val.x = 1f - val.x; val.y = 1f - val.y; } offscreen = flag || val.x < 0f || val.x > 1f || val.y < 0f || val.y > 1f; if (offscreen) { val.x = Mathf.Clamp(val.x, 0.04f, 0.96f); val.y = Mathf.Clamp(val.y, 0.06f, 0.94f); } return new Vector2(val.x * (float)Screen.width, (1f - val.y) * (float)Screen.height); } private static void DrawMarker(Vector2 center, string text, float distance, bool offscreen, Color color) { //IL_002d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(1.15f - distance / Mathf.Max(50f, ModConfig.WorldEspDistance?.Value ?? 600f)); Color color2 = color; color2.a = Mathf.Lerp(0.5f, 1f, num); Color color3 = default(Color); ((Color)(ref color3))..ctor(0.02f, 0.025f, 0.03f, Mathf.Lerp(0.38f, 0.78f, num)); ConfigEntry worldEspLines = ModConfig.WorldEspLines; if (worldEspLines != null && worldEspLines.Value) { DrawLine(new Vector2((float)Screen.width * 0.5f, (float)Screen.height - 18f), center, color2, 1.25f); } float num2 = (offscreen ? 16f : Mathf.Clamp(18f - distance * 0.015f, 7f, 18f)); DrawRect(new Rect(center.x - num2 * 0.5f, center.y - 1f, num2, 2f), color2); DrawRect(new Rect(center.x - 1f, center.y - num2 * 0.5f, 2f, num2), color2); LabelContent.text = text; Vector2 val = _label.CalcSize(LabelContent); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(Mathf.Clamp(center.x - val.x * 0.5f - 8f, 4f, (float)Screen.width - val.x - 16f), Mathf.Clamp(center.y - 30f, 4f, (float)Screen.height - 24f), val.x + 16f, 22f); DrawRect(val2, color3); DrawRect(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).yMax - 2f, ((Rect)(ref val2)).width, 2f), color2); GUI.Label(val2, text, _label); } private static void EnsureStyle() { //IL_0029: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if ((Object)(object)_pixel == (Object)null) { _pixel = Texture2D.whiteTexture; } if (_label == null) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 12, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; val.clipping = (TextClipping)1; _label = val; } } private static void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private static void DrawLine(Vector2 a, Vector2 b, Color color, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004a: 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_0069: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 matrix = GUI.matrix; Color color2 = GUI.color; float num = Mathf.Atan2(b.y - a.y, b.x - a.x) * 57.29578f; float num2 = Vector2.Distance(a, b); GUI.color = color; GUIUtility.RotateAroundPivot(num, a); GUI.DrawTexture(new Rect(a.x, a.y - width * 0.5f, num2, width), (Texture)(object)_pixel); GUI.matrix = matrix; GUI.color = color2; } } }