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.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LCBridgeOverlay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.7.0.0")] [assembly: AssemblyInformationalVersion("1.7.0+17fc156b395de3c6ab1418d8755000fb34456ed4")] [assembly: AssemblyProduct("LCBridgeOverlay")] [assembly: AssemblyTitle("LCBridgeOverlay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.7.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 LCBridgeOverlay { public static class BcmeClientEvents { private class Entry { public string Header; public string Body; public bool Warn; } private static readonly List _entries = new List(); private static readonly object _lock = new object(); private static bool _knownSearched; private static FieldInfo[] _eventListFields; private static readonly Dictionary _nameMethods = new Dictionary(); private static HashSet _knownNames; private static float _knownRefreshed; private static bool _panelSearched; private static PropertyInfo _netInstance; private static PropertyInfo _netVarValue; private static PropertyInfo _uiInstance; private static FieldInfo _textUiField; private static FieldInfo _panelTextField; private static string _lastRaw; public static bool Any => Get().Count > 0; public static void OnDisplayTip(string headerText, string bodyText, bool isWarning) { try { string text = (headerText ?? "").Trim(); string text2 = (bodyText ?? "").Trim(); if (text.Length == 0 && text2.Length == 0) { return; } lock (_lock) { foreach (Entry entry in _entries) { if (entry.Header == text && entry.Body == text2) { return; } } _entries.Add(new Entry { Header = text, Body = text2, Warn = isWarning }); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[bcme-client] анонс ивента: header=\"{text}\" body=\"{text2}\" warn={isWarning}"); } BridgeTicker.ForceImmediate(); } catch { } } public static void Clear() { lock (_lock) { if (_entries.Count > 0) { _entries.Clear(); } } _lastRaw = null; } public static List Get() { List list = new List(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (string item in NamesFromPanel()) { if (hashSet.Add(item)) { list.Add(new BcmerEvents.EventInfo { Name = (ConfigSettings.RussianActive ? EventTranslate.ToRu(item) : item), ColorHex = "#FFFFFF" }); } } lock (_lock) { foreach (Entry entry in _entries) { string text = ((!string.IsNullOrEmpty(entry.Header)) ? entry.Header : entry.Body); if (!string.IsNullOrEmpty(text) && hashSet.Add(text)) { list.Add(new BcmerEvents.EventInfo { Name = text, ColorHex = (entry.Warn ? "#FF5141" : "#FFFFFF") }); } } return list; } } private static HashSet KnownEventNames() { if (_knownNames != null && _knownNames.Count > 0 && Time.unscaledTime - _knownRefreshed < 30f) { return _knownNames; } HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); try { if (!_knownSearched) { _knownSearched = true; Type type = GameState.FindTypeByFullName("BrutalCompanyMinus.Minus.EventManager") ?? GameState.FindTypeFuzzy("BrutalCompany", new string[1] { "EventManager" }); if (type != null) { string[] obj = new string[4] { "events", "vanillaEvents", "moddedEvents", "customEvents" }; List list = new List(); string[] array = obj; foreach (string name in array) { FieldInfo field = type.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { list.Add(field); } } _eventListFields = list.ToArray(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[bcme-client] списков ивентов найдено: {list.Count}"); } } } if (_eventListFields == null) { return _knownNames ?? hashSet; } FieldInfo[] eventListFields = _eventListFields; for (int i = 0; i < eventListFields.Length; i++) { if (!(eventListFields[i].GetValue(null) is IEnumerable enumerable)) { continue; } foreach (object item in enumerable) { if (item != null) { string text = EventName(item); if (!string.IsNullOrEmpty(text)) { hashSet.Add(text.Trim()); } } } } } catch { } if (hashSet.Count > 0) { if (_knownNames == null || _knownNames.Count != hashSet.Count) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)$"[bcme-client] известных имён ивентов: {hashSet.Count}"); } } _knownNames = hashSet; _knownRefreshed = Time.unscaledTime; } return _knownNames ?? hashSet; } private static string EventName(object ev) { try { Type type = ev.GetType(); if (!_nameMethods.TryGetValue(type, out var value)) { value = type.GetMethod("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _nameMethods[type] = value; } return (value != null) ? (value.Invoke(ev, null) as string) : null; } catch { return null; } } private static string PanelRaw() { try { if (!_panelSearched) { _panelSearched = true; Type type = GameState.FindTypeByFullName("BrutalCompanyMinus.Net") ?? GameState.FindTypeFuzzy("BrutalCompany", new string[1] { "Net" }); if (type != null) { _netInstance = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _textUiField = type.GetField("textUI", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } Type type2 = GameState.FindTypeByFullName("BrutalCompanyMinus.UI") ?? GameState.FindTypeFuzzy("BrutalCompany", new string[1] { "UI" }); if (type2 != null) { _uiInstance = type2.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _panelTextField = type2.GetField("panelText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[bcme-client] Net.textUI=" + ((_textUiField != null) ? "OK" : "нет") + ", UI.panelText=" + ((_panelTextField != null) ? "OK" : "нет"))); } } if (_netInstance != null && _textUiField != null) { object value = _netInstance.GetValue(null); if (value != null) { object value2 = _textUiField.GetValue(value); if (value2 != null) { if (_netVarValue == null) { _netVarValue = value2.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); } string text = ((_netVarValue != null) ? _netVarValue.GetValue(value2) : null)?.ToString(); if (!string.IsNullOrEmpty(text)) { return text; } } } } if (_uiInstance != null && _panelTextField != null) { object value3 = _uiInstance.GetValue(null); if (value3 != null) { object value4 = _panelTextField.GetValue(value3); if (value4 != null) { PropertyInfo property = value4.GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public); string text2 = ((property != null) ? property.GetValue(value4) : null)?.ToString(); if (!string.IsNullOrEmpty(text2)) { return text2; } } } } } catch { } return null; } private static List NamesFromPanel() { List list = new List(); try { string text = PanelRaw(); if (string.IsNullOrEmpty(text)) { return list; } if (text != _lastRaw) { _lastRaw = text; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[bcme-client] панель BCME: " + Regex.Replace(text, "<.*?>", "").Replace("\n", " | "))); } } HashSet hashSet = KnownEventNames(); if (hashSet == null || hashSet.Count == 0) { return list; } string[] array = text.Split('\n'); for (int i = 0; i < array.Length; i++) { string text2 = Regex.Replace(array[i] ?? "", "<.*?>", "").Trim(); if (text2.Length == 0) { continue; } if (hashSet.Contains(text2)) { if (!list.Contains(text2)) { list.Add(text2); } } else { if (text2.IndexOf(',') < 0) { continue; } string[] array2 = text2.Split(','); for (int j = 0; j < array2.Length; j++) { string text3 = array2[j].Trim(); if (text3.Length > 0 && hashSet.Contains(text3) && !list.Contains(text3)) { list.Add(text3); } } } } } catch { } return list; } } public static class BcmerEvents { public struct EventInfo { public string Name; public string ColorHex; } private static Type _emType; private static FieldInfo _curEventsField; private static bool _searched; private static readonly Dictionary _nameCache = new Dictionary(); private static readonly Dictionary> _typeGetterCache = new Dictionary>(); private static string ColorFor(string typeName) { string text = (typeName ?? "").ToLowerInvariant(); if (text.Contains("verygood") || text.Contains("great")) { return "#00FF00"; } if (text.Contains("good")) { return "#008000"; } if (text.Contains("verybad")) { return "#8B0000"; } if (text.Contains("bad")) { return "#FF0000"; } if (text.Contains("black") || text.Contains("deadly") || text.Contains("impossible") || text.Contains("death")) { return "#000000"; } return "#FFFFFF"; } public static List GetEvents() { List list = new List(); try { EnsureSearched(); if (_curEventsField == null) { return list; } if (!(_curEventsField.GetValue(null) is IEnumerable enumerable)) { return list; } foreach (object item in enumerable) { if (item == null) { continue; } string text = GetName(item); if (!string.IsNullOrEmpty(text)) { if (ConfigSettings.RussianActive) { text = EventTranslate.ToRu(text); } list.Add(new EventInfo { Name = text, ColorHex = ColorFor(GetEventTypeName(item)) }); } } } catch { } if (list.Count == 0 && BcmeClientEvents.Any) { list.AddRange(BcmeClientEvents.Get()); } return list; } public static bool BcmePresent() { try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Key.IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } PluginInfo value = pluginInfo.Value; object obj; if (value == null) { obj = null; } else { BepInPlugin metadata = value.Metadata; obj = ((metadata != null) ? metadata.Name : null); } if (obj == null) { obj = ""; } if (((string)obj).IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } private static void EnsureSearched() { if (_searched) { return; } _searched = true; if (!BcmePresent()) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"BCME не найден в Chainloader.PluginInfos — плашка ивентов возьмёт данные моста."); } return; } _emType = FindTypeByFullName("BrutalCompanyMinus.Minus.EventManager") ?? FindTypeFuzzy("BrutalCompany", "EventManager"); if (_emType != null) { _curEventsField = _emType.GetField("currentEvents", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)("[reflection] BCMER EventManager=" + _emType.FullName + ", currentEvents=" + ((_curEventsField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)"[reflection] BCMER не найден (не установлен?) — плашка ивентов возьмёт данные моста."); } } } private static string GetName(object ev) { Type type = ev.GetType(); if (!_nameCache.TryGetValue(type, out var value)) { value = type.GetMethod("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _nameCache[type] = value; } if (value != null) { try { return value.Invoke(ev, null) as string; } catch { } } return ev.ToString(); } private static string GetEventTypeName(object ev) { Type type = ev.GetType(); if (!_typeGetterCache.TryGetValue(type, out var value)) { value = BuildTypeGetter(type); _typeGetterCache[type] = value; } try { return value?.Invoke(ev); } catch { return null; } } private static Func BuildTypeGetter(Type t) { string[] array = new string[6] { "Type", "EventType", "type", "eventType", "Rarity", "rarity" }; string[] array2 = array; foreach (string name in array2) { MethodInfo m = t.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (m != null && (m.ReturnType.IsEnum || m.ReturnType == typeof(string))) { return (object o) => m.Invoke(o, null)?.ToString(); } } array2 = array; foreach (string name2 in array2) { PropertyInfo p = t.GetProperty(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (p != null && p.CanRead && (p.PropertyType.IsEnum || p.PropertyType == typeof(string))) { return (object o) => p.GetValue(o)?.ToString(); } } array2 = array; foreach (string name3 in array2) { FieldInfo f = t.GetField(name3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (f != null && (f.FieldType.IsEnum || f.FieldType == typeof(string))) { return (object o) => f.GetValue(o)?.ToString(); } } return null; } private static Type FindTypeByFullName(string fullName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } } catch { } return null; } private static Type FindTypeFuzzy(string asmNameContains, string typeName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if ((assembly.GetName().Name ?? "").IndexOf(asmNameContains, StringComparison.OrdinalIgnoreCase) < 0) { continue; } Type[] source; try { source = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { source = ex.Types.Where((Type x) => x != null).ToArray(); } Type type = source.FirstOrDefault((Type x) => string.Equals(x.Name, typeName, StringComparison.OrdinalIgnoreCase)); if (type != null) { return type; } } } catch { } return null; } } public static class BridgeServer { private static TcpListener _listener; private static Thread _acceptThread; private static volatile bool _running; private static readonly List _clients = new List(); private static readonly object _lock = new object(); private static volatile string _lastPayload; public static bool IsRunning => _running; public static void Start(int port) { if (!_running) { _running = true; _listener = new TcpListener(IPAddress.Loopback, port); _listener.Start(); _acceptThread = new Thread(AcceptLoop) { IsBackground = true, Name = "LCBridge-Accept" }; _acceptThread.Start(); } } public static void Stop() { _running = false; try { _listener?.Stop(); } catch { } lock (_lock) { foreach (TcpClient client in _clients) { try { client.Close(); } catch { } } _clients.Clear(); } } private static void AcceptLoop() { while (_running) { try { TcpClient tcpClient = _listener.AcceptTcpClient(); if (Handshake(tcpClient)) { string lastPayload = _lastPayload; if (lastPayload != null) { try { byte[] array = EncodeTextFrame(lastPayload); tcpClient.GetStream().Write(array, 0, array.Length); } catch { } } lock (_lock) { _clients.Add(tcpClient); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"Оверлей подключился к мосту."); } } else { try { tcpClient.Close(); } catch { } } } catch { if (!_running) { break; } } } } private static bool Handshake(TcpClient client) { try { NetworkStream stream = client.GetStream(); byte[] array = new byte[4096]; int num = stream.Read(array, 0, array.Length); if (num <= 0) { return false; } string text = Encoding.UTF8.GetString(array, 0, num); string text2 = null; string[] array2 = text.Split(new string[1] { "\r\n" }, StringSplitOptions.None); foreach (string text3 in array2) { if (text3.StartsWith("Sec-WebSocket-Key:", StringComparison.OrdinalIgnoreCase)) { text2 = text3.Substring("Sec-WebSocket-Key:".Length).Trim(); break; } } if (text2 == null) { return false; } string text4; using (SHA1 sHA = SHA1.Create()) { text4 = Convert.ToBase64String(sHA.ComputeHash(Encoding.UTF8.GetBytes(text2 + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"))); } string s = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: " + text4 + "\r\n\r\n"; byte[] bytes = Encoding.UTF8.GetBytes(s); stream.Write(bytes, 0, bytes.Length); return true; } catch { return false; } } public static void Broadcast(string text) { _lastPayload = text; byte[] array = EncodeTextFrame(text); List list = null; lock (_lock) { foreach (TcpClient client in _clients) { try { if (!client.Connected) { (list ?? (list = new List())).Add(client); } else { client.GetStream().Write(array, 0, array.Length); } } catch { (list ?? (list = new List())).Add(client); } } if (list == null) { return; } foreach (TcpClient item in list) { _clients.Remove(item); try { item.Close(); } catch { } } } } private static byte[] EncodeTextFrame(string text) { byte[] bytes = Encoding.UTF8.GetBytes(text); int num = bytes.Length; byte[] array; if (num <= 125) { array = new byte[2] { 0, (byte)num }; } else if (num <= 65535) { array = new byte[4] { 0, 126, (byte)((num >> 8) & 0xFF), (byte)(num & 0xFF) }; } else { array = new byte[10] { 0, 127, 0, 0, 0, 0, 0, 0, 0, 0 }; for (int i = 0; i < 8; i++) { array[9 - i] = (byte)((num >> 8 * i) & 0xFF); } } array[0] = 129; byte[] array2 = new byte[array.Length + bytes.Length]; Buffer.BlockCopy(array, 0, array2, 0, array.Length); Buffer.BlockCopy(bytes, 0, array2, array.Length, bytes.Length); return array2; } } public class BridgeTicker : MonoBehaviour { private float _timer; private const float Interval = 1f; private string _lastPayload; private int _lastMobCount = -1; private static volatile bool _forceNow; public static void ForceImmediate() { _forceNow = true; } private void Update() { _timer += Time.deltaTime; if (_forceNow) { _forceNow = false; _timer = 1f; } if (_timer < 1f) { return; } _timer = 0f; DataParser.Heartbeat = Time.unscaledTime; GameState.TickStats(); RunStats.Tick(); OverlayNet.Tick(); MonsterState.Tick(GameState.GetAllLiveEnemies()); string text = BuildJson(); if (text != _lastPayload) { _lastPayload = text; if (BridgeServer.IsRunning) { BridgeServer.Broadcast(text); } DataParser.PushLocal(text); } } private string BuildJson() { (int alive, int total) crew = GameState.GetCrew(); int item = crew.alive; int item2 = crew.total; int value = (OverlayNet.HasHostState ? OverlayNet.HostDeaths : GameState.GetDeaths()); int localHealth = GameState.GetLocalHealth(); string moonName = GameState.GetMoonName(); string weatherTweaksWeather = GameState.GetWeatherTweaksWeather(); string s = ((!string.IsNullOrEmpty(weatherTweaksWeather)) ? weatherTweaksWeather : GameState.GetVanillaWeather()); string text = (Gate.Events ? GameState.GetBrutalEvent() : null); List list; List list2; if (Gate.Monsters) { (list, list2) = GameState.GetMonsters(); } else { List list3 = new List(); List list4 = new List(); list2 = list4; list = list3; } List items = (Gate.Traps ? GameState.GetTraps() : new List()); bool onMoon = GameState.GetOnMoon(); bool loading = GameState.GetLoading(); bool inGame = GameState.GetInGame(); int value2 = (OverlayNet.HasHostState ? OverlayNet.HostResetToken : GameState.GetResetToken()); int value3 = (Gate.LevelScrap ? GameState.GetLevelScrap() : 0); (int quota, int fulfilled) quotaProgress = GameState.GetQuotaProgress(); int item3 = quotaProgress.quota; int item4 = quotaProgress.fulfilled; int shipScrapSafe = GameState.GetShipScrapSafe(); int quotaIndexSafe = GameState.GetQuotaIndexSafe(); int dayCount = GameState.GetDayCount(); int daysLeft = GameState.GetDaysLeft(); string text2 = (Gate.Interior ? GameState.GetInterior() : null); int value4; int value5; int value6; if (Gate.LevelLoot) { (value4, value5, value6) = GameState.GetLootBreakdown(); } else { value4 = 0; value5 = 0; value6 = 0; } bool oldBird = GameState.GetOldBird(); bool onShip = GameState.GetOnShip(); string topKiller = GameState.GetTopKiller(); string topMonster = GameState.GetTopMonster(); string deadliestEvent = GameState.GetDeadliestEvent(); bool flag = GameExtras.PopupActive(); bool flag2 = GameExtras.StoreAdActive(); int value7 = (Gate.Countdown ? GameExtras.SecondsToEndOfDay() : (-1)); bool flag3 = Gate.Apparatus && GameExtras.ApparatusInside(); float num = (Gate.LootMult ? GameExtras.LootMultiplier() : 1f); int soldTotal = RunStats.SoldTotal; int num2 = list.Count + list2.Count; if (num2 != _lastMobCount) { _lastMobCount = num2; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)string.Format("[monsters] улица={0} ({1}) | комплекс={2} ({3})", list.Count, string.Join(",", list), list2.Count, string.Join(",", list2))); } } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('{'); stringBuilder.Append("\"type\":\"bridge\","); stringBuilder.Append("\"deaths\":").Append(value).Append(','); stringBuilder.Append("\"alive\":").Append(item).Append(','); stringBuilder.Append("\"total\":").Append(item2).Append(','); stringBuilder.Append("\"health\":").Append(localHealth).Append(','); stringBuilder.Append("\"moonName\":").Append(JsonStr(moonName)).Append(','); stringBuilder.Append("\"weatherFull\":").Append(JsonStr(s)).Append(','); stringBuilder.Append("\"brutalEvent\":").Append(JsonStr(text ?? "")).Append(','); stringBuilder.Append("\"onMoon\":").Append(onMoon ? "true" : "false").Append(','); stringBuilder.Append("\"loading\":").Append(loading ? "true" : "false").Append(','); stringBuilder.Append("\"inGame\":").Append(inGame ? "true" : "false").Append(','); stringBuilder.Append("\"resetToken\":").Append(value2).Append(','); stringBuilder.Append("\"levelScrap\":").Append(value3).Append(','); stringBuilder.Append("\"quotaValue\":").Append(item3).Append(','); stringBuilder.Append("\"quotaFulfilled\":").Append(item4).Append(','); stringBuilder.Append("\"shipLoot\":").Append(shipScrapSafe).Append(','); stringBuilder.Append("\"quotaIndex\":").Append(quotaIndexSafe).Append(','); stringBuilder.Append("\"dayCount\":").Append(dayCount).Append(','); stringBuilder.Append("\"daysLeft\":").Append(daysLeft).Append(','); stringBuilder.Append("\"interiorType\":").Append(JsonStr(text2 ?? "")).Append(','); stringBuilder.Append("\"beehiveCount\":").Append(value4).Append(','); stringBuilder.Append("\"itemsInside\":").Append(value5).Append(','); stringBuilder.Append("\"itemsOutside\":").Append(value6).Append(','); stringBuilder.Append("\"hasOldBird\":").Append(oldBird ? "true" : "false").Append(','); stringBuilder.Append("\"onShip\":").Append(onShip ? "true" : "false").Append(','); stringBuilder.Append("\"popupActive\":").Append(flag ? "true" : "false").Append(','); stringBuilder.Append("\"storeAdActive\":").Append(flag2 ? "true" : "false").Append(','); stringBuilder.Append("\"endOfDaySec\":").Append(value7).Append(','); stringBuilder.Append("\"apparatusInside\":").Append(flag3 ? "true" : "false").Append(','); stringBuilder.Append("\"lootMultiplier\":").Append(num.ToString("0.##", CultureInfo.InvariantCulture)).Append(','); stringBuilder.Append("\"soldLoot\":").Append(soldTotal).Append(','); stringBuilder.Append("\"topKiller\":").Append(JsonStr(topKiller ?? "")).Append(','); stringBuilder.Append("\"topMonster\":").Append(JsonStr(topMonster ?? "")).Append(','); stringBuilder.Append("\"deadliestEvent\":").Append(JsonStr(deadliestEvent ?? "")).Append(','); stringBuilder.Append("\"monstersOutside\":").Append(JsonArr(list)).Append(','); stringBuilder.Append("\"monstersInside\":").Append(JsonArr(list2)).Append(','); stringBuilder.Append("\"traps\":").Append(JsonArr(items)).Append(','); stringBuilder.Append("\"run\":").Append(RunStats.ToJson()); stringBuilder.Append('}'); return stringBuilder.ToString(); } private static string JsonArr(List items) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('['); for (int i = 0; i < items.Count; i++) { if (i > 0) { stringBuilder.Append(','); } stringBuilder.Append(JsonStr(items[i])); } stringBuilder.Append(']'); return stringBuilder.ToString(); } private static string JsonStr(string s) { if (s == null) { return "\"\""; } StringBuilder stringBuilder = new StringBuilder(s.Length + 2); stringBuilder.Append('"'); foreach (char c in s) { switch (c) { case '"': stringBuilder.Append("\\\""); continue; case '\\': stringBuilder.Append("\\\\"); continue; case '\n': stringBuilder.Append("\\n"); continue; case '\r': stringBuilder.Append("\\r"); continue; case '\t': stringBuilder.Append("\\t"); continue; } if (c < ' ') { StringBuilder stringBuilder2 = stringBuilder.Append("\\u"); int num = c; stringBuilder2.Append(num.ToString("x4", CultureInfo.InvariantCulture)); } else { stringBuilder.Append(c); } } stringBuilder.Append('"'); return stringBuilder.ToString(); } } internal static class EnemyResolver { private static readonly string[] _turretMarkers = new string[3] { "ToilHeadController", "MantiToilController", "TurretHeadController" }; private static readonly string[] _slayerMarkers = new string[3] { "ToilSlayerController", "MantiSlayerController", "SlayerController" }; public static string Resolve(object enemyAiObj) { string baseName = GetBaseName(enemyAiObj); if (string.IsNullOrEmpty(baseName)) { return null; } try { switch (TurretKind(enemyAiObj)) { case 2: return baseName + "+Turret+Slayer"; case 1: return baseName + "+Turret"; } } catch { } return baseName; } private static string GetBaseName(object enemyAiObj) { try { EnemyAI val = (EnemyAI)((enemyAiObj is EnemyAI) ? enemyAiObj : null); if ((Object)(object)val != (Object)null && (Object)(object)val.enemyType != (Object)null && !string.IsNullOrEmpty(val.enemyType.enemyName)) { return val.enemyType.enemyName; } } catch { } return null; } private static int TurretKind(object enemyAiObj) { MonoBehaviour val = (MonoBehaviour)((enemyAiObj is MonoBehaviour) ? enemyAiObj : null); if ((Object)(object)val == (Object)null) { return 0; } Component[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); if (componentsInChildren == null) { return 0; } int num = 0; Component[] array = componentsInChildren; foreach (Component val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } string name = ((object)val2).GetType().Name; if (string.IsNullOrEmpty(name)) { continue; } string[] slayerMarkers = _slayerMarkers; foreach (string value in slayerMarkers) { if (name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return 2; } } if (num != 0) { continue; } slayerMarkers = _turretMarkers; foreach (string value2 in slayerMarkers) { if (name.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { num = 1; break; } } } return num; } } [HarmonyPatch(typeof(DepositItemsDesk), "SellAndDisplayItemProfits")] internal static class Patch_DepositItemsDesk_Sell { [HarmonyPrefix] public static void Prefix(int profit) { try { if (profit > 0) { RunStats.AddSold(profit); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[sold] продано на {profit} (всего за забег: {RunStats.SoldTotal})"); } } catch { } } } [HarmonyPatch] internal static class Patch_EnemyAI_HitEnemy { [HarmonyTargetMethods] internal static IEnumerable Targets() { List list = new List(); MethodInfo methodInfo = AccessTools.Method(typeof(EnemyAI), "HitEnemy", (Type[])null, (Type[])null); if (methodInfo != null) { list.Add(methodInfo); } try { Type[] types = typeof(EnemyAI).Assembly.GetTypes(); foreach (Type type in types) { if (!(type == null) && type.IsSubclassOf(typeof(EnemyAI))) { MethodInfo methodInfo2 = null; try { methodInfo2 = type.GetMethod("HitEnemy", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } catch { } if (methodInfo2 != null && !methodInfo2.IsAbstract) { list.Add(methodInfo2); } } } } catch { } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[hit] патчим HitEnemy: {list.Count} методов (база + переопределения)."); } return list; } [HarmonyPostfix] public static void Postfix(EnemyAI __instance, int force) { try { if (!((Object)(object)__instance == (Object)null) && force > 0) { MonsterState.MarkHurt(((Object)__instance).GetInstanceID()); string text = null; try { text = EnemyResolver.Resolve(__instance); } catch { } if (!string.IsNullOrEmpty(text)) { OverlayManager.Instance?.FlashMonster(text, __instance.isOutside); } } } catch { } } } [HarmonyPatch(typeof(StartMatchLever), "PullLever")] internal static class Patch_StartMatchLever_PullLever { [HarmonyPostfix] public static void Postfix() { try { RunSnapshot.OnLeverPulled(); OverlayManager.Instance?.HideAnalytics(); } catch { } } } internal static class RunSnapshot { public static string LastRunJson { get; private set; } public static bool ShowLastRun { get; private set; } public static void CaptureRunEnd() { try { LastRunJson = RunStats.ToJson(); ShowLastRun = true; GameState.BumpResetToken(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[run] забег завершён — аналитика сохранена, таймер сброшен."); } } catch { } } public static void OnLeverPulled() { if (ShowLastRun || LastRunJson != null) { ShowLastRun = false; LastRunJson = null; RunStats.ResetRun(); GameState.ResetDeaths(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[run] рычаг — статистика забега сброшена, начинаем новый."); } } } public static void ResetForNewSave() { ShowLastRun = false; LastRunJson = null; GameState.ResetDeaths(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[run] новый сейв — статистика и таймер обнулены."); } } } internal static class GameExtras { private const float AdMaxSeconds = 14f; private static float _adStarted = -1f; private static bool _mdSearched; private static Type _mdHandlerType; private static PropertyInfo _mdTimeLeft; private static PropertyInfo _mdStartedApi; private static bool _multSearched; private static FieldInfo _bcmeMulField; private static FieldInfo _bcmeMulNetField; private static PropertyInfo _bcmeMulNetInstance; private static PropertyInfo _bcmeMulNetValue; private static MethodInfo _wrGetCurrent; private static PropertyInfo _wrScrapEnabled; private static PropertyInfo _weatherScrapProp; private const BindingFlags F = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private const float NearDoor = 14f; private static int _lastDoorId = int.MinValue; private static bool _lastDoorSide; public static bool PopupActive() { try { HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null) { return false; } if (IsAnimatorShowing(instance.endgameStatsAnimator, "display", "displayStats", "showStats")) { return true; } if (IsAnimatorShowing(instance.globalNotificationAnimator, "display", "displayNotification")) { return true; } if (GetFloat(instance, "displayTipTextTimer") > 0.05f) { return true; } } catch { } return false; } public static bool StoreAdActive() { try { HUDManager instance = HUDManager.Instance; if ((Object)(object)instance == (Object)null) { _adStarted = -1f; return false; } bool num = IsAnimatorShowing(instance.advertAnimator, "display", "displayAd", "showAd"); bool flag = (Object)(object)instance.advertAnimator != (Object)null && ((Component)instance.advertAnimator).gameObject.activeInHierarchy; if (num || flag) { if (_adStarted < 0f) { _adStarted = Time.unscaledTime; } if (Time.unscaledTime - _adStarted > 14f) { return false; } return true; } _adStarted = -1f; } catch { _adStarted = -1f; } return false; } public static int SecondsToEndOfDay() { try { TimeOfDay instance = TimeOfDay.Instance; StartOfRound instance2 = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null || !instance2.shipHasLanded) { return -1; } float totalTime = instance.totalTime; if (totalTime <= 0f) { return -1; } float num = instance.normalizedTimeOfDay; if (num < 0f) { num = Mathf.Clamp01(instance.currentDayTime / totalTime); } float num2 = 1f; float shipLeaveAutomaticallyTime = instance.shipLeaveAutomaticallyTime; if (shipLeaveAutomaticallyTime > 0f && shipLeaveAutomaticallyTime <= 1f) { num2 = shipLeaveAutomaticallyTime; } float num3 = num2 - num; if (num3 <= 0f) { return 0; } float num4 = Mathf.Max(0.0001f, instance.globalTimeSpeedMultiplier); float num5 = totalTime / num4; int num6 = Mathf.RoundToInt(num3 * num5); num6 = Mathf.Clamp(num6, 0, 86400); int num7 = MeltdownSecondsLeft(); if (num7 >= 0 && num7 < num6) { num6 = num7; } return num6; } catch { return -1; } } public static int MeltdownSecondsLeft() { try { if (!_mdSearched) { _mdSearched = true; _mdHandlerType = GameState.FindTypeFuzzy("FacilityMeltdown", new string[1] { "MeltdownHandler" }); if (_mdHandlerType != null) { _mdTimeLeft = _mdHandlerType.GetProperty("TimeLeftUntilMeltdown", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } Type type = GameState.FindTypeFuzzy("FacilityMeltdown", new string[1] { "MeltdownAPI" }); if (type != null) { _mdStartedApi = type.GetProperty("MeltdownStarted", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[meltdown] handler=" + ((_mdHandlerType != null) ? "OK" : "нет") + ", TimeLeftUntilMeltdown=" + ((_mdTimeLeft != null) ? "OK" : "нет"))); } } if (_mdHandlerType == null || _mdTimeLeft == null) { return -1; } if (_mdStartedApi != null) { object value = _mdStartedApi.GetValue(null); if (value is bool && !(bool)value) { return -1; } } Object val = Object.FindObjectOfType(_mdHandlerType); if (val == (Object)null) { return -1; } if (!(_mdTimeLeft.GetValue(val) is float num) || num < 0f) { return -1; } return Mathf.Clamp(Mathf.RoundToInt(num), 0, 86400); } catch { return -1; } } public static bool ApparatusInside() { try { LungProp[] array = Object.FindObjectsOfType(); if (array == null || array.Length == 0) { return false; } LungProp[] array2 = array; foreach (LungProp val in array2) { if (!((Object)(object)val == (Object)null)) { if (val.isLungPowered) { return true; } GrabbableObject val2 = (GrabbableObject)(object)val; if ((Object)(object)val2 != (Object)null && val2.isInFactory && !val2.isHeld) { return true; } } } } catch { } return false; } private static float WeatherScrapMultiplier() { try { if (_wrGetCurrent == null) { return -1f; } if (_wrScrapEnabled != null) { object value = _wrScrapEnabled.GetValue(null); if (value is bool && !(bool)value) { return -1f; } } StartOfRound instance = StartOfRound.Instance; SelectableLevel val = (((Object)(object)instance != (Object)null) ? instance.currentLevel : null); if ((Object)(object)val == (Object)null) { return -1f; } object obj = _wrGetCurrent.Invoke(null, new object[1] { val }); if (obj == null) { return -1f; } if (_weatherScrapProp == null || _weatherScrapProp.DeclaringType != obj.GetType()) { _weatherScrapProp = obj.GetType().GetProperty("ScrapValueMultiplier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_weatherScrapProp == null) { return -1f; } return (_weatherScrapProp.GetValue(obj) is float num) ? num : (-1f); } catch { return -1f; } } public static float LootMultiplier() { float num = 1f; try { if (!_multSearched) { _multSearched = true; _bcmeMulField = FindStaticFloatFieldInAssembly("BrutalCompany", new string[1] { "Manager" }, new string[1] { "scrapValueMultiplier" }); Type type = GameState.FindTypeByFullName("WeatherRegistry.WeatherManager") ?? GameState.FindTypeFuzzy("WeatherRegistry", new string[1] { "WeatherManager" }); if (type != null) { _wrGetCurrent = type.GetMethod("GetCurrentWeather", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(SelectableLevel) }, null); } Type type2 = GameState.FindTypeFuzzy("WeatherRegistry", new string[1] { "Settings" }); if (type2 != null) { _wrScrapEnabled = type2.GetProperty("ScrapMultipliers", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } try { Type type3 = GameState.FindTypeByFullName("BrutalCompanyMinus.Net") ?? GameState.FindTypeFuzzy("BrutalCompany", new string[1] { "Net" }); if (type3 != null) { _bcmeMulNetInstance = type3.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] fields = type3.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { string text = fieldInfo.Name.ToLowerInvariant(); if (text.Contains("mult") && (text.Contains("scrap") || text.Contains("value") || text.Contains("loot")) && fieldInfo.FieldType.Name.StartsWith("NetworkVariable")) { _bcmeMulNetField = fieldInfo; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[loot-mult] сетевой множитель BCME: Net." + fieldInfo.Name)); } break; } } } } catch { } ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)("[loot-mult] BCME-поле=" + ((_bcmeMulField != null) ? (_bcmeMulField.DeclaringType?.Name + "." + _bcmeMulField.Name) : "не найдено") + ", WeatherRegistry.GetCurrentWeather=" + ((_wrGetCurrent != null) ? "OK" : "не найден"))); } } float num2 = BcmeMultiplier(); if (num2 > 0f) { num += num2 - 1f; } float num3 = WeatherScrapMultiplier(); if (num3 > 0f) { num += num3 - 1f; } } catch { } return Mathf.Clamp(num, 0f, 100f); } private static float BcmeMultiplier() { try { if (_bcmeMulNetField != null && _bcmeMulNetInstance != null) { object value = _bcmeMulNetInstance.GetValue(null); if (value != null) { object value2 = _bcmeMulNetField.GetValue(value); if (value2 != null) { if (_bcmeMulNetValue == null) { _bcmeMulNetValue = value2.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public); } if (((_bcmeMulNetValue != null) ? _bcmeMulNetValue.GetValue(value2) : null) is float num && num > 0f) { return num; } } } } } catch { } try { if (_bcmeMulField != null && _bcmeMulField.GetValue(null) is float num2 && num2 > 0f) { return num2; } } catch { } return -1f; } private static FieldInfo FindStaticFloatFieldInAssembly(string asmContains, string[] typeNames, string[] fieldNames) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if ((assembly.GetName().Name ?? "").IndexOf(asmContains, StringComparison.OrdinalIgnoreCase) < 0) { continue; } Type[] array; Type[] types; try { array = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { List list = new List(); types = ex.Types; foreach (Type type in types) { if (type != null) { list.Add(type); } } array = list.ToArray(); } types = array; foreach (Type type2 in types) { bool flag = false; string[] array2 = typeNames; foreach (string b in array2) { if (string.Equals(type2.Name, b, StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } if (!flag) { continue; } array2 = fieldNames; foreach (string name in array2) { try { FieldInfo field = type2.GetField(name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(float)) { return field; } } catch { } } } } } catch { } return null; } private static bool IsAnimatorShowing(Animator anim, params string[] boolParams) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 try { if ((Object)(object)anim == (Object)null || !((Component)anim).gameObject.activeInHierarchy) { return false; } AnimatorControllerParameter[] parameters = anim.parameters; foreach (AnimatorControllerParameter val in parameters) { if ((int)val.type != 4) { continue; } foreach (string b in boolParams) { if (string.Equals(val.name, b, StringComparison.OrdinalIgnoreCase) && anim.GetBool(val.nameHash)) { return true; } } } } catch { } return false; } private static object GetObj(object o, string name) { try { if (o == null) { return null; } FieldInfo field = o.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(o); } PropertyInfo property = o.GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return property.GetValue(o); } } catch { } return null; } private static float GetFloat(object o, string name) { object obj = GetObj(o, name); if (obj is float) { return (float)obj; } return 0f; } public static bool DoorProbe(Vector3 playerPos, out Vector3 otherSide, out bool otherSideIsInside) { //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_0067: 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_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_0072: 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_010d: 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) otherSide = Vector3.zero; otherSideIsInside = false; try { EntranceTeleport[] array = Object.FindObjectsOfType(); if (array == null || array.Length == 0) { return false; } EntranceTeleport val = null; float num = 196f; EntranceTeleport[] array2 = array; foreach (EntranceTeleport val2 in array2) { if (!((Object)(object)val2 == (Object)null)) { Vector3 val3 = (((Object)(object)val2.entrancePoint != (Object)null) ? val2.entrancePoint.position : ((Component)val2).transform.position) - playerPos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val = val2; } } } if ((Object)(object)val == (Object)null) { return false; } array2 = array; foreach (EntranceTeleport val4 in array2) { if ((Object)(object)val4 == (Object)null || (Object)(object)val4 == (Object)(object)val || val4.entranceId != val.entranceId || val4.isEntranceToBuilding == val.isEntranceToBuilding) { continue; } otherSide = (((Object)(object)val4.entrancePoint != (Object)null) ? val4.entrancePoint.position : ((Component)val4).transform.position); otherSideIsInside = val.isEntranceToBuilding; if (_lastDoorId != val.entranceId || _lastDoorSide != val.isEntranceToBuilding) { _lastDoorId = val.entranceId; _lastDoorSide = val.isEntranceToBuilding; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)($"[door] у двери id={val.entranceId} " + "(" + (val.isEntranceToBuilding ? "вход внутрь" : "выход наружу") + "), " + $"смотрим за неё в радиусе {ConfigSettings.DoorRadarRadius.Value:0} м.")); } } return true; } } catch { } return false; } } public static class GameState { private static int _deaths = 0; private static readonly HashSet _deadThisRound = new HashSet(); private static int _resetToken = 0; private static int _deathsBaseline; private static bool _baselineSet; private static int _deathsShown; private static int _deathsPending; private static bool _wasOnMoonDeaths; private static readonly Dictionary _killerCounts = new Dictionary(); private static readonly Dictionary _eventDeaths = new Dictionary(); private static readonly Dictionary _monsterSeen = new Dictionary(); private static Type _mgSpawnerType; private static bool _mgSearched; private static FieldInfo _mgOwnedField; private static PropertyInfo _mgInstanceProp; private static FieldInfo _mgInstanceField; private static Type _grabTurret; private static Type _grabMine; private static bool _grabSearched; private static int _landedScrap; private static bool _wasLanded; private static bool _scrapLocked; private static float _scrapSettleUntil; private const float ScrapSettleSeconds = 20f; private static Type _emType; private static FieldInfo _curEventsField; private static bool _bcSearched; private static readonly Dictionary _nameMethodCache = new Dictionary(); private static Type _wtVarsType; private static MethodInfo _wtGetCurrent; private static bool _wtSearched; private static float _lastLootLog; private static int _lastInside = -1; private static int _lastOutside = -1; public static int GetResetToken() { return _resetToken; } public static void BumpResetToken() { _resetToken++; } public static void RegisterDeath(PlayerControllerB p, string killer = null) { bool flag = false; try { int item = (int)p.playerClientId; if (_deadThisRound.Add(item)) { _deaths++; flag = true; } } catch { _deaths++; flag = true; } if (!flag) { return; } try { if (!string.IsNullOrEmpty(killer)) { _killerCounts.TryGetValue(killer, out var value); _killerCounts[killer] = value + 1; } string brutalEvent = GetBrutalEvent(); if (!string.IsNullOrEmpty(brutalEvent) && brutalEvent != "—") { _eventDeaths.TryGetValue(brutalEvent, out var value2); _eventDeaths[brutalEvent] = value2 + 1; } RunStats.OnDeath(killer); } catch { } } public static void OnNewRound() { _deadThisRound.Clear(); } public static void ResetDeaths() { _deaths = 0; _deadThisRound.Clear(); _baselineSet = false; _deathsShown = 0; _deathsPending = 0; _resetToken++; _killerCounts.Clear(); _eventDeaths.Clear(); _monsterSeen.Clear(); RunStats.ResetRun(); } public static int GetDeaths() { try { int num = _deaths; if (ConfigSettings.TeamDeaths.Value) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.gameStats != null) { int num2 = Mathf.Max(instance.gameStats.deaths, 0); if (!_baselineSet) { _deathsBaseline = num2; _baselineSet = true; } if (num2 < _deathsBaseline) { _deathsBaseline = num2; } num = num2 - _deathsBaseline; } } _deathsPending = num; if (!ConfigSettings.DeathsOnlyOnLeave.Value) { _deathsShown = num; return _deathsShown; } bool onMoon = GetOnMoon(); if (_wasOnMoonDeaths && !onMoon) { _deathsShown = _deathsPending; } _wasOnMoonDeaths = onMoon; return _deathsShown; } catch { return _deaths; } } public static void TickStats() { try { HashSet hashSet = new HashSet(); foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { hashSet.Add(text); } } } foreach (string item in hashSet) { _monsterSeen.TryGetValue(item, out var value); _monsterSeen[item] = value + 1; } } catch { } } private static string TopOf(Dictionary dict) { string result = null; int num = 0; foreach (KeyValuePair item in dict) { if (item.Value > num) { num = item.Value; result = item.Key; } } return result; } public static string GetTopKiller() { return TopOf(_killerCounts); } public static string GetTopMonster() { return TopOf(_monsterSeen); } public static string GetDeadliestEvent() { return TopOf(_eventDeaths); } public static (int alive, int total) GetCrew() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return (alive: 0, total: 0); } int num = 0; int num2 = 0; PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && (val.isPlayerControlled || val.isPlayerDead)) { num++; if (!val.isPlayerDead) { num2++; } } } if (num == 0) { num = 1; } return (alive: num2, total: num); } catch { return (alive: 0, total: 0); } } public static int GetLocalHealth() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return 0; } return val.health; } catch { return 0; } } private static void EnsureMonstersGordion() { if (_mgSearched) { return; } _mgSearched = true; _mgSpawnerType = FindTypeByFullName("MonstersGordion.CompanyMonsterSpawner") ?? FindTypeFuzzy("MonstersGordion", new string[1] { "CompanyMonsterSpawner" }); if (_mgSpawnerType != null) { _mgOwnedField = _mgSpawnerType.GetField("_ownedEnemies", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? _mgSpawnerType.GetField("ownedEnemies", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _mgInstanceProp = _mgSpawnerType.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public); _mgInstanceField = _mgSpawnerType.GetField("Instance", BindingFlags.Static | BindingFlags.Public); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] MonstersGordion=" + _mgSpawnerType.FullName + ", _ownedEnemies=" + ((_mgOwnedField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] MonstersGordion не найден (не установлен?)"); } } } public static List GetGordionEnemies() { List list = new List(); try { EnsureMonstersGordion(); if (_mgSpawnerType == null || _mgOwnedField == null) { return list; } object obj = _mgInstanceProp?.GetValue(null) ?? _mgInstanceField?.GetValue(null) ?? GetSingletonInstance(_mgSpawnerType); if (obj == null) { return list; } if (!(_mgOwnedField.GetValue(obj) is IEnumerable enumerable)) { return list; } foreach (object item in enumerable) { EnemyAI val = (EnemyAI)((item is EnemyAI) ? item : null); if (val != null && (Object)(object)val != (Object)null && !val.isEnemyDead) { list.Add(val); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetGordionEnemies fail: " + ex.Message)); } } return list; } public static List GetAllLiveEnemies() { List list = new List(); HashSet hashSet = new HashSet(); try { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance != (Object)null && instance.SpawnedEnemies != null) { foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if ((Object)(object)spawnedEnemy != (Object)null && !spawnedEnemy.isEnemyDead && hashSet.Add(((Object)spawnedEnemy).GetInstanceID())) { list.Add(spawnedEnemy); } } } } catch { } foreach (EnemyAI gordionEnemy in GetGordionEnemies()) { if ((Object)(object)gordionEnemy != (Object)null && !gordionEnemy.isEnemyDead && hashSet.Add(((Object)gordionEnemy).GetInstanceID())) { list.Add(gordionEnemy); } } return list; } public static (List outside, List inside) GetMonsters() { //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_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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_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_0161: 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) List list = new List(); List list2 = new List(); try { Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); Dictionary dictionary3 = new Dictionary(); Dictionary dictionary4 = new Dictionary(); Vector3 val = Vector3.zero; bool flag = false; try { PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val2 != (Object)null) { val = ((Component)val2).transform.position; flag = true; } } catch { } Vector3 otherSide = Vector3.zero; bool flag2 = false; bool otherSideIsInside = false; float num = 0f; if (flag && Gate.DoorRadar) { flag2 = GameExtras.DoorProbe(val, out otherSide, out otherSideIsInside); num = Mathf.Clamp(Gate.DoorRadius, 5f, 60f); } foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if ((Object)(object)allLiveEnemy == (Object)null || allLiveEnemy.isEnemyDead || !MonsterState.VisibleToLocal(allLiveEnemy)) { continue; } string text = "Unknown"; try { string text2 = EnemyResolver.Resolve(allLiveEnemy); if (!string.IsNullOrEmpty(text2)) { text = text2; } } catch { } text += MonsterState.TokensFor(allLiveEnemy); Dictionary obj3 = (allLiveEnemy.isOutside ? dictionary : dictionary2); obj3.TryGetValue(text, out var value); obj3[text] = value + 1; if (!flag) { continue; } float num2 = Vector3.Distance(val, ((Component)allLiveEnemy).transform.position); if (flag2 && allLiveEnemy.isOutside != otherSideIsInside) { float num3 = Vector3.Distance(otherSide, ((Component)allLiveEnemy).transform.position); if (num3 <= num && num3 < num2) { num2 = num3; } } Dictionary dictionary5 = (allLiveEnemy.isOutside ? dictionary3 : dictionary4); if (!dictionary5.TryGetValue(text, out var value2) || num2 < value2) { dictionary5[text] = num2; } } foreach (KeyValuePair item in dictionary) { list.Add(Fmt(item.Key, item.Value, dictionary3)); } foreach (KeyValuePair item2 in dictionary2) { list2.Add(Fmt(item2.Key, item2.Value, dictionary4)); } list.Sort(StringComparer.Ordinal); list2.Sort(StringComparer.Ordinal); } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetMonsters fail: " + ex.Message)); } } return (outside: list, inside: list2); } private static string Fmt(string name, int count, Dictionary dist) { string text = ((count > 1) ? $"{name} x{count}" : name); if (dist != null && dist.TryGetValue(name, out var value)) { text = text + " @" + Mathf.RoundToInt(value); } return text; } private static bool OnShip(Vector3 p) { //IL_0013: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_006d: Unknown result type (might be due to invalid IL or missing references) try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } Vector3 val = p + Vector3.up * 0.25f; Bounds bounds; if ((Object)(object)instance.shipBounds != (Object)null) { bounds = instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(val)) { return true; } } if ((Object)(object)instance.shipInnerRoomBounds != (Object)null) { bounds = instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(val)) { return true; } } } catch { } return false; } public static List GetTraps() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0142: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Dictionary> pos; try { bool needScan = Gate.RequireScan; pos = new Dictionary>(); if (!_grabSearched) { _grabSearched = true; _grabTurret = FindTypeByFullName("BrutalCompanyMinus.Minus.MonoBehaviours.GrabbableTurret"); _grabMine = FindTypeByFullName("BrutalCompanyMinus.Minus.MonoBehaviours.GrabbableLandmine"); } CollectType("Turret"); CollectType("Landmine"); CollectType("Spike Trap"); CollectGrabbable(_grabTurret, "Turret"); CollectGrabbable(_grabMine, "Landmine"); Vector3 val = Vector3.zero; bool flag = false; try { PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val2 != (Object)null) { val = ((Component)val2).transform.position; flag = true; } } catch { } foreach (KeyValuePair> item in pos) { int count = item.Value.Count; string text = ((count > 1) ? $"{item.Key} x{count}" : item.Key); if (flag && count > 0) { float num = float.MaxValue; foreach (Vector3 item2 in item.Value) { float num2 = Vector3.Distance(val, item2); if (num2 < num) { num = num2; } } if (num < float.MaxValue) { text = text + " @" + Mathf.RoundToInt(num); } } list.Add(text); } void CollectGrabbable(Type t, string label) { //IL_0050: 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) try { if (!(t == null)) { Object[] array = Object.FindObjectsOfType(t); if (array != null) { Object[] array2 = array; foreach (Object obj2 in array2) { GrabbableObject val3 = (GrabbableObject)(object)((obj2 is GrabbableObject) ? obj2 : null); if (!((Object)(object)val3 == (Object)null) && !val3.isHeld && !val3.isHeldByEnemy && !val3.isInShipRoom && !OnShip(((Component)val3).transform.position) && (!needScan || !ScanRegistry.Scannable((Component)(object)val3) || ScanRegistry.HasFor((Component)(object)val3))) { Add(label, ((Component)val3).transform.position); } } } } } catch { } } void CollectType(string label) where T : Component { //IL_0032: 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 { T[] array = Object.FindObjectsOfType(); if (array != null) { T[] array2 = array; foreach (T val3 in array2) { if (!((Object)(object)val3 == (Object)null) && !OnShip(((Component)val3).transform.position) && (!needScan || !ScanRegistry.Scannable((Component)(object)val3) || ScanRegistry.HasFor((Component)(object)val3))) { Add(label, ((Component)val3).transform.position); } } } } catch { } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)("GetTraps fail: " + ex.Message)); } } return list; void Add(string label, Vector3 p) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!pos.TryGetValue(label, out var value)) { value = new List(); pos[label] = value; } value.Add(p); } } public static int GetLevelScrap() { try { RoundManager instance = RoundManager.Instance; if (GetOnMoon()) { if (!_wasLanded) { _wasLanded = true; _scrapLocked = false; _landedScrap = 0; _scrapSettleUntil = Time.unscaledTime + 20f; } if ((Object)(object)instance != (Object)null && !_scrapLocked) { int num = (int)instance.totalScrapValueInLevel; if (num > _landedScrap) { _landedScrap = num; } if (_landedScrap > 0 && Time.unscaledTime >= _scrapSettleUntil) { _scrapLocked = true; } } } else { _wasLanded = false; _scrapLocked = false; _landedScrap = 0; } return _landedScrap; } catch { return _landedScrap; } } private static string GetEventName(object ev) { Type type = ev.GetType(); if (!_nameMethodCache.TryGetValue(type, out var value)) { value = type.GetMethod("Name", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _nameMethodCache[type] = value; } if (value != null) { try { return value.Invoke(ev, null) as string; } catch { } } return ExtractName(ev); } public static string GetBrutalEvent() { try { if (!_bcSearched) { _bcSearched = true; _emType = FindTypeByFullName("BrutalCompanyMinus.Minus.EventManager") ?? FindTypeFuzzy("BrutalCompany", new string[1] { "EventManager" }); if (_emType != null) { _curEventsField = _emType.GetField("currentEvents", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] BCMER EventManager=" + _emType.FullName + ", currentEvents field=" + ((_curEventsField != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] BCMER EventManager не найден (мод выключен?)"); } } } List list = new List(); if (_curEventsField != null && _curEventsField.GetValue(null) is IEnumerable enumerable) { foreach (object item in enumerable) { if (item != null) { string eventName = GetEventName(item); if (!string.IsNullOrEmpty(eventName)) { list.Add(eventName); } } } } if (list.Count == 0 && OverlayNet.HasHostState && !string.IsNullOrEmpty(OverlayNet.HostEvents)) { string[] array = OverlayNet.HostEvents.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0) { list.Add(text); } } } if (list.Count == 0) { foreach (BcmerEvents.EventInfo item2 in BcmeClientEvents.Get()) { if (!string.IsNullOrEmpty(item2.Name)) { list.Add(item2.Name); } } } if (list.Count == 0) { return null; } return string.Join(", ", list); } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("GetBrutalEvent fail: " + ex.Message)); } return null; } } public static string GetWeatherTweaksWeather() { try { if (!_wtSearched) { _wtSearched = true; _wtVarsType = FindTypeByFullName("WeatherTweaks.Variables") ?? FindTypeFuzzy("WeatherTweaks", new string[1] { "Variables" }); if (_wtVarsType != null) { _wtGetCurrent = _wtVarsType.GetMethod("GetCurrentWeather", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] WeatherTweaks Variables=" + _wtVarsType.FullName + ", GetCurrentWeather=" + ((_wtGetCurrent != null) ? "OK" : "НЕ НАЙДЕНО"))); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[reflection] WeatherTweaks Variables не найден (мод выключен?)"); } } } if (_wtGetCurrent == null) { return null; } object obj = _wtGetCurrent.Invoke(null, null); if (obj == null) { return null; } string text = ExtractName(obj); return string.IsNullOrEmpty(text) ? null : text; } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)("GetWeatherTweaks fail: " + ex.Message)); } return null; } } public static string GetVanillaWeather() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return "None"; } return ((object)Unsafe.As(ref instance.currentLevel.currentWeather)/*cast due to .constrained prefix*/).ToString(); } catch { return "None"; } } public static string GetMoonName() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return "—"; } return instance.currentLevel.PlanetName; } catch { return "—"; } } public static bool GetOnMoon() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.currentLevel == (Object)null) { return false; } return instance.shipHasLanded; } catch { return false; } } public static bool GetLoading() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } return instance.travellingToNewLevel; } catch { return false; } } public static bool GetInGame() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } return instance.shipHasLanded || instance.travellingToNewLevel; } catch { return false; } } public static int GetDayCount() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && instance.gameStats != null) { return instance.gameStats.daysSpent + 1; } TimeOfDay instance2 = TimeOfDay.Instance; if ((Object)(object)instance2 == (Object)null) { return 1; } return (instance2.daysUntilDeadline < 0) ? 1 : (3 - instance2.daysUntilDeadline); } catch { return 1; } } public static int GetQuotaIndexSafe() { try { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return 1; } return instance.timesFulfilledQuota + 1; } catch { return 1; } } public static int GetShipScrapSafe() { try { int num = 0; GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && (component.isInShipRoom || component.isInElevator)) { num += component.scrapValue; } } return num; } catch { return 0; } } public static List> GetShipScrapItems() { List> list = new List>(); try { GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && (component.isInShipRoom || component.isInElevator)) { list.Add(new KeyValuePair(((Object)component).GetInstanceID(), component.scrapValue)); } } } catch { } return list; } public static List> GetMonsterInstances() { List> list = new List>(); try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { list.Add(new KeyValuePair(((Object)allLiveEnemy).GetInstanceID(), text)); } } } } catch { } return list; } public static (List outside, List inside) GetMonstersRaw() { List list = new List(); List list2 = new List(); try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = EnemyResolver.Resolve(allLiveEnemy); if (text != null) { (allLiveEnemy.isOutside ? list : list2).Add(text); } } } } catch { } return (outside: list, inside: list2); } public static (int quota, int fulfilled) GetQuotaProgress() { try { TimeOfDay instance = TimeOfDay.Instance; if ((Object)(object)instance == (Object)null) { return (quota: 0, fulfilled: 0); } return (quota: instance.profitQuota, fulfilled: instance.quotaFulfilled); } catch { return (quota: 0, fulfilled: 0); } } public static int GetDaysLeft() { try { TimeOfDay instance = TimeOfDay.Instance; return ((Object)(object)instance != (Object)null) ? instance.daysUntilDeadline : (-1); } catch { return -1; } } public static string GetInterior() { try { if (!GetOnMoon()) { return null; } DungeonFlow val = RoundManager.Instance?.dungeonGenerator?.Generator?.DungeonFlow; if ((Object)(object)val == (Object)null) { return null; } string text = ((Object)val).name ?? ""; if (text.IndexOf("Level1", StringComparison.OrdinalIgnoreCase) >= 0) { return "Facility"; } if (text.IndexOf("Level2", StringComparison.OrdinalIgnoreCase) >= 0) { return "Mansion"; } if (text.IndexOf("Level3", StringComparison.OrdinalIgnoreCase) >= 0) { return "Mineshaft"; } text = text.Replace("DungeonFlow", "").Replace("Flow", "").Replace("flow", "") .Trim(); return string.IsNullOrEmpty(text) ? null : text; } catch { return null; } } public static (int hives, int inside, int outside) GetLootBreakdown() { int num = 0; int num2 = 0; int num3 = 0; try { if (!GetOnMoon()) { return (hives: 0, inside: 0, outside: 0); } GameObject[] array = GameObject.FindGameObjectsWithTag("PhysicsProp"); for (int i = 0; i < array.Length; i++) { GrabbableObject component = array[i].GetComponent(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.isScrap && !component.isInShipRoom && !component.isInElevator && !component.isHeld && !component.isHeldByEnemy) { if ((component.itemProperties.itemName ?? "").IndexOf("hive", StringComparison.OrdinalIgnoreCase) >= 0) { num++; } else if (component.isInFactory) { num2++; } else { num3++; } } } if (Time.time - _lastLootLog > 5f && (num2 != _lastInside || num3 != _lastOutside)) { _lastLootLog = Time.time; _lastInside = num2; _lastOutside = num3; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[loot] внутри={num2} снаружи={num3} ульи={num}"); } } } catch { } return (hives: num, inside: num2, outside: num3); } public static bool GetOldBird() { try { foreach (EnemyAI allLiveEnemy in GetAllLiveEnemies()) { if (!((Object)(object)allLiveEnemy == (Object)null) && !allLiveEnemy.isEnemyDead) { string text = (((Object)(object)allLiveEnemy.enemyType != (Object)null) ? (allLiveEnemy.enemyType.enemyName ?? "") : ""); if (text.IndexOf("RadMech", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Old Bird", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } } catch { } return false; } public static bool GetOnShip() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isInHangarShipRoom; } catch { return false; } } public static bool GetInsideFactorySafe() { try { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isInsideFactory; } catch { return false; } } internal static Type FindTypeByFullName(string fullName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = null; try { type = assembly.GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } } catch { } return null; } internal static Type FindTypeFuzzy(string asmNameContains, string[] typeNameCandidates) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string text = assembly.GetName().Name ?? ""; if (text.IndexOf(asmNameContains, StringComparison.OrdinalIgnoreCase) < 0) { continue; } Type[] source; try { source = assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { source = ex.Types.Where((Type t) => t != null).ToArray(); } foreach (string cand in typeNameCandidates) { Type type = source.FirstOrDefault((Type t) => string.Equals(t.Name, cand, StringComparison.OrdinalIgnoreCase)); if (type != null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[reflection] нашёл тип " + type.FullName + " в " + text)); } return type; } } } } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)("FindTypeFuzzy fail: " + ex2.Message)); } } return null; } private static object ReadStaticMember(Type t, string name) { try { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { if (field.IsStatic) { return field.GetValue(null); } object singletonInstance = GetSingletonInstance(t); if (singletonInstance != null) { return field.GetValue(singletonInstance); } } PropertyInfo property = t.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { MethodInfo? getMethod = property.GetGetMethod(nonPublic: true); if ((object)getMethod != null && getMethod.IsStatic) { return property.GetValue(null); } object singletonInstance2 = GetSingletonInstance(t); if (singletonInstance2 != null) { return property.GetValue(singletonInstance2); } } } catch { } return null; } private static object GetSingletonInstance(Type t) { try { PropertyInfo propertyInfo = t.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public) ?? t.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); if (propertyInfo != null) { return propertyInfo.GetValue(null); } FieldInfo fieldInfo = t.GetField("Instance", BindingFlags.Static | BindingFlags.Public) ?? t.GetField("instance", BindingFlags.Static | BindingFlags.Public); if (fieldInfo != null) { return fieldInfo.GetValue(null); } } catch { } return null; } private static string ExtractName(object val) { if (val == null) { return null; } try { if (val is string result) { return result; } if (val.GetType().IsEnum) { return val.ToString(); } Type type = val.GetType(); PropertyInfo propertyInfo = type.GetProperty("Name") ?? type.GetProperty("name"); if (propertyInfo != null) { string text = propertyInfo.GetValue(val) as string; if (!string.IsNullOrEmpty(text)) { return text; } } FieldInfo fieldInfo = type.GetField("Name") ?? type.GetField("name"); if (fieldInfo != null) { string text2 = fieldInfo.GetValue(val) as string; if (!string.IsNullOrEmpty(text2)) { return text2; } } string text3 = val.ToString(); if (!string.IsNullOrEmpty(text3) && text3 != type.FullName && text3 != type.Name) { return text3; } } catch { } return null; } } internal static class MonsterState { private const float Interval = 0.5f; private static float _next; private static readonly Dictionary _tokens = new Dictionary(); private static readonly Dictionary _hauntTarget = new Dictionary(); private static readonly HashSet _scanned = new HashSet(); private static bool _loggedOnce; private const float HurtHold = 1.6f; private static readonly Dictionary _hurt = new Dictionary(); private static Terminal _terminal; private static readonly Dictionary _scanIdCache = new Dictionary(); private static readonly HashSet _deviant = new HashSet(); private static readonly Dictionary _windMax = new Dictionary(); private static readonly Dictionary _members = new Dictionary(); private const BindingFlags F = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; public static void Reset() { _tokens.Clear(); _hauntTarget.Clear(); _scanned.Clear(); _scanIdCache.Clear(); _hurt.Clear(); _deviant.Clear(); _windMax.Clear(); _terminal = null; } public static void MarkHurt(int instanceId) { try { _hurt[instanceId] = Time.unscaledTime; _next = 0f; BridgeTicker.ForceImmediate(); } catch { } } private static bool IsScannedByBestiary(EnemyAI ai) { try { if ((Object)(object)_terminal == (Object)null) { _terminal = Object.FindObjectOfType(); } if ((Object)(object)_terminal == (Object)null || _terminal.scannedEnemyIDs == null) { return false; } int instanceID = ((Object)ai).GetInstanceID(); if (!_scanIdCache.TryGetValue(instanceID, out var value)) { value = -1; ScanNodeProperties componentInChildren = ((Component)ai).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { value = componentInChildren.creatureScanID; } _scanIdCache[instanceID] = value; } return value >= 0 && _terminal.scannedEnemyIDs.Contains(value); } catch { return false; } } public static void MarkScanned(int instanceId) { _scanned.Add(instanceId); } public static bool IsScanned(int instanceId) { return _scanned.Contains(instanceId); } public static string TokensFor(EnemyAI ai) { if ((Object)(object)ai == (Object)null) { return ""; } if (!_tokens.TryGetValue(((Object)ai).GetInstanceID(), out var value)) { return ""; } return value; } public static bool VisibleToLocal(EnemyAI ai) { try { if ((Object)(object)ai == (Object)null) { return true; } int instanceID = ((Object)ai).GetInstanceID(); if (!_hauntTarget.TryGetValue(instanceID, out var value)) { return true; } PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); if ((Object)(object)val == (Object)null) { return false; } return value == ((Object)val).GetInstanceID(); } catch { return true; } } public static void Tick(List enemies) { try { if (Time.unscaledTime < _next) { return; } _next = Time.unscaledTime + 0.5f; if (enemies == null) { return; } _tokens.Clear(); _hauntTarget.Clear(); foreach (EnemyAI enemy in enemies) { if ((Object)(object)enemy == (Object)null || enemy.isEnemyDead) { continue; } string text = ((object)enemy).GetType().Name ?? ""; string text2 = ""; int num = 0; try { num = enemy.currentBehaviourStateIndex; } catch { } if (text.IndexOf("Hoarder", StringComparison.OrdinalIgnoreCase) >= 0) { if (GetBool(enemy, "isAngry") || GetBool(enemy, "inChase")) { text2 += "+Aggro"; } } else if (text.IndexOf("Jester", StringComparison.OrdinalIgnoreCase) >= 0) { int instanceID = ((Object)enemy).GetInstanceID(); if (num >= 2) { text2 += "+Angry"; _windMax.Remove(instanceID); } else if (num == 1) { float num2 = GetFloat(enemy, "popUpTimer"); if (!_windMax.TryGetValue(instanceID, out var value) || num2 > value) { value = num2; _windMax[instanceID] = value; } float num3 = ((value > 0.01f) ? Mathf.Clamp01(1f - num2 / value) : 0f); text2 = text2 + "+w" + Mathf.Clamp(Mathf.RoundToInt(num3 * 9f), 0, 9); } else { _windMax.Remove(instanceID); } } else if (text.IndexOf("CaveDweller", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Maneater", StringComparison.OrdinalIgnoreCase) >= 0) { bool flag = false; object obj2 = GetObj(enemy, "adultContainer"); GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null); if ((Object)(object)val != (Object)null) { flag = val.activeSelf; } if (!flag) { flag = GetBool(enemy, "adultMode", "grownUp", "isAdult"); } if (flag) { text2 += "+Adult"; } } else if (text.IndexOf("Nutcracker", StringComparison.OrdinalIgnoreCase) >= 0) { if (GetBool(enemy, "aimingGun") || GetBool(enemy, "isInspecting") || GetBool(enemy, "torsoTurning")) { text2 += "+Attack"; } } else if (text.IndexOf("Centipede", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("SnareFlea", StringComparison.OrdinalIgnoreCase) >= 0) { if (GetBool(enemy, "clingingToCeiling", "onCeiling", "hangingOnCeiling")) { text2 += "+Ceiling"; } } else if (text.IndexOf("SpringMan", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Coil", StringComparison.OrdinalIgnoreCase) >= 0) { bool flag2 = GetBool(enemy, "hasStopped", "stoppingMovement"); if (!flag2) { flag2 = AnyPlayerLookingAt(((Component)enemy).transform); } if (flag2) { text2 += "+Frozen"; } } else if (text.IndexOf("DressGirl", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("GhostGirl", StringComparison.OrdinalIgnoreCase) >= 0) { object obj3 = GetObj(enemy, "hauntingPlayer", "targetPlayer", "hauntedPlayer"); PlayerControllerB val2 = (PlayerControllerB)((obj3 is PlayerControllerB) ? obj3 : null); if ((Object)(object)val2 != (Object)null) { _hauntTarget[((Object)enemy).GetInstanceID()] = ((Object)val2).GetInstanceID(); } } if (IsTurretFiring(enemy)) { text2 += "+Firing"; } if (IsDeviant(enemy)) { text2 += "+Deviant"; } if (ConfigSettings.DamageFlash.Value && _hurt.TryGetValue(((Object)enemy).GetInstanceID(), out var value2) && Time.unscaledTime - value2 <= 1.6f) { text2 += "+Hurt"; } if ((!Gate.ResetScansDaily && IsScannedByBestiary(enemy)) || _scanned.Contains(((Object)enemy).GetInstanceID()) || ScanRegistry.HasFor((Component)(object)enemy)) { text2 += "+Scanned"; } if (text2.Length > 0) { _tokens[((Object)enemy).GetInstanceID()] = text2; } } if (_loggedOnce || _tokens.Count <= 0) { return; } _loggedOnce = true; StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair token in _tokens) { stringBuilder.Append(token.Value).Append(' '); } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[states] первые состояния: " + stringBuilder)); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)("MonsterState.Tick: " + ex.Message)); } } } private static bool IsDeviant(EnemyAI ai) { try { int instanceID = ((Object)ai).GetInstanceID(); if (_deviant.Contains(instanceID)) { return true; } Component[] componentsInChildren = ((Component)ai).GetComponentsInChildren(true); if (componentsInChildren == null) { return false; } Component[] array = componentsInChildren; foreach (Component val in array) { if (!((Object)(object)val == (Object)null) && string.Equals(((object)val).GetType().Name, "DeviantMarker", StringComparison.Ordinal)) { _deviant.Add(instanceID); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[deviant] " + ((object)ai).GetType().Name + " помечен как девиант — иконка перевёрнута.")); } BridgeTicker.ForceImmediate(); return true; } } } catch { } return false; } private static bool IsTurretFiring(EnemyAI ai) { try { Component[] componentsInChildren = ((Component)ai).GetComponentsInChildren(true); if (componentsInChildren == null) { return false; } Component[] array = componentsInChildren; foreach (Component val in array) { if ((Object)(object)val == (Object)null || ((object)val).GetType().Name.IndexOf("Turret", StringComparison.OrdinalIgnoreCase) < 0) { continue; } object obj = GetObj(val, "turretMode", "mode", "currentMode"); if (obj != null) { string text = obj.ToString(); if (text.IndexOf("Fir", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Berserk", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } } catch { } return false; } private static bool AnyPlayerLookingAt(Transform t) { //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_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_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_009e: 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_00bc: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)t == (Object)null) { return false; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null) { return false; } PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead) { continue; } Camera gameplayCamera = val.gameplayCamera; if (!((Object)(object)gameplayCamera == (Object)null)) { Vector3 val2 = t.position + Vector3.up * 1.2f - ((Component)gameplayCamera).transform.position; if (!(((Vector3)(ref val2)).magnitude > 40f) && Vector3.Dot(((Component)gameplayCamera).transform.forward, ((Vector3)(ref val2)).normalized) > 0.86f) { return true; } } } } catch { } return false; } private static MemberInfo FindMember(Type t, string[] names) { string key = t.FullName + "|" + string.Join(",", names); if (_members.TryGetValue(key, out var value)) { return value; } foreach (string name in names) { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { _members[key] = field; return field; } PropertyInfo property = t.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { _members[key] = property; return property; } } _members[key] = null; return null; } private static object GetObj(object o, params string[] names) { try { if (o == null) { return null; } MemberInfo memberInfo = FindMember(o.GetType(), names); FieldInfo fieldInfo = memberInfo as FieldInfo; if (fieldInfo != null) { return fieldInfo.GetValue(o); } PropertyInfo propertyInfo = memberInfo as PropertyInfo; if (propertyInfo != null) { return propertyInfo.GetValue(o); } } catch { } return null; } private static float GetFloat(object o, params string[] names) { object obj = GetObj(o, names); if (obj is float) { return (float)obj; } return 0f; } private static bool GetBool(object o, params string[] names) { object obj = GetObj(o, names); if (obj is bool) { return (bool)obj; } return false; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerB_Patches { [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPostfix] public static void OnLocalPlayerReady() { try { OverlayNet.OnLocalPlayerReady(); } catch { } } [HarmonyPatch("KillPlayer")] [HarmonyPostfix] public static void OnKillPlayer(PlayerControllerB __instance, CauseOfDeath causeOfDeath) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)null && __instance.isPlayerDead) { string killer = ResolveKiller(__instance, causeOfDeath); GameState.RegisterDeath(__instance, killer); } } private static string ResolveKiller(PlayerControllerB player, CauseOfDeath cause) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: 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_0030: Expected I4, but got Unknown //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_00dc: 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) try { if ((int)cause != 2) { switch (cause - 5) { case 4: return "Drowning"; case 0: return "Suffocation"; case 8: return "Fire"; case 6: return "Shock"; case 3: return "Crushed"; default: { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null) { return "Unknown"; } Vector3 position = ((Component)player).transform.position; float num = 25f; string text = null; foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && !spawnedEnemy.isEnemyDead) { float num2 = Vector3.Distance(position, ((Component)spawnedEnemy).transform.position); if (num2 < num) { num = num2; text = EnemyResolver.Resolve(spawnedEnemy); } } } return string.IsNullOrEmpty(text) ? "Unknown" : text; } } } return "Fall"; } catch { return "Unknown"; } } } public static class RunStats { public class QuotaSlice { public int index; public int scrapStart; public int scrapEnd; public int seconds; public int deaths; } private class MoonStat { public int visits; public int profit; public int seconds; } private static readonly List _quotas = new List(); private static QuotaSlice _curQuota; private static int _lastQuotaIndex = -1; private static readonly Dictionary _moons = new Dictionary(); private static string _curMoon; private static int _moonScrapStart; private static readonly Dictionary _monsterTime = new Dictionary(); private static readonly Dictionary _monsterCount = new Dictionary(); private static readonly HashSet _seenMonsterIds = new HashSet(); private static int _peakMonsters; private static readonly Dictionary _collectedScrap = new Dictionary(); private static int _secInside; private static int _secOutside; private static readonly List _timeline = new List(); private static int _lastDayLogged = -1; private static string _lastEventLogged; private static int _runSeconds; public static int SoldTotal { get; private set; } public static void AddSold(int value) { if (value > 0) { SoldTotal += value; } } public static void ResetRun() { _quotas.Clear(); _curQuota = null; _lastQuotaIndex = -1; _moons.Clear(); _curMoon = null; _moonScrapStart = 0; _monsterTime.Clear(); _peakMonsters = 0; _monsterCount.Clear(); _seenMonsterIds.Clear(); _collectedScrap.Clear(); _secInside = 0; _secOutside = 0; _timeline.Clear(); _lastDayLogged = -1; _lastEventLogged = null; _runSeconds = 0; SoldTotal = 0; } public static void OnDeath(string killer) { try { int dayCount = GameState.GetDayCount(); string moonName = GameState.GetMoonName(); string arg = (string.IsNullOrEmpty(killer) ? "?" : killer); _timeline.Add($"{dayCount}|death|{arg}@{moonName}"); if (_curQuota != null) { _curQuota.deaths++; } } catch { } } public static void Tick() { try { if (!GameState.GetInGame()) { return; } _runSeconds++; int dayCount = GameState.GetDayCount(); int quotaIndexSafe = GameState.GetQuotaIndexSafe(); bool onMoon = GameState.GetOnMoon(); string moonName = GameState.GetMoonName(); string brutalEvent = GameState.GetBrutalEvent(); foreach (KeyValuePair shipScrapItem in GameState.GetShipScrapItems()) { if (!_collectedScrap.ContainsKey(shipScrapItem.Key)) { _collectedScrap[shipScrapItem.Key] = shipScrapItem.Value; } } int num = 0; foreach (int value in _collectedScrap.Values) { num += value; } if (quotaIndexSafe != _lastQuotaIndex) { if (_curQuota != null) { _curQuota.scrapEnd = num; _quotas.Add(_curQuota); } _curQuota = new QuotaSlice { index = quotaIndexSafe, scrapStart = num, scrapEnd = num, seconds = 0, deaths = 0 }; _lastQuotaIndex = quotaIndexSafe; } if (_curQuota != null) { _curQuota.seconds++; _curQuota.scrapEnd = num; } if (onMoon && !string.IsNullOrEmpty(moonName)) { if (_curMoon != moonName) { _curMoon = moonName; _moonScrapStart = num; if (!_moons.ContainsKey(moonName)) { _moons[moonName] = new MoonStat(); } _moons[moonName].visits++; } MoonStat moonStat = _moons[moonName]; moonStat.seconds++; int num2 = num - _moonScrapStart; if (num2 > 0) { moonStat.profit += num2; _moonScrapStart = num; } } else { _curMoon = null; } List> monsterInstances = GameState.GetMonsterInstances(); foreach (KeyValuePair item in monsterInstances) { Add(_monsterTime, item.Value); if (_seenMonsterIds.Add(item.Key)) { Add(_monsterCount, item.Value); } } int count = monsterInstances.Count; if (count > _peakMonsters) { _peakMonsters = count; } if (onMoon) { if (GameState.GetInsideFactorySafe()) { _secInside++; } else { _secOutside++; } } if (onMoon && !string.IsNullOrEmpty(moonName) && moonName != "—" && dayCount > 0 && dayCount != _lastDayLogged) { _lastDayLogged = dayCount; _timeline.Add($"{dayCount}|day|{moonName}"); } if (!string.IsNullOrEmpty(brutalEvent) && brutalEvent != "—" && brutalEvent != _lastEventLogged) { _lastEventLogged = brutalEvent; _timeline.Add($"{dayCount}|event|{brutalEvent}"); } } catch { } } private static void Add(Dictionary d, string k) { if (!string.IsNullOrEmpty(k)) { d.TryGetValue(k, out var value); d[k] = value + 1; } } public static string ToJson() { try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('{'); stringBuilder.Append("\"quotas\":["); List list = new List(_quotas); if (_curQuota != null) { list.Add(_curQuota); } for (int i = 0; i < list.Count; i++) { QuotaSlice quotaSlice = list[i]; if (i > 0) { stringBuilder.Append(','); } int value = Math.Max(0, quotaSlice.scrapEnd - quotaSlice.scrapStart); stringBuilder.Append('{').Append("\"i\":").Append(quotaSlice.index) .Append(',') .Append("\"money\":") .Append(value) .Append(',') .Append("\"sec\":") .Append(quotaSlice.seconds) .Append(',') .Append("\"deaths\":") .Append(quotaSlice.deaths) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"moons\":["); int num = 0; foreach (KeyValuePair item in _moons.OrderByDescending((KeyValuePair x) => x.Value.profit)) { if (num++ > 0) { stringBuilder.Append(','); } stringBuilder.Append('{').Append("\"name\":").Append(JsonStr(item.Key)) .Append(',') .Append("\"visits\":") .Append(item.Value.visits) .Append(',') .Append("\"profit\":") .Append(item.Value.profit) .Append(',') .Append("\"sec\":") .Append(item.Value.seconds) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"monsters\":["); int num2 = 0; foreach (KeyValuePair item2 in _monsterCount.OrderByDescending((KeyValuePair x) => x.Value).Take(20)) { if (num2++ > 0) { stringBuilder.Append(','); } _monsterTime.TryGetValue(item2.Key, out var value2); stringBuilder.Append('{').Append("\"name\":").Append(JsonStr(item2.Key)) .Append(',') .Append("\"count\":") .Append(item2.Value) .Append(',') .Append("\"sec\":") .Append(value2) .Append('}'); } stringBuilder.Append("],"); stringBuilder.Append("\"peak\":").Append(_peakMonsters).Append(','); stringBuilder.Append("\"inside\":").Append(_secInside).Append(','); stringBuilder.Append("\"outside\":").Append(_secOutside).Append(','); stringBuilder.Append("\"runSec\":").Append(_runSeconds).Append(','); stringBuilder.Append("\"timeline\":["); for (int num3 = 0; num3 < _timeline.Count && num3 < 120; num3++) { if (num3 > 0) { stringBuilder.Append(','); } stringBuilder.Append(JsonStr(_timeline[num3])); } stringBuilder.Append(']'); stringBuilder.Append('}'); return stringBuilder.ToString(); } catch { return "{}"; } } private static string JsonStr(string s) { if (s == null) { return "\"\""; } StringBuilder stringBuilder = new StringBuilder("\""); foreach (char c in s) { switch (c) { case '"': case '\\': stringBuilder.Append('\\').Append(c); break; case '\n': case '\r': stringBuilder.Append(' '); break; default: stringBuilder.Append(c); break; } } stringBuilder.Append('"'); return stringBuilder.ToString(); } } [HarmonyPatch(typeof(HUDManager), "AssignNodeToUIElement")] internal static class Patch_HUDManager_AssignNodeToUIElement { private static readonly HashSet _logged = new HashSet(); [HarmonyPostfix] public static void Postfix(ScanNodeProperties node) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)node == (Object)null) { return; } EnemyAI val = ((Component)node).GetComponentInParent(); if ((Object)(object)val == (Object)null) { val = NearestEnemy(((Component)node).transform.position, 8f); } if ((Object)(object)val != (Object)null) { MonsterState.MarkScanned(((Object)val).GetInstanceID()); ScanRegistry.MarkLocal((Component)(object)val); if (_logged.Add(((Object)val).GetInstanceID())) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[scan] отсканирован " + ((object)val).GetType().Name + " (\"" + node.headerText + "\") — покажем в оверлее.")); } } return; } Component componentInParent = (Component)(object)((Component)node).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)node).GetComponentInParent(); } if ((Object)(object)componentInParent == (Object)null) { componentInParent = (Component)(object)((Component)node).GetComponentInParent(); } if (!((Object)(object)componentInParent != (Object)null)) { return; } ScanRegistry.MarkLocal(componentInParent); if (_logged.Add(((Object)componentInParent).GetInstanceID())) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)("[scan] отсканирована ловушка " + ((object)componentInParent).GetType().Name + " — покажем в оверлее.")); } } } catch { } } private static EnemyAI NearestEnemy(Vector3 pos, float maxDist) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) try { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.SpawnedEnemies == null) { return null; } EnemyAI result = null; float num = maxDist * maxDist; foreach (EnemyAI spawnedEnemy in instance.SpawnedEnemies) { if (!((Object)(object)spawnedEnemy == (Object)null) && !spawnedEnemy.isEnemyDead) { Vector3 val = ((Component)spawnedEnemy).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = spawnedEnemy; } } } return result; } catch { return null; } } } internal static class ScanRegistry { private static readonly HashSet _ids = new HashSet(); private static readonly List _pending = new List(); private static readonly Dictionary _scannable = new Dictionary(); public static bool Dirty { get; set; } public static int Count => _ids.Count; public static bool Has(ulong id) { if (id != 0L) { return _ids.Contains(id); } return false; } public static void Mark(ulong id, bool local) { if (id != 0L && _ids.Add(id)) { Dirty = true; if (local) { _pending.Add(id); } } } public static void Merge(ulong[] ids) { if (ids == null) { return; } foreach (ulong num in ids) { if (num != 0L) { _ids.Add(num); } } } public static void Replace(ulong[] ids) { _ids.Clear(); Merge(ids); } public static ulong[] Snapshot() { ulong[] array = new ulong[_ids.Count]; _ids.CopyTo(array); return array; } public static ulong[] TakePending() { if (_pending.Count == 0) { return null; } ulong[] result = _pending.ToArray(); _pending.Clear(); return result; } public static void Clear() { _ids.Clear(); _scannable.Clear(); _pending.Clear(); Dirty = true; } public static ulong IdOf(Component c) { try { if ((Object)(object)c == (Object)null) { return 0uL; } NetworkObject val = c.GetComponentInParent(); if ((Object)(object)val == (Object)null) { val = c.GetComponentInChildren(); } return ((Object)(object)val != (Object)null && val.IsSpawned) ? val.NetworkObjectId : 0; } catch { return 0uL; } } public static bool Scannable(Component c) { try { if ((Object)(object)c == (Object)null) { return false; } int instanceID = ((Object)c).GetInstanceID(); if (_scannable.TryGetValue(instanceID, out var value)) { return value; } value = (Object)(object)c.GetComponentInChildren(true) != (Object)null || (Object)(object)c.GetComponentInParent() != (Object)null; _scannable[instanceID] = value; return value; } catch { return false; } } public static bool HasFor(Component c) { return Has(IdOf(c)); } public static void MarkLocal(Component c) { Mark(IdOf(c), local: true); } } [HarmonyPatch(typeof(StartOfRound))] public static class StartOfRound_Patches { [HarmonyPatch("ResetShip")] [HarmonyPostfix] public static void OnResetShip() { RunSnapshot.CaptureRunEnd(); } [HarmonyPatch("SetTimeAndPlanetToSavedSettings")] [HarmonyPostfix] public static void OnLoadSavedSettings() { try { StartOfRound instance = StartOfRound.Instance; if (!((Object)(object)instance == (Object)null) && ((instance.gameStats != null && instance.gameStats.daysSpent <= 0) || ((Object)(object)TimeOfDay.Instance != (Object)null && TimeOfDay.Instance.timesFulfilledQuota <= 0 && TimeOfDay.Instance.daysUntilDeadline >= 3))) { RunSnapshot.ResetForNewSave(); } } catch { } } [HarmonyPatch("StartGame")] [HarmonyPostfix] public static void OnStartGame() { try { if (Gate.ResetScansDaily) { ScanRegistry.Clear(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[scan] новый день — сканы сброшены."); } } } catch { } GameState.OnNewRound(); } [HarmonyPatch("StartGame")] [HarmonyPrefix] public static void BeforeStartGame() { BcmeClientEvents.Clear(); MonsterState.Reset(); } [HarmonyPatch("OnShipLandedMiscEvents")] [HarmonyPostfix] public static void OnLanded() { BridgeTicker.ForceImmediate(); } } [HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")] internal static class Patch_RoundManager_LevelReady { [HarmonyPostfix] public static void Postfix() { BridgeTicker.ForceImmediate(); } } public static class ConfigSettings { public static ConfigEntry Enabled; public static ConfigEntry Style; public static ConfigEntry AlwaysVisible; public static ConfigEntry ToggleKey; public static ConfigEntry Language; public static ConfigEntry Scale; public static ConfigEntry RightOffsetPx; public static ConfigEntry PerspectiveStrength; public static ConfigEntry FadeWhenIdle; public static ConfigEntry IdleFadeSeconds; public static ConfigEntry IdleMinOpacity; public static ConfigEntry CameraSway; public static ConfigEntry CameraSwayStrength; public static ConfigEntry ShowPanel; public static ConfigEntry ShowTimer; public static ConfigEntry ShowLocation; public static ConfigEntry ShowQuota; public static ConfigEntry ShowDayDeaths; public static ConfigEntry ShowMonsters; public static ConfigEntry ShowTraps; public static ConfigEntry ShowBrutalEvent; public static ConfigEntry ShowVictoryBanner; public static ConfigEntry ShowTicker; public static ConfigEntry AutoTimer; public static ConfigEntry ShowAllEvents; public static ConfigEntry TimerPauseKey; public static ConfigEntry TimerResetKey; public static ConfigEntry Scanlines; public static ConfigEntry ScaleMonstersByCount; public static ConfigEntry RequireScanToShow; public static ConfigEntry ProximityFade; public static ConfigEntry ProximityShake; public static ConfigEntry ResetScansEachDay; public static ConfigEntry TeamDeaths; public static ConfigEntry DeathsOnlyOnLeave; public static ConfigEntry HideOnPopups; public static ConfigEntry HideOnStoreAd; public static ConfigEntry DoorRadar; public static ConfigEntry DoorRadarRadius; public static ConfigEntry NearestVariantOnly; public static ConfigEntry VariantNearDistance; public static ConfigEntry VariantCycleSeconds; public static ConfigEntry DamageFlash; public static ConfigEntry ShowEndOfDayCountdown; public static ConfigEntry ShowLootMultiplier; public static ConfigEntry ShowApparatusIcon; public static ConfigEntry DeviantFlipIcon; public static ConfigEntry JesterWindUpShake; public static ConfigEntry WebSocketEnabled; public static ConfigEntry Port; private static bool _keyHooks; private static readonly Dictionary _symbolKeys = new Dictionary { ["\\"] = (Key)10, ["`"] = (Key)4, ["~"] = (Key)4, ["["] = (Key)11, ["]"] = (Key)12, ["-"] = (Key)13, ["="] = (Key)14, [";"] = (Key)6, ["'"] = (Key)5, ["\""] = (Key)5, [","] = (Key)7, ["."] = (Key)8, ["/"] = (Key)9, [" "] = (Key)1, ["\t"] = (Key)3 }; public static Key ToggleKeyParsed { get; private set; } = (Key)23; public static Key TimerPauseKeyParsed { get; private set; } = (Key)29; public static Key TimerResetKeyParsed { get; private set; } = (Key)0; public static bool LegacyStyleActive => string.Equals(Style.Value?.Trim(), "Legacy", StringComparison.OrdinalIgnoreCase); public static bool RussianActive { get { string a = Language.Value?.Trim(); if (string.Equals(a, "ru", StringComparison.OrdinalIgnoreCase)) { return true; } if (string.Equals(a, "en", StringComparison.OrdinalIgnoreCase)) { return false; } return Rtlc.Present; } } public static void Bind(ConfigFile cfg) { Enabled = cfg.Bind("General", "Enabled", true, "Включить/выключить оверлей целиком."); Style = cfg.Bind("General", "Style", "Game", "Стиль оверлея: \"Legacy\" (старый пиксельный из HTML) или \"Game\" (как внутриигровой чат). Требует перезапуска игры."); AlwaysVisible = cfg.Bind("General", "AlwaysVisible", false, "true — оверлей виден всегда (даже вне корабля), клавиша показа/скрытия работает везде. false — оверлей виден только когда игрок на корабле."); ToggleKey = cfg.Bind("General", "ToggleKey", "I", "Клавиша показать/скрыть оверлей. Можно писать как символ (\\ , ` , [ , - , = , ; , ' , . , /) или имя из UnityEngine.InputSystem.Key (I, F7, Numpad0, Backslash, Backquote). Меняется на лету, без перезапуска."); Language = cfg.Bind("General", "Language", "auto", "Язык надписей оверлея: \"auto\" (русский, если установлен русификатор RTLC, иначе английский), \"en\" или \"ru\"."); Scale = cfg.Bind("General", "Scale", 1f, "Масштаб оверлея (0.5–2.0)."); RightOffsetPx = cfg.Bind("General", "RightOffsetPx", 20, "Отступ оверлея от правого края экрана в пикселях."); PerspectiveStrength = cfg.Bind("General", "PerspectiveStrength", 0f, "ЭКСПЕРИМЕНТ: эффект перспективы (как чат «уходит вдаль») — ближняя к центру экрана сторона сужается. 0 — выключить (по умолчанию). Попробуй 0.16. Искажает и текст, и рамки. Требует перезапуска."); FadeWhenIdle = cfg.Bind("General", "FadeWhenIdle", true, "Приглушать оверлей, если долго не двигать камерой (возвращается при движении камеры)."); IdleFadeSeconds = cfg.Bind("General", "IdleFadeSeconds", 4f, "Сколько секунд без движения камеры до приглушения оверлея."); IdleMinOpacity = cfg.Bind("General", "IdleMinOpacity", 0.32f, "Насколько приглушать: итоговая непрозрачность в бездействии (0 — полностью прозрачный, 1 — без приглушения)."); CameraSway = cfg.Bind("General", "CameraSway", true, "Панель слегка качается/наклоняется вслед за движением камеры — синергия с модами вроде Camera Overhaul (как игровые меню). Читает наклон самой камеры, поэтому работает с любым таким модом и без него."); CameraSwayStrength = cfg.Bind("General", "CameraSwayStrength", 1f, "Сила покачивания (0 — выключить, 2 — заметнее). Применяется на лету."); ShowPanel = cfg.Bind("Widgets", "ShowPanel", true, "Общая панель: фон, рамка/уголки и логотип GDLP."); ShowTimer = cfg.Bind("Widgets", "ShowTimer", true, "Таймер (запуск/пауза/сброс — клавиши в секции Behavior; авто-режим — AutoTimer)."); ShowLocation = cfg.Bind("Widgets", "ShowLocation", true, "Блок локации: луна, погода, тип интерьера, ульи, предметы внутри/снаружи, Old Bird."); ShowQuota = cfg.Bind("Widgets", "ShowQuota", true, "Прогресс квоты: табы Q1–Q3, полоса выполнения, собранный лут."); ShowDayDeaths = cfg.Bind("Widgets", "ShowDayDeaths", true, "День и счётчик смертей."); ShowMonsters = cfg.Bind("Widgets", "ShowMonsters", true, "Монстры: слева — наружные (outside), справа — внутренние (inside)."); ShowTraps = cfg.Bind("Widgets", "ShowTraps", true, "Ловушки (турели, мины, шипы) в нижней части оверлея. При турельном ивенте — анимация стрельбы."); ShowBrutalEvent = cfg.Bind("Widgets", "ShowBrutalEvent", true, "Плашка с ивентом от BCME (BrutalCompanyMinusExtraReborn). Видна только на луне."); ShowVictoryBanner = cfg.Bind("Widgets", "ShowVictoryBanner", true, "Баннер победы после выполнения 3-й квоты (с аналитикой забега: квоты, луны, монстры, хроника)."); ShowTicker = cfg.Bind("Widgets", "ShowTicker", true, "Бегущая строка с краткой сводкой: экипаж, луна, погода, день, квота, смерти."); AutoTimer = cfg.Bind("Behavior", "AutoTimer", true, "true — таймер автоматически запускается при начале рейда и встаёт на паузу при загрузках/меню. false — только ручное управление."); ShowAllEvents = cfg.Bind("Behavior", "ShowAllEvents", false, "true — показывать ВСЕ ивенты BCME (через запятую). false — только первый из списка."); TimerPauseKey = cfg.Bind("Behavior", "TimerPauseKey", "O", "Клавиша паузы/запуска таймера. None — отключить."); TimerResetKey = cfg.Bind("Behavior", "TimerResetKey", "None", "Клавиша сброса таймера. None — отключить (сброс всё равно происходит при новом сейве)."); Scanlines = cfg.Bind("Behavior", "Scanlines", true, "Едва заметные горизонтальные полосы (CRT/LSD-эффект как в ванильных меню). Требует перезапуска игры."); ScaleMonstersByCount = cfg.Bind("Behavior", "ScaleMonstersByCount", false, "ЭКСПЕРИМЕНТ: убрать цифры количества у монстров И ловушек — вместо этого чем их больше, тем крупнее иконка и тем сильнее она трясётся."); RequireScanToShow = cfg.Bind("Behavior", "RequireScanToShow", false, "Показывать монстра в оверлее ТОЛЬКО после того, как игрок его отсканировал (сканером). Учитывается бестиарий игры: как только вид отсканирован — он показывается. false — видно сразу."); ProximityFade = cfg.Bind("Behavior", "ProximityFade", true, "Чем БЛИЖЕ монстр к игроку, тем менее прозрачна его иконка (дальний — почти прозрачный). false — все иконки полностью непрозрачные."); TeamDeaths = cfg.Bind("Behavior", "TeamDeaths", true, "Считать смерти ВСЕЙ команды (даже если ты не видел смерть), а не только замеченные локально. Полностью заменяет старый способ подсчёта."); DeathsOnlyOnLeave = cfg.Bind("Behavior", "DeathsOnlyOnLeave", false, "Обновлять счётчик смертей только при отлёте корабля с луны (по итогам вылазки), а не мгновенно."); HideOnPopups = cfg.Bind("Behavior", "HideOnPopups", true, "Прятать оверлей во время игровых всплывающих окон (подсказки, сдача квоты, экран конца дня) и возвращать после закрытия."); HideOnStoreAd = cfg.Bind("Behavior", "HideOnStoreAd", true, "Прятать оверлей во время рекламы магазина. Пока реклама идёт, вернуть его клавишей нельзя."); DoorRadar = cfg.Bind("Behavior", "DoorRadar", true, "У двери комплекса (главный вход/пожарный выход) показывать монстров, которые находятся ПО ТУ СТОРОНУ двери."); DoorRadarRadius = cfg.Bind("Behavior", "DoorRadarRadius", 22f, "Радиус «виртуального радара» за дверью, метров (5–60)."); NearestVariantOnly = cfg.Bind("Behavior", "NearestVariantOnly", true, "Если у монстра несколько версий (например, обычный и с турелью) — показывать ВСЕГДА ОДНУ иконку: ту версию, что рядом, а если рядом никого — версии плавно сменяют друг друга по кругу."); VariantNearDistance = cfg.Bind("Behavior", "VariantNearDistance", 14f, "До скольких метров версия считается «рядом»: её иконка закрепляется и не сменяется. 0 — никогда не закреплять."); VariantCycleSeconds = cfg.Bind("Behavior", "VariantCycleSeconds", 2f, "Сколько секунд показывается каждая версия, когда рядом никого (плавная смена по кругу). 0 — не листать, показывать ближайшую."); DamageFlash = cfg.Bind("Behavior", "DamageFlash", true, "Иконка монстра кратко вспыхивает красным, когда монстр получает урон."); ShowEndOfDayCountdown = cfg.Bind("Behavior", "ShowEndOfDayCountdown", true, "Отсчёт до конца дня (появляется за 10 секунд)."); ShowLootMultiplier = cfg.Bind("Behavior", "ShowLootMultiplier", true, "Показывать суммарный множитель стоимости лута (погода + ивенты) отдельным числом."); ShowApparatusIcon = cfg.Bind("Behavior", "ShowApparatusIcon", true, "Иконка лампы (аппарата) рядом с интерьером, пока аппарат не вынесли из комплекса."); DeviantFlipIcon = cfg.Bind("Behavior", "DeviantFlipIcon", true, "Инверснутые монстры (мод DeviantEnemies) показываются перевёрнутой вверх ногами иконкой."); JesterWindUpShake = cfg.Bind("Behavior", "JesterWindUpShake", true, "Пока джестер заводится, его иконка трясётся всё сильнее — и в момент хлопка сменяется на иконку 2-й фазы."); ProximityShake = cfg.Bind("Behavior", "ProximityShake", true, "Чем ближе монстр, тем сильнее дрожит его иконка: издалека — еле заметное покачивание, вплотную — нервная тряска."); ResetScansEachDay = cfg.Bind("Behavior", "ResetScansEachDay", false, "Работает вместе с RequireScanToShow: каждый новый день все сканы забываются, включая уже открытый бестиарий. Тогда монстров и ловушки приходится сканировать заново каждую высадку, и заранее знать, что тебя ждёт, невозможно."); WebSocketEnabled = cfg.Bind("WebSocket", "Enabled", false, "Отдавать данные наружу по WebSocket для HTML-оверлея в OBS. Выключено по умолчанию: пока не включишь, мод не открывает ни одного порта. Внутриигровому оверлею это не нужно — включай, только если ведёшь стрим через OBS."); Port = cfg.Bind("WebSocket", "Port", 8181, "Порт встроенного WebSocket-моста. По нему HTML-оверлей (OBS) получает те же данные. Если у тебя ещё стоит отдельный мод LCBridge — удали его, иначе порт будет занят."); ReparseKeys(); ToggleKey.SettingChanged += delegate { ReparseKeys(); }; TimerPauseKey.SettingChanged += delegate { ReparseKeys(); }; TimerResetKey.SettingChanged += delegate { ReparseKeys(); }; } private static void ReparseKeys() { //IL_000c: 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_0036: Unknown result type (might be due to invalid IL or missing references) ToggleKeyParsed = ParseKey(ToggleKey.Value, (Key)23); TimerPauseKeyParsed = ParseKey(TimerPauseKey.Value, (Key)0); TimerResetKeyParsed = ParseKey(TimerResetKey.Value, (Key)0); if (!_keyHooks) { _keyHooks = true; ToggleKey.SettingChanged += delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ToggleKeyParsed = ParseKey(ToggleKey.Value, (Key)23); }; TimerPauseKey.SettingChanged += delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) TimerPauseKeyParsed = ParseKey(TimerPauseKey.Value, (Key)0); }; TimerResetKey.SettingChanged += delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) TimerResetKeyParsed = ParseKey(TimerResetKey.Value, (Key)0); }; } } private static Key ParseKey(string s, Key fallback) { //IL_0021: 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_0081: 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_0057: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(s)) { return (Key)0; } s = s.Trim(); if (_symbolKeys.TryGetValue(s, out var value)) { return value; } if (s.Length == 1 && s[0] >= '0' && s[0] <= '9' && Enum.TryParse("Digit" + s, ignoreCase: true, out Key result)) { return result; } if (Enum.TryParse(s, ignoreCase: true, out Key result2)) { return result2; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("Не удалось распознать клавишу '" + s + "'. Пиши символ (\\ ` [ - = ; ' . /) или имя InputSystem.Key (Backslash, F7, Numpad0). " + $"Пока использую {fallback}.")); } return fallback; } } [Serializable] public class BridgePayload { public string type; public int deaths; public int alive; public int total; public int health; public string moonName; public string weatherFull; public string brutalEvent; public bool onMoon; public bool loading; public bool inGame; public int resetToken; public int levelScrap; public string topKiller; public string topMonster; public string deadliestEvent; public string[] monstersOutside; public string[] monstersInside; public string[] traps; public RunInfo run; public int quotaValue; public int quotaFulfilled; public int shipLoot; public int quotaIndex = 1; public int dayCount = 1; public int daysLeft = -1; public string interiorType; public int beehiveCount; public int itemsInside; public int itemsOutside; public bool hasOldBird; public bool onShip; public bool popupActive; public bool storeAdActive; public int endOfDaySec = -1; public bool apparatusInside; public float lootMultiplier = 1f; public int soldLoot; } [Serializable] public class RunInfo { public RunQuota[] quotas; public RunMoon[] moons; public RunMonster[] monsters; public int peak; public int inside; public int outside; public int runSec; public string[] timeline; } [Serializable] public class RunQuota { public int i; public int money; public int sec; public int deaths; } [Serializable] public class RunMoon { public string name; public int visits; public int profit; public int sec; } [Serializable] public class RunMonster { public string name; public int count; public int sec; } public static class DataParser { private static string _pendingLocal; private static readonly object _localLock = new object(); public static float Heartbeat = -999f; public static BridgePayload Current { get; private set; } public static void PushLocal(string json) { lock (_localLock) { _pendingLocal = json; } } public static string TakeLocal() { lock (_localLock) { string pendingLocal = _pendingLocal; _pendingLocal = null; return pendingLocal; } } public static bool TryParse(string json) { if (string.IsNullOrEmpty(json)) { return false; } BridgePayload bridgePayload; try { bridgePayload = JsonUtility.FromJson(json); } catch { return false; } if (bridgePayload == null || bridgePayload.type != "bridge") { return false; } Current = bridgePayload; return true; } public static void Clear() { Current = null; } } public static class EventTranslate { private static readonly HashSet _loggedMiss = new HashSet(); private static readonly Dictionary Map = new Dictionary { ["allweather"] = "Вся погода сразу", ["antibounty"] = "Награда снята", ["anticoilhead"] = "Анти-койлхед", ["arachnophobia"] = "Арахнофобия", ["baboonhorde"] = "Орда павианов", ["badproduce"] = "Гнилой урожай", ["bees"] = "Пчёлы", ["berserkturrets"] = "Турели в ярости", ["bigbonus"] = "Большой бонус", ["bigdelivery"] = "Большая доставка", ["birds"] = "Птицы", ["blackfriday"] = "Чёрная пятница", ["bonus"] = "Бонус", ["bounty"] = "Награда за голову", ["bracken"] = "Бракен", ["bughorde"] = "Орда жуков", ["butlers"] = "Дворецкие", ["cadaver"] = "Трупоцвет", ["catsanddogs"] = "Кошки и собаки", ["clock"] = "Часы", ["coilhead"] = "Койлхед", ["controlpad"] = "Пульт управления", ["cruiserfailure"] = "Поломка крейсера", ["dentures"] = "Вставная челюсть", ["dogs"] = "Слепые псы", ["doorcircuitfailure"] = "Сбой цепи дверей", ["doorfailure"] = "Поломка дверей", ["dooroverdriveev"] = "Двери вразнос", ["dustpans"] = "Совки", ["dweller"] = "Пещерный житель", ["earlyship"] = "Ранний отлёт", ["eastereggs"] = "Пасхалки", ["explodingitems"] = "Взрывающиеся предметы", ["facilityghost"] = "Призрак комплекса", ["flashlightsfailure"] = "Сбой фонарей", ["flowersnake"] = "Тюльпановая змейка", ["footballscrap"] = "Ценный мяч", ["forestgiant"] = "Лесной великан", ["fragileenemies"] = "Хрупкие враги", ["fullaccess"] = "Полный доступ", ["garbagelid"] = "Крышка мусорки", ["giantsoutside"] = "Великаны снаружи", ["gloomy"] = "Пасмурно", ["goldenbars"] = "Золотые слитки", ["goldenfacility"] = "Золотой комплекс", ["grabbablelandmines"] = "Переносные мины", ["grabbableturrets"] = "Переносные турели", ["heavyrain"] = "Ливень", ["hell"] = "Ад", ["higherscrapvalue"] = "Лут дороже", ["hoardingbugs"] = "Жуки-барахольщики", ["holidayseason"] = "Праздники", ["honk"] = "Гудок", ["insidebees"] = "Пчёлы внутри", ["ismetal"] = "Металлический день", ["itemchargerfailure"] = "Сбой зарядной станции", ["jester"] = "Шут", ["jetpackfailure"] = "Сбой джетпака", ["kamikaziebugs"] = "Жуки-камикадзе", ["kidnapperfox"] = "Лис-похититель", ["kiwibird"] = "Гигантский киви", ["landmines"] = "Мины", ["lateship"] = "Поздний отлёт", ["leaflessbrowntrees"] = "Голые бурые деревья", ["leaflesstrees"] = "Голые деревья", ["leverfailure"] = "Сбой рычага отлёта", ["littlegirl"] = "Девочка-призрак", ["lizard"] = "Спор-ящер", ["lockedentrance"] = "Запертый вход", ["locusts"] = "Саранча", ["manualcamerafailure"] = "Сбой камер", ["masked"] = "Маскед", ["maskitem"] = "Маска", ["metalswitch"] = "Металлический рубильник", ["meteors"] = "Метеоры", ["moreexits"] = "Больше выходов", ["morescrap"] = "Больше лута", ["nobaboons"] = "Без павианов", ["nobirds"] = "Без птиц", ["nobracken"] = "Без бракена", ["nobutlers"] = "Без дворецких", ["nocoilhead"] = "Без койлхедов", ["nodogs"] = "Без псов", ["noghosts"] = "Без призраков", ["nogiants"] = "Без великанов", ["nohoardingbugs"] = "Без жуков-барахольщиков", ["nojester"] = "Без шута", ["nolandmines"] = "Без мин", ["nolizards"] = "Без ящеров", ["nomasks"] = "Без масок", ["nonutcracker"] = "Без щелкунчиков", ["nooldbird"] = "Без старых птиц", ["noslimes"] = "Без слизней", ["nosnarefleas"] = "Без блох", ["nospiders"] = "Без пауков", ["nospiketraps"] = "Без шипов", ["nothing"] = "Ничего", ["nothumpers"] = "Без тамперов", ["notmetal"] = "Не металл", ["noturrets"] = "Без турелей", ["noworm"] = "Без червя", ["nutcracker"] = "Щелкунчик", ["nutslayer"] = "Щелкунчик-палач", ["nutslayersmore"] = "Щелкунчики-палачи", ["oldbirds"] = "Старые птицы (мехи)", ["outsidelandmines"] = "Мины снаружи", ["outsideturrets"] = "Турели снаружи", ["pickles"] = "Огурчики", ["plasticcup"] = "Пластиковый стаканчик", ["plentyoutsidescrap"] = "Много лута снаружи", ["puma"] = "Феиопар", ["raining"] = "Дождь", ["realityshift"] = "Сдвиг реальности", ["safeoutside"] = "Снаружи безопасно", ["scarceoutsidescrap"] = "Мало лута снаружи", ["scrapgalore"] = "Лут в изобилии", ["severedbits"] = "Расчленёнка", ["shipcorefailure"] = "Сбой ядра корабля", ["shiplightsfailure"] = "Сбой света корабля", ["shipmentfees"] = "Плата за доставку", ["sid"] = "SID", ["slimeinside"] = "Слизень внутри", ["slimes"] = "Слизни", ["smalldelivery"] = "Малая доставка", ["smallermap"] = "Карта поменьше", ["snarefleas"] = "Блохи-душители", ["spiders"] = "Пауки", ["spiketraps"] = "Шипы-ловушки", ["stingray"] = "Скат", ["strongenemies"] = "Сильные враги", ["sussypaintings"] = "Подозрительные картины", ["targetingfailureevent"] = "Сбой наведения", ["teleporterfailure"] = "Сбой телепорта", ["teleportertraps"] = "Ловушки-телепорты", ["teleportin"] = "Телепортация внутрь", ["terminalfailure"] = "Сбой терминала", ["thumpers"] = "Тамперы", ["timechaos"] = "Хаос времени", ["toiletpaper"] = "Туалетная бумага", ["train"] = "Поезд", ["transmutescrapbig"] = "Трансмутация лута (много)", ["transmutescrapsmall"] = "Трансмутация лута (мало)", ["trapsfailure"] = "Сбой ловушек", ["trees"] = "Деревья", ["turrets"] = "Турели", ["turretseverywhere"] = "Турели повсюду", ["veryearlyship"] = "Очень ранний отлёт", ["verylateship"] = "Очень поздний отлёт", ["walkiefailure"] = "Сбой рации", ["warzone"] = "Зона боевых действий", ["welcometothefactory"] = "Добро пожаловать на завод", ["worms"] = "Земляные левиафаны", ["zeddog"] = "Пёс-зомби", ["allslayers"] = "Все палачи", ["baddice"] = "Дурные кости", ["baldi"] = "Балди", ["barbers"] = "Барберы", ["bellcrab"] = "Краб-звоночек", ["bertha"] = "Берта", ["bloodmoon"] = "Кровавая луна", ["cityofgold"] = "Золотой город", ["cleaners"] = "Чистильщики", ["critters"] = "Мелкие твари", ["dice"] = "Кости", ["football"] = "Футбол", ["forsaken"] = "Забытый", ["foxy"] = "Фокси", ["giantshowdown"] = "Битва великанов", ["hallowed"] = "Хэллоуин", ["heatwave"] = "Аномальная жара", ["herobrine"] = "Херобрин", ["hotbarhassle"] = "Свистопляска инвентаря", ["hotbarmania"] = "Мания инвентаря", ["hurricane"] = "Ураган", ["immortalsnail"] = "Бессмертная улитка", ["itsplaytime"] = "Playtime", ["leafboys"] = "Листовые парни", ["lighteaterenemy"] = "Пожиратель света", ["lockers"] = "Локеры", ["majoramoon"] = "Луна Majora", ["manstalker"] = "Преследователь", ["mantitoil"] = "Мантикоил с турелью", ["mantitoilslayer"] = "Мантикоил-палач", ["meltdown"] = "Расплавление реактора", ["meteorshower"] = "Метеоритный дождь", ["moaienemy"] = "Моаи", ["mobileturrets"] = "Мобильные турели", ["needycats"] = "Назойливые коты", ["nemo"] = "Немо", ["nofiend"] = "Без Изверга", ["noimmortalsnails"] = "Без улиток", ["nolockers"] = "Без локеров", ["nomantitoil"] = "Без мантитоила", ["nomantitoilslayer"] = "Без мантитоила-палача", ["nopeepers"] = "Без Пиперов", ["noshyguy"] = "Без Шайгая", ["noslayers"] = "Без палачей", ["notoilslayer"] = "Без тойл-палача", ["peepers"] = "Пиперы", ["phonesout"] = "Телефоны наружу", ["playtimebig"] = "Playtime (большой)", ["rollinggiants"] = "Катящиеся великаны", ["roomba"] = "Робот-пылесос", ["scp682"] = "SCP-682", ["scp939"] = "SCP-939", ["seamine"] = "Морская мина", ["shiba"] = "Сиба-ину", ["shockwavedrones"] = "Дроны с ударной волной", ["shrimp"] = "Креветка", ["shyguy"] = "Шайгай", ["sirenhead"] = "Сиреноголовый", ["skullenemy"] = "Череп", ["slenderman"] = "Слендермен", ["solarflare"] = "Солнечная вспышка", ["souldev"] = "Souldev", ["takeygokubracken"] = "Бракен-Гоку", ["thefiend"] = "Изверг", ["toilhead"] = "Тойлхед (койл с турелью)", ["toilslayer"] = "Тойл-палач", ["walkers"] = "Ходоки", ["welcometoooblterra"] = "Добро пожаловать в Ooblterra", ["windy"] = "Ветрено", ["yeetbomb"] = "Бомба-йит" }; public static string ToRu(string raw) { if (string.IsNullOrEmpty(raw)) { return raw; } string text = Norm(raw); if (text.Length == 0) { return raw; } if (Map.TryGetValue(text, out var value)) { return value; } if (_loggedMiss.Add(text)) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[event-ru] нет перевода для ивента \"" + raw + "\" (ключ: " + text + ") — показываю как есть.")); } } return raw; } public static bool IsKnownEvent(string raw) { if (string.IsNullOrEmpty(raw)) { return false; } string text = Norm(raw); if (text.Length >= 3 && Map.ContainsKey(text)) { return true; } string b = raw.Trim(); foreach (KeyValuePair item in Map) { if (string.Equals(item.Value, b, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static string Norm(string s) { StringBuilder stringBuilder = new StringBuilder(s.Length); string text = s.ToLowerInvariant(); foreach (char c in text) { if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] internal static class Patch_GameNetworkManager_Disconnect { private static void Postfix() { OverlayManager.Instance?.NotifyDisconnectedFromGame(); OverlayNet.Reset(); } } [HarmonyPatch(typeof(StartOfRound), "Start")] internal static class Patch_StartOfRound_Start { private static void Postfix() { try { OverlayNet.Register(); MonsterState.Reset(); BcmeClientEvents.Clear(); OverlayManager.Instance?.NotifyEnteredSave(); BridgeTicker.ForceImmediate(); } catch { } } } public static class Localization { private static readonly Dictionary En = new Dictionary { ["location"] = "LOCATION", ["deadline"] = "DEADLINE PROGRESS", ["lootQuota"] = "LOOT / QUOTA", ["onPlanet"] = "ON PLANET", ["day"] = "DAY", ["left"] = "LEFT", ["crew"] = "CREW", ["deaths"] = "DEATHS", ["outside"] = "OUTSIDE", ["inside"] = "INSIDE", ["traps"] = "TRAPS", ["brutalEvent"] = "!! BRUTAL EVENT", ["noData"] = "- no data -", ["offline"] = "OFFLINE", ["hostless"] = "HOST HAS NO OVERLAY MOD - INTEL PANELS OFF", ["bridge"] = "BRIDGE", ["interior"] = "INTERIOR", ["items"] = "ITEMS", ["in"] = "IN", ["out"] = "OUT", ["hives"] = "HIVES", ["oldBird"] = "!! OLD BIRD !!", ["met"] = "MET", ["tMoon"] = "MOON", ["tWx"] = "WX", ["tQuota"] = "QUOTA", ["tEvent"] = "EVENT", ["tObjective"] = "OBJECTIVE: SURVIVE 3 QUOTAS", ["vicStamp"] = "CHALLENGE", ["vicTitle"] = "COMPLETE", ["vicSub"] = "3 QUOTAS DONE - YOU SURVIVED", ["vicTime"] = "TIME", ["vicLoot"] = "LOOT", ["vicDeaths"] = "DEATHS", ["vicQuotas"] = "BY QUOTA", ["vicMoons"] = "MOONS", ["vicMonsters"] = "MOST ENCOUNTERED", ["vicTimeline"] = "DAY BY DAY", ["vicVisits"] = "visits", ["vicNoLosses"] = "no losses", ["vicEvent"] = "event", ["vicDeath"] = "deaths", ["vicSold"] = "SOLD", ["mult"] = "MULT", ["endOfDay"] = "SHIP LEAVES IN", ["lastRun"] = "PREVIOUS RUN" }; private static readonly Dictionary Ru = new Dictionary { ["location"] = "ЛОКАЦИЯ", ["deadline"] = "ПРОГРЕСС КВОТЫ", ["lootQuota"] = "ЛУТ / КВОТА", ["onPlanet"] = "НА ПЛАНЕТЕ", ["day"] = "ДЕНЬ", ["left"] = "ОСТ.", ["crew"] = "ЭКИПАЖ", ["deaths"] = "СМЕРТИ", ["outside"] = "УЛИЦА", ["inside"] = "КОМПЛЕКС", ["traps"] = "ЛОВУШКИ", ["brutalEvent"] = "!! BRUTAL ИВЕНТ", ["noData"] = "— нет данных —", ["offline"] = "НЕТ СВЯЗИ", ["hostless"] = "У ХОСТА НЕТ ЭТОГО МОДА - ПАНЕЛИ ПОДСКАЗОК ВЫКЛЮЧЕНЫ", ["bridge"] = "МОСТ", ["interior"] = "ИНТЕРЬЕР", ["items"] = "ПРЕДМЕТЫ", ["in"] = "ВНУТРИ", ["out"] = "СНАРУЖИ", ["hives"] = "УЛЬИ", ["oldBird"] = "!! OLD BIRD !!", ["met"] = "ЕСТЬ", ["tMoon"] = "ЛУНА", ["tWx"] = "ПОГОДА", ["tQuota"] = "КВОТА", ["tEvent"] = "ИВЕНТ", ["tObjective"] = "ЦЕЛЬ: ПЕРЕЖИТЬ 3 КВОТЫ", ["vicStamp"] = "ИСПЫТАНИЕ", ["vicTitle"] = "ПРОЙДЕНО", ["vicSub"] = "3 КВОТЫ ВЫПОЛНЕНЫ — ТЫ ВЫЖИЛ", ["vicTime"] = "ВРЕМЯ", ["vicLoot"] = "ЛУТ", ["vicDeaths"] = "СМЕРТИ", ["vicQuotas"] = "ПО КВОТАМ", ["vicMoons"] = "ЛУНЫ", ["vicMonsters"] = "КОГО ВСТРЕЧАЛИ ЧАЩЕ", ["vicTimeline"] = "ХРОНИКА ПО ДНЯМ", ["vicVisits"] = "визитов", ["vicNoLosses"] = "без потерь", ["vicEvent"] = "ивент", ["vicDeath"] = "смерти", ["vicSold"] = "ПРОДАНО", ["mult"] = "МНОЖ", ["endOfDay"] = "КОРАБЛЬ УЛЕТИТ ЧЕРЕЗ", ["lastRun"] = "ПРОШЛЫЙ ЗАБЕГ" }; public static string T(string key) { if ((ConfigSettings.RussianActive ? Ru : En).TryGetValue(key, out var value)) { return value; } if (En.TryGetValue(key, out var value2)) { return value2; } return key; } } internal static class OverlayNet { public enum Link { Offline, Waiting, Granted, Denied } public struct HostPolicy { public bool Monsters; public bool Traps; public bool DoorRadar; public bool Apparatus; public bool Events; public bool Countdown; public bool LootMult; public bool LevelScrap; public bool Interior; public bool RequireScan; public bool ResetScans; public float DoorRadius; public static HostPolicy FromLocalConfig() { return new HostPolicy { Monsters = ConfigSettings.ShowMonsters.Value, Traps = ConfigSettings.ShowTraps.Value, DoorRadar = ConfigSettings.DoorRadar.Value, Apparatus = ConfigSettings.ShowApparatusIcon.Value, Events = ConfigSettings.ShowBrutalEvent.Value, Countdown = ConfigSettings.ShowEndOfDayCountdown.Value, LootMult = ConfigSettings.ShowLootMultiplier.Value, LevelScrap = true, Interior = true, RequireScan = ConfigSettings.RequireScanToShow.Value, ResetScans = ConfigSettings.ResetScansEachDay.Value, DoorRadius = ConfigSettings.DoorRadarRadius.Value }; } public static HostPolicy Blocked() { return new HostPolicy { RequireScan = true, ResetScans = false, DoorRadius = 0f }; } public ushort Bits() { ushort num = 0; if (Monsters) { num |= 1; } if (Traps) { num |= 2; } if (DoorRadar) { num |= 4; } if (Apparatus) { num |= 8; } if (Events) { num |= 0x10; } if (Countdown) { num |= 0x20; } if (LootMult) { num |= 0x40; } if (LevelScrap) { num |= 0x80; } if (RequireScan) { num |= 0x100; } if (Interior) { num |= 0x200; } if (ResetScans) { num |= 0x400; } return num; } public static HostPolicy FromBits(ushort b, float radius) { return new HostPolicy { Monsters = ((b & 1) != 0), Traps = ((b & 2) != 0), DoorRadar = ((b & 4) != 0), Apparatus = ((b & 8) != 0), Events = ((b & 0x10) != 0), Countdown = ((b & 0x20) != 0), LootMult = ((b & 0x40) != 0), LevelScrap = ((b & 0x80) != 0), RequireScan = ((b & 0x100) != 0), Interior = ((b & 0x200) != 0), ResetScans = ((b & 0x400) != 0), DoorRadius = radius }; } } [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnHello; public static HandleNamedMessageDelegate <1>__OnPolicy; public static HandleNamedMessageDelegate <2>__OnState; public static HandleNamedMessageDelegate <3>__OnScan; } private const string HelloMsg = "LCBridgeOverlay_hello"; private const string PolicyMsg = "LCBridgeOverlay_policy"; private const string StateMsg = "LCBridgeOverlay_state"; private const string ScanMsg = "LCBridgeOverlay_scan"; private const byte Wire = 2; private const float WaitSeconds = 8f; private const float RetrySeconds = 10f; private static HostPolicy _policy = HostPolicy.Blocked(); private static bool _registered; private static float _askedAt; private static ushort _lastSentBits; private static float _lastSentRadius; private static bool _everSent; private static float _hostTimerSec; private static bool _hostTimerRunning; private static float _hostTimerAt; private static int _hostResetToken; private static string _hostEvents; private static int _hostDeaths; private static float _hostStateAt = -999f; private static NetworkManager _registeredOn; public static Link State { get; private set; } = Link.Offline; public static HostPolicy Policy { get { if (State != Link.Granted) { return HostPolicy.Blocked(); } return _policy; } } public static bool HasHostState { get { if (State == Link.Granted && (Object)(object)NM != (Object)null && !NM.IsServer) { return Time.unscaledTime - _hostStateAt < 15f; } return false; } } public static float HostTimerSec => _hostTimerSec + (_hostTimerRunning ? (Time.unscaledTime - _hostTimerAt) : 0f); public static bool HostTimerRunning => _hostTimerRunning; public static int HostResetToken => _hostResetToken; public static string HostEvents => _hostEvents; public static int HostDeaths => _hostDeaths; private static NetworkManager NM => NetworkManager.Singleton; public static void Register() { //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_005c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown try { NetworkManager nM = NM; if (!((Object)(object)nM == (Object)null) && nM.CustomMessagingManager != null && (!_registered || _registeredOn != nM)) { _registeredOn = nM; CustomMessagingManager customMessagingManager = nM.CustomMessagingManager; object obj = <>O.<0>__OnHello; if (obj == null) { HandleNamedMessageDelegate val = OnHello; <>O.<0>__OnHello = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("LCBridgeOverlay_hello", (HandleNamedMessageDelegate)obj); CustomMessagingManager customMessagingManager2 = nM.CustomMessagingManager; object obj2 = <>O.<1>__OnPolicy; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnPolicy; <>O.<1>__OnPolicy = val2; obj2 = (object)val2; } customMessagingManager2.RegisterNamedMessageHandler("LCBridgeOverlay_policy", (HandleNamedMessageDelegate)obj2); CustomMessagingManager customMessagingManager3 = nM.CustomMessagingManager; object obj3 = <>O.<2>__OnState; if (obj3 == null) { HandleNamedMessageDelegate val3 = OnState; <>O.<2>__OnState = val3; obj3 = (object)val3; } customMessagingManager3.RegisterNamedMessageHandler("LCBridgeOverlay_state", (HandleNamedMessageDelegate)obj3); CustomMessagingManager customMessagingManager4 = nM.CustomMessagingManager; object obj4 = <>O.<3>__OnScan; if (obj4 == null) { HandleNamedMessageDelegate val4 = OnScan; <>O.<3>__OnScan = val4; obj4 = (object)val4; } customMessagingManager4.RegisterNamedMessageHandler("LCBridgeOverlay_scan", (HandleNamedMessageDelegate)obj4); _registered = true; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[net] регистрация не удалась: " + ex.Message)); } } } public static void OnLocalPlayerReady() { try { Register(); NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || !nM.IsListening) { State = Link.Offline; } else if (nM.IsServer) { _policy = HostPolicy.FromLocalConfig(); State = Link.Granted; _everSent = false; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[net] мы хост — панели разрешает наш конфиг, он же уедет клиентам."); } } else { State = Link.Waiting; _askedAt = Time.unscaledTime; SendHello(); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[net] спросили хоста про мод; ждём ответ."); } } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogWarning((object)("[net] OnLocalPlayerReady: " + ex.Message)); } } } public static void Tick() { try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || !nM.IsListening) { return; } if (nM.IsServer) { _policy = HostPolicy.FromLocalConfig(); State = Link.Granted; ushort num = _policy.Bits(); if (!_everSent || num != _lastSentBits || !Mathf.Approximately(_policy.DoorRadius, _lastSentRadius)) { BroadcastPolicy(); } BroadcastState(); ScanRegistry.TakePending(); if (ScanRegistry.Dirty) { ScanRegistry.Dirty = false; BroadcastScans(); } return; } if (State == Link.Waiting && Time.unscaledTime - _askedAt > 8f) { State = Link.Denied; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[net] хост не ответил — мода у него нет. Панели с подсказками выключены: клиентское преимущество в этом сообществе запрещено."); } } if (State == Link.Granted) { ulong[] array = ScanRegistry.TakePending(); if (array != null) { SendScans(array, 0uL); } } if (State != Link.Granted && Time.unscaledTime - _askedAt > 10f) { _askedAt = Time.unscaledTime; SendHello(); } else if (State == Link.Granted && Time.unscaledTime - _hostStateAt > 15f) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)"[net] хост замолчал — спрашиваем заново."); } State = Link.Waiting; _askedAt = Time.unscaledTime; SendHello(); } } catch { } } public static void Reset() { State = Link.Offline; _policy = HostPolicy.Blocked(); _registered = false; _registeredOn = null; _everSent = false; _hostStateAt = -999f; _hostEvents = null; _hostTimerSec = 0f; _hostTimerRunning = false; } private unsafe static void SendHello() { //IL_002b: 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_0044: Unknown result type (might be due to invalid IL or missing references) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.CustomMessagingManager == null) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(2, (Allocator)2, -1); try { byte b = 2; ((FastBufferWriter)(ref val)).WriteValueSafe(ref b, default(ForPrimitives)); nM.CustomMessagingManager.SendNamedMessage("LCBridgeOverlay_hello", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[net] приветствие не ушло: " + ex.Message)); } } } private static void OnHello(ulong sender, FastBufferReader reader) { //IL_002e: 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) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || !nM.IsServer) { return; } byte b = 0; if (((FastBufferReader)(ref reader)).TryBeginRead(1)) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref b, default(ForPrimitives)); } if (b != 2) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[net] у клиента {sender} другая версия мода (протокол {b}, у нас {(byte)2})."); } return; } _policy = HostPolicy.FromLocalConfig(); SendPolicyTo(sender); SendScans(ScanRegistry.Snapshot(), sender); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)$"[net] клиенту {sender} отправлена политика хоста."); } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogWarning((object)("[net] OnHello: " + ex.Message)); } } } private static void OnPolicy(ulong sender, FastBufferReader reader) { //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) //IL_0055: 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_0068: 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) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.IsServer || sender != 0L || !((FastBufferReader)(ref reader)).TryBeginRead(7)) { return; } byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref b, default(ForPrimitives)); if (b == 2) { ushort b2 = default(ushort); ((FastBufferReader)(ref reader)).ReadValueSafe(ref b2, default(ForPrimitives)); float radius = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref radius, default(ForPrimitives)); _policy = HostPolicy.FromBits(b2, radius); State = Link.Granted; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)($"[net] хост с модом: монстры={_policy.Monsters}, ловушки={_policy.Traps}, " + $"радар={_policy.DoorRadar}, аппарат={_policy.Apparatus}, только-сканы={_policy.RequireScan}.")); } BridgeTicker.ForceImmediate(); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[net] OnPolicy: " + ex.Message)); } } } private unsafe static void SendPolicyTo(ulong clientId) { //IL_0036: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0086: Unknown result type (might be due to invalid IL or missing references) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.CustomMessagingManager == null || !nM.IsServer) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(7, (Allocator)2, -1); try { byte b = 2; ((FastBufferWriter)(ref val)).WriteValueSafe(ref b, default(ForPrimitives)); ushort num = _policy.Bits(); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref _policy.DoorRadius, default(ForPrimitives)); nM.CustomMessagingManager.SendNamedMessage("LCBridgeOverlay_policy", clientId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)$"[net] политика не ушла клиенту {clientId}: {ex.Message}"); } } } private unsafe static void SendScans(ulong[] ids, ulong target) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00ac: Unknown result type (might be due to invalid IL or missing references) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.CustomMessagingManager == null || ids == null || ids.Length == 0 || ids.Length > 400) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(4 + ids.Length * 8, (Allocator)2, 8192); try { byte b = 2; ((FastBufferWriter)(ref val)).WriteValueSafe(ref b, default(ForPrimitives)); int num = ids.Length; ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); for (num = 0; num < ids.Length; num++) { ulong num2 = ids[num]; ((FastBufferWriter)(ref val)).WriteValueSafe(ref num2, default(ForPrimitives)); } nM.CustomMessagingManager.SendNamedMessage("LCBridgeOverlay_scan", target, val, (NetworkDelivery)4); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[net] сканы не ушли: " + ex.Message)); } } } private static void BroadcastScans() { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || !nM.IsServer || nM.ConnectedClientsIds == null) { return; } ulong[] array = ScanRegistry.Snapshot(); if (array.Length == 0) { return; } foreach (ulong connectedClientsId in nM.ConnectedClientsIds) { if (connectedClientsId != 0L) { SendScans(array, connectedClientsId); } } } private static void OnScan(ulong sender, FastBufferReader reader) { //IL_001a: 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_0036: 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_006c: 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) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null) { return; } byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref b, default(ForPrimitives)); if (b != 2) { return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref num, default(ForPrimitives)); if (num < 0 || num > 400) { return; } ulong[] array = new ulong[num]; for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref array[i], default(ForPrimitives)); } if (nM.IsServer) { int count = ScanRegistry.Count; ScanRegistry.Merge(array); if (ScanRegistry.Count != count) { ScanRegistry.Dirty = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[scan] игрок {sender} поделился сканами (+{ScanRegistry.Count - count})."); } } } else if (sender == 0L) { ScanRegistry.Merge(array); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("[net] OnScan: " + ex.Message)); } } } private unsafe static void BroadcastState() { //IL_00c1: 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_00d4: 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_00e7: 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_00fa: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.CustomMessagingManager == null || !nM.IsServer || nM.ConnectedClientsIds == null || nM.ConnectedClientsIds.Count <= 1) { return; } float num = 0f; bool flag = false; OverlayManager instance = OverlayManager.Instance; if ((Object)(object)instance != (Object)null) { num = instance.TimerSeconds; flag = instance.TimerRunning; } int deaths = GameState.GetDeaths(); string text = GameState.GetBrutalEvent() ?? ""; if (text.Length > 900) { text = text.Substring(0, 900); } byte b = (flag ? ((byte)1) : ((byte)0)); int resetToken = GameState.GetResetToken(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(1024, (Allocator)2, 4096); try { byte b2 = 2; ((FastBufferWriter)(ref val)).WriteValueSafe(ref b2, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref b, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref resetToken, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref deaths, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(text, false); foreach (ulong connectedClientsId in nM.ConnectedClientsIds) { if (connectedClientsId != 0L) { nM.CustomMessagingManager.SendNamedMessage("LCBridgeOverlay_state", connectedClientsId, val, (NetworkDelivery)3); } } } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[net] состояние не ушло: " + ex.Message)); } } } private static void OnState(ulong sender, FastBufferReader reader) { //IL_002a: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006c: 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_007f: 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) try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.IsServer || sender != 0L) { return; } byte b = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref b, default(ForPrimitives)); if (b == 2) { byte b2 = default(byte); ((FastBufferReader)(ref reader)).ReadValueSafe(ref b2, default(ForPrimitives)); float hostTimerSec = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hostTimerSec, default(ForPrimitives)); int hostResetToken = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hostResetToken, default(ForPrimitives)); int hostDeaths = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe(ref hostDeaths, default(ForPrimitives)); string text = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); _hostTimerRunning = (b2 & 1) != 0; _hostTimerSec = hostTimerSec; _hostTimerAt = Time.unscaledTime; _hostResetToken = hostResetToken; _hostDeaths = hostDeaths; _hostEvents = (string.IsNullOrEmpty(text) ? null : text); _hostStateAt = Time.unscaledTime; if (State != Link.Granted) { State = Link.Granted; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)("[net] OnState: " + ex.Message)); } } } private static void BroadcastPolicy() { try { NetworkManager nM = NM; if ((Object)(object)nM == (Object)null || nM.CustomMessagingManager == null || !nM.IsServer) { return; } _lastSentBits = _policy.Bits(); _lastSentRadius = _policy.DoorRadius; _everSent = true; foreach (ulong connectedClientsId in nM.ConnectedClientsIds) { if (connectedClientsId != 0L) { SendPolicyTo(connectedClientsId); } } } catch { } } } internal static class Gate { private static OverlayNet.HostPolicy P => OverlayNet.Policy; public static bool Monsters { get { if (ConfigSettings.ShowMonsters.Value) { return P.Monsters; } return false; } } public static bool Traps { get { if (ConfigSettings.ShowTraps.Value) { return P.Traps; } return false; } } public static bool DoorRadar { get { if (ConfigSettings.DoorRadar.Value) { return P.DoorRadar; } return false; } } public static bool Apparatus { get { if (ConfigSettings.ShowApparatusIcon.Value) { return P.Apparatus; } return false; } } public static bool Events { get { if (ConfigSettings.ShowBrutalEvent.Value) { return P.Events; } return false; } } public static bool Countdown { get { if (ConfigSettings.ShowEndOfDayCountdown.Value) { return P.Countdown; } return false; } } public static bool LootMult { get { if (ConfigSettings.ShowLootMultiplier.Value) { return P.LootMult; } return false; } } public static bool LevelLoot => P.LevelScrap; public static bool LevelScrap => P.LevelScrap; public static bool Interior => P.Interior; public static float DoorRadius => Mathf.Min(ConfigSettings.DoorRadarRadius.Value, P.DoorRadius); public static bool RequireScan { get { if (!ConfigSettings.RequireScanToShow.Value) { return P.RequireScan; } return true; } } public static bool ResetScansDaily { get { if (OverlayNet.State != OverlayNet.Link.Granted) { return ConfigSettings.ResetScansEachDay.Value; } return P.ResetScans; } } public static bool Restricted => OverlayNet.State != OverlayNet.Link.Granted; } public class OverlayManager : MonoBehaviour { private class EodDigit { public GameObject Go; public RectTransform Rt; public TextMeshProUGUI Text; public float Life; } private const float PanelWidth = 340f; private const float SlideTime = 0.3f; private const float RailReserve = 92f; private const float TiltDeg = 1f; private Canvas _canvas; private bool _dirty; private OverlayStyle S; private RectTransform _root; private CanvasGroup _group; private Image _bgImage; private readonly List _frameImages = new List(); private readonly List _pixbits = new List(); private readonly List _allTexts = new List(); private readonly List _bigTexts = new List(); private TMP_FontAsset _fontBody; private TMP_FontAsset _fontBig; private TMP_FontAsset _dynFont; private bool _fontsResolved; private float _fontRetryT; private static readonly Dictionary _osFontCache = new Dictionary(); private GameObject _headerGo; private GameObject _headerDivider; private GameObject _locationGo; private GameObject _quotaGo; private GameObject _dayDeathsGo; private GameObject _tickerGo; private TextMeshProUGUI _timerText; private EyeWidget _topEye; private TextMeshProUGUI _moonText; private TextMeshProUGUI _interiorText; private TextMeshProUGUI _itemsText; private TextMeshProUGUI _oldBirdText; private Image _lampImg; private GameObject _lampSlot; private TextMeshProUGUI _multText; private GameObject _endOfDayGo; private readonly Image[] _qtabBgs = (Image[])(object)new Image[3]; private readonly TextMeshProUGUI[] _qtabTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3]; private TextMeshProUGUI _lootQuotaText; private TextMeshProUGUI _barText; private GameObject _onPlanetGo; private TextMeshProUGUI _onPlanetVal; private RectTransform _barFill; private Image _barFillImg; private TextMeshProUGUI _dayText; private TextMeshProUGUI _deathsText; private MobRailWidget _mobRail; private TrapFireEffect _trapFire; private EventPlateWidget _eventPlate; private RectTransform _eventPlateRt; private RectTransform _trapRailRt; private RectTransform _trapFxRt; private TextMeshProUGUI _eventText; private TickerWidget _ticker; private VictoryWidget _victory; private bool _userHidden; private float _vis; private Quaternion _lastCamRot = Quaternion.identity; private float _idleT; private float _idleAlpha = 1f; private const float IdleFadeTime = 0.8f; private float _swayRoll; private Vector2 _swayPos; private Vector3 _lastCamFwd = Vector3.forward; private const float SwayRollFactor = 0.45f; private const float SwayMaxRoll = 5f; private const float SwayDriftMax = 10f; private const float SwayRotSpeed = 9f; private const float SwayPosSpeed = 7f; private float _timerSec; private bool _timerRunning; private bool? _prevWantRun; private int? _prevResetToken; private int? _lastQuotaIndex; private List _events = new List(); private bool _loggedFirstPacket; private bool _loggedParseFail; private bool? _loggedOnShip; private static readonly string[] TurretEventKeys = new string[11] { "turret", "турел", "berserk", "mobile", "everywhere", "toilhead", "toil", "hell", "quad", "artillery", "артилл" }; private const float PauseDimAlpha = 0.06f; private float _pauseFade; private bool _adBlocked; private bool _showingLastRun; private GameObject _marksGo; private int _marksShown = -1; private const int MarksPerRow = 5; private const int MarksMax = 100; private const float MarkW = 22f; private const float MarkH = 6f; private static readonly string[] MarkCycle = new string[5] { "FF5141", "FFB000", "36D1FF", "9B6BFF", "3BE07A" }; private float _eodEndTime = -1f; private int _eodLastShown = -1; private static StartMatchLever _lever; private bool _takingOff; private static readonly (string key, string hex)[] WxColors = new(string, string)[6] { ("eclips", "#FF3A2E"), ("storm", "#FFCF3A"), ("rain", "#5FB6E6"), ("flood", "#3FA9C9"), ("fog", "#C8C2B0"), ("dust", "#D9A05A") }; private float _lastPanelH = -1f; private static Texture2D _scanTex; private static Sprite _grunge; private const int EodPoolSize = 4; private const float EodFlyTime = 3f; private readonly List _eodPool = new List(); public static OverlayManager Instance { get; private set; } internal OverlayStyle Style => S; public float TimerSeconds => _timerSec; public bool TimerRunning => _timerRunning; private void Awake() { Instance = this; S = (ConfigSettings.LegacyStyleActive ? OverlayStyle.Legacy() : OverlayStyle.Game()); BuildUi(); if (DataParser.Current != null) { OnPayload(DataParser.Current); } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) string text = DataParser.TakeLocal(); if (text != null) { if (DataParser.TryParse(text)) { if (!_loggedFirstPacket) { _loggedFirstPacket = true; BridgePayload current = DataParser.Current; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"Первый пакет моста разобран: moon={current.moonName}, onShip={current.onShip}, inGame={current.inGame}, quota={current.shipLoot}/{current.quotaValue}"); } } OnPayload(DataParser.Current); } else if (!_loggedParseFail) { _loggedParseFail = true; ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)("Не удалось разобрать пакет моста (начало): " + text.Substring(0, Math.Min(300, text.Length)))); } } } HandleInput(); if (OverlayNet.HasHostState) { _timerSec = OverlayNet.HostTimerSec; _timerRunning = OverlayNet.HostTimerRunning; } else if (_timerRunning) { _timerSec += Time.unscaledDeltaTime; } if (!_fontsResolved) { _fontRetryT += Time.unscaledDeltaTime; if (_fontRetryT >= 1f) { _fontRetryT = 0f; EnsureFonts(); if (_fontsResolved) { _dirty = true; } } } UpdateVisibility(Time.unscaledDeltaTime); UpdateEndOfDay(); PositionTrapRail(); if (((Component)_root).gameObject.activeSelf && ConfigSettings.ShowTimer.Value) { ((TMP_Text)_timerText).text = FmtTimeMs(_timerSec); ((Graphic)_timerText).color = (Color)(_timerRunning ? Color.white : new Color(1f, 1f, 1f, 0.6f)); } if (_dirty) { _dirty = false; EnsureFonts(); Refresh(); } RewarpOnResize(); } public void NotifyEnteredSave() { _timerSec = 0f; _timerRunning = false; _prevWantRun = null; _lastQuotaIndex = null; _prevResetToken = null; _marksShown = -1; _showingLastRun = false; _userHidden = false; _victory?.Hide(); _dirty = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"Вход в сейв — состояние оверлея сброшено."); } } public void FlashMonster(string rawName, bool outside) { try { _mobRail?.FlashMonster(rawName, outside); } catch { } } public void HideAnalytics() { _showingLastRun = false; _victory?.Hide(); _dirty = true; } public void NotifyDisconnectedFromGame() { DataParser.Clear(); _timerRunning = false; _prevWantRun = null; _victory?.Hide(); _dirty = true; } private void OnPayload(BridgePayload p) { _dirty = true; if (_loggedOnShip != p.onShip) { _loggedOnShip = p.onShip; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)string.Format("onShip={0} → панель {1} (AlwaysVisible={2})", p.onShip, p.onShip ? "разрешена" : "будет скрыта", ConfigSettings.AlwaysVisible.Value)); } } if (_prevResetToken.HasValue && p.resetToken != _prevResetToken) { _timerSec = 0f; _timerRunning = false; _prevWantRun = null; _lastQuotaIndex = null; _marksShown = -1; _victory?.Hide(); } _prevResetToken = p.resetToken; if (ConfigSettings.ShowVictoryBanner.Value) { if (RunSnapshot.ShowLastRun && !_showingLastRun) { _showingLastRun = true; _victory?.Show(p, (int)_timerSec); } else if (!RunSnapshot.ShowLastRun && _showingLastRun) { _showingLastRun = false; _victory?.Hide(); } } if (ConfigSettings.AutoTimer.Value) { bool flag = p.onMoon && !p.loading; if (flag != _prevWantRun) { if (!OverlayNet.HasHostState) { _timerRunning = flag; } _prevWantRun = flag; } if (!p.onMoon && !OverlayNet.HasHostState) { _timerRunning = false; } } _events = (Gate.Events ? BcmerEvents.GetEvents() : new List()); if (_events.Count == 0 && !string.IsNullOrEmpty(p.brutalEvent)) { string[] array = p.brutalEvent.Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length != 0) { if (ConfigSettings.RussianActive) { text = EventTranslate.ToRu(text); } _events.Add(new BcmerEvents.EventInfo { Name = text, ColorHex = "#FFFFFF" }); } } } int num = Mathf.Max(1, p.quotaIndex); if (_lastQuotaIndex.HasValue && num > _lastQuotaIndex && ConfigSettings.ShowVictoryBanner.Value) { int num2 = (num - 1) / 3; int num3 = (_lastQuotaIndex.Value - 1) / 3; if (num2 > num3 && num2 >= 1) { _victory.Show(p, (int)_timerSec); } } _lastQuotaIndex = num; } private void HandleInput() { //IL_0008: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (IsTypingChat()) { return; } if (KeyPressed(ConfigSettings.ToggleKeyParsed)) { if (_adBlocked) { return; } bool flag = DataParser.Current?.onShip ?? false; if (ConfigSettings.AlwaysVisible.Value || flag) { _userHidden = !_userHidden; } } if (KeyPressed(ConfigSettings.TimerPauseKeyParsed)) { _timerRunning = !_timerRunning; } if (KeyPressed(ConfigSettings.TimerResetKeyParsed)) { _timerSec = 0f; } } private static bool IsTypingChat() { try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; return (Object)(object)val != (Object)null && val.isTypingChat; } catch { return false; } } private static bool KeyPressed(Key k) { //IL_0000: 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) if ((int)k == 0) { return false; } Keyboard current = Keyboard.current; if (current == null) { return false; } try { return ((ButtonControl)current[k]).wasPressedThisFrame; } catch { return false; } } private void RebuildQuotaMarks(int triples) { //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) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_marksGo == (Object)null) { return; } triples = Mathf.Clamp(triples, 0, 100); if (triples == _marksShown) { return; } _marksShown = triples; _marksGo.SetActive(triples > 0); if (triples <= 0) { for (int num = _marksGo.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)_marksGo.transform.GetChild(num)).gameObject); } return; } int num2 = (triples - 1) / 5; int num3 = triples - num2 * 5; Color color = OverlayStyle.FromHex(MarkCycle[num2 % MarkCycle.Length]); Color val = OverlayStyle.WithA(S.Frame, 0.18f); if (_marksGo.transform.childCount == 0) { GameObject val2 = Row(_marksGo.transform, 4f); HorizontalLayoutGroup component = val2.GetComponent(); ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false; ((LayoutGroup)component).childAlignment = (TextAnchor)4; for (int i = 0; i < 5; i++) { GameObject val3 = NewUI("Mark", val2.transform); AddImage(val3, val); LayoutElement obj = val3.AddComponent(); obj.preferredWidth = 22f; obj.minWidth = 22f; obj.preferredHeight = 6f; obj.minHeight = 6f; AddPerspective((Graphic)(object)val3.GetComponent(), continuous: false); } } Transform child = _marksGo.transform.GetChild(0); for (int j = 0; j < child.childCount && j < 5; j++) { Image component2 = ((Component)child.GetChild(j)).GetComponent(); if (!((Object)(object)component2 == (Object)null)) { if (j < num3) { ((Graphic)component2).color = color; } else if (num2 > 0) { ((Graphic)component2).color = OverlayStyle.WithA(OverlayStyle.FromHex(MarkCycle[(num2 - 1) % MarkCycle.Length]), 0.45f); } else { ((Graphic)component2).color = val; } } } } private void UpdateVisibility(float dt) { //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) BridgePayload current = DataParser.Current; bool flag = DataParser.Current != null && Time.unscaledTime - DataParser.Heartbeat < 5f; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; try { GameNetworkManager instance = GameNetworkManager.Instance; PlayerControllerB val = (((Object)(object)instance != (Object)null) ? instance.localPlayerController : null); flag2 = (Object)(object)val != (Object)null; flag4 = (Object)(object)val != (Object)null && val.isPlayerDead; if ((Object)(object)val != (Object)null && (Object)(object)val.quickMenuManager != (Object)null) { flag3 = val.quickMenuManager.isMenuOpen; } flag5 = ShipLeavingNow(); } catch { } if ((Object)(object)_canvas != (Object)null) { _canvas.sortingOrder = (flag3 ? (-1000) : 500); } UpdateIdleFade(dt); bool flag6 = ConfigSettings.HideOnPopups.Value && current != null && current.popupActive; _adBlocked = ConfigSettings.HideOnStoreAd.Value && current != null && current.storeAdActive; bool flag7 = ConfigSettings.Enabled.Value && flag2 && !flag5 && !flag6 && !_adBlocked && (ConfigSettings.AlwaysVisible.Value || (flag && (flag4 || (current != null && current.onShip)))) && !_userHidden; _topEye?.SetOpen(flag7 ? 1f : 0f); _vis = Mathf.Clamp01(_vis + (flag7 ? 1f : (-1f)) * (dt / 0.3f)); float num = EaseOutCubic(_vis); float num2 = 340f * ConfigSettings.Scale.Value + 200f; float num3 = 0f - Mathf.Max((float)ConfigSettings.RightOffsetPx.Value, 92f); UpdateCameraSway(dt, num); _root.anchoredPosition = new Vector2(Mathf.Lerp(num2, num3, num), 0f) + _swayPos; _pauseFade = Mathf.MoveTowards(_pauseFade, flag3 ? 1f : 0f, dt / 0.2f); float num4 = Mathf.Lerp(1f, 0.06f, _pauseFade); _group.alpha = num * _idleAlpha * num4; bool flag8 = _vis > 0.001f; if (((Component)_root).gameObject.activeSelf != flag8) { ((Component)_root).gameObject.SetActive(flag8); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)(flag8 ? "Оверлей появляется." : "Оверлей скрыт.")); } if (flag8) { _dirty = true; } } } private static float EaseOutCubic(float t) { return 1f - Mathf.Pow(1f - t, 3f); } private void UpdateEndOfDay() { //IL_01b3: 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_01db: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_endOfDayGo == (Object)null) { return; } BridgePayload current = DataParser.Current; float unscaledTime = Time.unscaledTime; if (Gate.Countdown && current != null && current.onMoon && current.endOfDaySec >= 0) { float num = unscaledTime + (float)current.endOfDaySec; if (_eodEndTime < 0f || Mathf.Abs(num - _eodEndTime) > 2.5f) { _eodEndTime = num; _eodLastShown = -1; } } else { _eodEndTime = -1f; _eodLastShown = -1; } float num2 = ((_eodEndTime >= 0f) ? (_eodEndTime - unscaledTime) : (-1f)); int num3 = ((num2 >= 0f) ? Mathf.CeilToInt(num2) : (-1)); if (num3 >= 1 && num3 <= 10 && num3 != _eodLastShown) { _eodLastShown = num3; if (!_endOfDayGo.activeSelf) { _endOfDayGo.SetActive(true); } SpawnEodDigit(num3); } bool flag = false; float unscaledDeltaTime = Time.unscaledDeltaTime; foreach (EodDigit item in _eodPool) { if (!(item.Life < 0f)) { item.Life += unscaledDeltaTime / 3f; if (item.Life >= 1f) { item.Life = -1f; item.Go.SetActive(false); continue; } flag = true; float life = item.Life; float num4 = Mathf.Lerp(0.5f, 2.4f, life); float a = Mathf.Clamp01(1f - Mathf.Pow(life, 1.5f)); ((Transform)item.Rt).localScale = new Vector3(num4, num4, 1f); Color color = ((Graphic)item.Text).color; color.a = a; ((Graphic)item.Text).color = color; } } if (!flag && _endOfDayGo.activeSelf && (num3 < 1 || num3 > 10)) { _endOfDayGo.SetActive(false); } } private bool ShipLeavingNow() { try { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { _takingOff = false; return false; } if (instance.shipIsLeaving) { _takingOff = true; } if (instance.shipHasLanded || instance.travellingToNewLevel) { _takingOff = false; } if (!_takingOff) { return false; } if ((Object)(object)_lever == (Object)null) { _lever = Object.FindObjectOfType(); } if ((Object)(object)_lever != (Object)null && (Object)(object)_lever.triggerScript != (Object)null && _lever.triggerScript.interactable) { _takingOff = false; return false; } return true; } catch { return false; } } private void UpdateIdleFade(float dt) { //IL_006e: 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_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) if (!ConfigSettings.FadeWhenIdle.Value) { _idleAlpha = 1f; return; } float num = 999f; try { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; Camera val2 = (((Object)(object)val != (Object)null) ? val.gameplayCamera : null); if ((Object)(object)val2 == (Object)null && (Object)(object)Camera.main != (Object)null) { val2 = Camera.main; } if ((Object)(object)val2 != (Object)null) { num = Quaternion.Angle(((Component)val2).transform.rotation, _lastCamRot); _lastCamRot = ((Component)val2).transform.rotation; } } catch { } if (num > 0.4f) { _idleT = 0f; } else { _idleT += dt; } float num2 = ((_idleT > ConfigSettings.IdleFadeSeconds.Value) ? Mathf.Clamp01(ConfigSettings.IdleMinOpacity.Value) : 1f); _idleAlpha = Mathf.MoveTowards(_idleAlpha, num2, dt / 0.8f); } private void UpdateCameraSway(float dt, float e) { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01d3: 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_00b0: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_010a: 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_0112: 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_0119: 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_012e: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0155: 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_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) float num = (ConfigSettings.CameraSway.Value ? Mathf.Clamp(ConfigSettings.CameraSwayStrength.Value, 0f, 2f) : 0f); float num2 = 0f; Vector2 val = Vector2.zero; if (num > 0f && e > 0.001f) { try { PlayerControllerB val2 = GameNetworkManager.Instance?.localPlayerController; Camera val3 = (((Object)(object)val2 != (Object)null) ? val2.gameplayCamera : null); if ((Object)(object)val3 == (Object)null && (Object)(object)Camera.main != (Object)null) { val3 = Camera.main; } if ((Object)(object)val3 != (Object)null) { Transform transform = ((Component)val3).transform; Vector3 forward = transform.forward; Vector3 val4 = Vector3.up - forward * Vector3.Dot(Vector3.up, forward); if (((Vector3)(ref val4)).sqrMagnitude > 0.0001f) { num2 = Mathf.Clamp(Vector3.SignedAngle(((Vector3)(ref val4)).normalized, transform.up, forward) * 0.45f, -5f, 5f); } Vector3 val5 = forward - _lastCamFwd; val = Vector2.ClampMagnitude(new Vector2((0f - Vector3.Dot(val5, transform.right)) * 900f, Vector3.Dot(val5, transform.up) * 900f), 10f); _lastCamFwd = forward; } } catch { } num2 *= num * e; val *= num * e; } _swayRoll = Mathf.Lerp(_swayRoll, num2, 1f - Mathf.Exp(-9f * dt)); _swayPos = Vector2.Lerp(_swayPos, val, 1f - Mathf.Exp(-7f * dt)); ((Transform)_root).localRotation = Quaternion.Euler(0f, 0f, 1f + _swayRoll); } private void Refresh() { //IL_01bb: 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) //IL_0205: 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_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0498: 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_058a: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: 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_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) if (!((Component)_root).gameObject.activeSelf) { return; } BridgePayload current = DataParser.Current; bool flag = DataParser.Current != null && Time.unscaledTime - DataParser.Heartbeat < 5f; bool flag2 = current?.onMoon ?? false; bool value = ConfigSettings.ShowPanel.Value; ((Behaviour)_bgImage).enabled = value; foreach (Image frameImage in _frameImages) { if ((Object)(object)frameImage != (Object)null) { ((Behaviour)frameImage).enabled = value; } } foreach (PixbitFlicker pixbit in _pixbits) { if ((Object)(object)pixbit != (Object)null) { pixbit.Master = value; } } ((Component)_topEye).gameObject.SetActive(value); _headerGo.SetActive(value || ConfigSettings.ShowTimer.Value); _headerDivider.SetActive(value); ((Component)((TMP_Text)_timerText).transform.parent).gameObject.SetActive(ConfigSettings.ShowTimer.Value); _locationGo.SetActive(ConfigSettings.ShowLocation.Value); _quotaGo.SetActive(ConfigSettings.ShowQuota.Value); _dayDeathsGo.SetActive(ConfigSettings.ShowDayDeaths.Value); if (!ConfigSettings.ShowVictoryBanner.Value) { _victory.Hide(); } ((Graphic)_topEye.Img).color = (Color)(flag ? Color.white : new Color(0.5f, 0.5f, 0.5f, 1f)); ((TMP_Text)_timerText).text = FmtTime((int)_timerSec); ((Graphic)_timerText).color = (Color)(_timerRunning ? Color.white : new Color(1f, 1f, 1f, 0.6f)); string text = ((current == null || string.IsNullOrEmpty(current.moonName)) ? "- -" : current.moonName); string text2 = ((current != null) ? ColorizeWeather(current.weatherFull) : ""); ((TMP_Text)_moonText).text = ((text2.Length > 0) ? (Esc(text.ToUpperInvariant()) + " // " + text2) : Esc(text.ToUpperInvariant())); bool flag3 = flag2 && Gate.Interior && !string.IsNullOrEmpty(current.interiorType); ((Component)_interiorText).gameObject.SetActive(flag3); if (flag3) { ((TMP_Text)_interiorText).text = Localization.T("interior") + ": " + Esc(current.interiorType.ToUpperInvariant()) + ""; } ((Component)_itemsText).gameObject.SetActive(flag2 && Gate.LevelLoot); if (flag2 && Gate.LevelLoot) { ((TMP_Text)_itemsText).text = string.Format("{0}: {1} {2} / ", Localization.T("items"), Localization.T("in"), current.itemsInside) + string.Format("{0} {1} / ", Localization.T("out"), current.itemsOutside) + string.Format("{0} {1}", Localization.T("hives"), current.beehiveCount); } ((Component)_oldBirdText).gameObject.SetActive(flag2 && current.hasOldBird && !Gate.RequireScan); if ((Object)(object)_lampSlot != (Object)null) { _lampSlot.SetActive(Gate.Apparatus && flag3 && current.apparatusInside && (Object)(object)_lampImg != (Object)null && (Object)(object)_lampImg.sprite != (Object)null); } if ((Object)(object)_multText != (Object)null) { bool flag4 = Gate.LootMult && flag2; ((Component)_multText).gameObject.SetActive(flag4); if (flag4) { float num = ((current.lootMultiplier > 0f) ? current.lootMultiplier : 1f); Color color = ((Mathf.Abs(num - 1f) > 0.01f) ? OverlayStyle.FromHex("FFB000") : S.TextDim); ((Graphic)_multText).color = color; ((TMP_Text)_multText).text = string.Format("{0} x{1:0.##}", Localization.T("mult"), num); } } int num2 = ((current == null) ? 1 : Mathf.Max(1, current.quotaIndex)); int num3 = (num2 - 1) / 3; int num4 = num3 * 3; int num5 = num2 - num4; for (int i = 0; i < 3; i++) { bool flag5 = i < num5 - 1; bool flag6 = !flag5 && i == num5 - 1; ((Graphic)_qtabBgs[i]).color = (Color)(flag5 ? S.Frame : (flag6 ? OverlayStyle.WithA(S.Frame, S.LegacyCorners ? 0.1f : 0.22f) : new Color(1f, 1f, 1f, S.LegacyCorners ? 0f : 0.06f))); ((Graphic)_qtabTexts[i]).color = ((!flag5) ? (flag6 ? S.Accent : S.TextDim) : (S.LegacyCorners ? Color.white : Color.black)); string text3 = "Q" + (num4 + i + 1); if (((TMP_Text)_qtabTexts[i]).text != text3) { ((TMP_Text)_qtabTexts[i]).text = text3; } } RebuildQuotaMarks(num3); int num6 = ((current != null) ? Mathf.Max(0, current.quotaValue) : 0); int num7 = ((current != null) ? Mathf.Max(0, current.shipLoot) : 0); ((TMP_Text)_lootQuotaText).text = $"{num7}/{num6}"; float num8 = ((num6 > 0) ? ((float)num7 / (float)num6) : 0f); _barFill.anchorMax = new Vector2(Mathf.Clamp01(num8), 1f); ((Graphic)_barFillImg).color = ((num8 >= 1f) ? S.Accent : OverlayStyle.WithA(S.Accent, 0.7f)); ((Graphic)_barFillImg).SetVerticesDirty(); bool flag7 = flag2 && current.levelScrap > 0 && Gate.LevelScrap; _onPlanetGo.SetActive(flag7); if (flag7) { ((TMP_Text)_onPlanetVal).text = "$" + current.levelScrap; } int day = current?.dayCount ?? 1; int deaths = current?.deaths ?? 0; string text4 = ((current != null && current.daysLeft >= 0) ? string.Format(" ({1} {2})", OverlayStyle.Hex(S.TextDim), current.daysLeft, Localization.T("left")) : ""); ((TMP_Text)_dayText).text = day + text4; ((TMP_Text)_deathsText).text = deaths.ToString(); bool monsters = Gate.Monsters; _mobRail.SetMobs((!monsters) ? null : current?.monstersOutside, (!monsters) ? null : current?.monstersInside); string[] array = ((!Gate.Traps) ? null : current?.traps); _mobRail.SetTraps(array); _trapFire.Firing = Gate.Traps && array != null && array.Length != 0 && flag2 && HasTurretTrap(array) && TurretEventActive(); RefreshEventPlate(flag2); RefreshTicker(current, flag, text, num2, day, deaths); } private void RefreshEventPlate(bool onMoon) { //IL_005c: 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) bool flag = Gate.Events && onMoon && (_events.Count > 0 || BcmerEvents.BcmePresent()); _eventPlate.SetVisible(flag); if (!flag) { return; } if (_events.Count == 0) { ((TMP_Text)_eventText).text = "" + Localization.T("noData") + ""; return; } List list = _events; if (!ConfigSettings.ShowAllEvents.Value && list.Count > 1) { list = list.GetRange(0, 1); } StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (i > 0) { stringBuilder.Append(", "); } stringBuilder.Append("') .Append(Esc(list[i].Name.ToUpperInvariant())) .Append(""); } ((TMP_Text)_eventText).text = stringBuilder.ToString(); } private void RefreshTicker(BridgePayload p, bool connected, string moon, int qi, int day, int deaths) { bool value = ConfigSettings.ShowTicker.Value; _tickerGo.SetActive(value); if (value) { string text = ((p != null && !string.IsNullOrEmpty(p.weatherFull)) ? p.weatherFull : "-"); string value2 = ((p != null && p.total > 0) ? $"{p.alive}/{p.total}" : "-"); StringBuilder stringBuilder = new StringBuilder(160); stringBuilder.Append(Localization.T("crew")).Append(": ").Append(value2) .Append(" // ") .Append(Localization.T("tMoon")) .Append(": ") .Append(moon.ToUpperInvariant()) .Append(" // ") .Append(Localization.T("tWx")) .Append(": ") .Append(text.ToUpperInvariant()) .Append(" // ") .Append(Localization.T("day")) .Append(' ') .Append(day) .Append(" // ") .Append(Localization.T("tQuota")) .Append(' ') .Append(qi) .Append(" // ") .Append(Localization.T("deaths")) .Append(' ') .Append(deaths); if (_events.Count > 0) { stringBuilder.Append(" // ").Append(Localization.T("tEvent")).Append(": ") .Append(_events[0].Name.ToUpperInvariant()); } if (!connected) { stringBuilder.Append(" // ").Append(Localization.T("offline")); } else if (Gate.Restricted) { stringBuilder.Append(" // ").Append(Localization.T("hostless")); } stringBuilder.Append(" // ").Append(Localization.T("tObjective")).Append(" //"); _ticker.SetContent(stringBuilder.ToString()); } } private static bool HasTurretTrap(string[] traps) { if (traps == null) { return false; } foreach (string text in traps) { if (text != null && text.IndexOf("turret", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private bool TurretEventActive() { foreach (BcmerEvents.EventInfo @event in _events) { string text = (@event.Name ?? "").ToLowerInvariant(); string[] turretEventKeys = TurretEventKeys; foreach (string value in turretEventKeys) { if (text.Contains(value)) { return true; } } } return false; } private string ColorizeWeather(string w) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(w) || w.Equals("None", StringComparison.OrdinalIgnoreCase)) { return ""; } string[] array = w.Split('+'); StringBuilder stringBuilder = new StringBuilder(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = array2[i].Trim(); if (text.Length == 0) { continue; } string text2 = text.ToLowerInvariant(); string text3 = null; (string, string)[] wxColors = WxColors; for (int j = 0; j < wxColors.Length; j++) { var (value, text4) = wxColors[j]; if (text2.Contains(value)) { text3 = text4; break; } } if (stringBuilder.Length > 0) { stringBuilder.Append(" + "); } if (text3 != null) { stringBuilder.Append("') .Append(Esc(text.ToUpperInvariant())) .Append(""); } else { stringBuilder.Append(Esc(text.ToUpperInvariant())); } } return stringBuilder.ToString(); } public static string Esc(string s) { return (s ?? "").Replace("<", "<"); } public static string FmtTime(int s) { if (s < 0) { s = 0; } int num = s / 3600; int num2 = s % 3600 / 60; int num3 = s % 60; if (num <= 0) { return $"{num2:00}:{num3:00}"; } return $"{num:00}:{num2:00}:{num3:00}"; } public static string FmtTimeMs(float s) { if (s < 0f) { s = 0f; } int num = (int)s; int num2 = num / 3600; int num3 = num % 3600 / 60; int num4 = num % 60; int num5 = (int)((s - (float)num) * 1000f); if (num5 > 999) { num5 = 999; } if (num2 <= 0) { return $"{num3:00}:{num4:00}.{num5:000}"; } return $"{num2}:{num3:00}:{num4:00}.{num5:000}"; } private void EnsureFonts() { if (_fontsResolved) { return; } try { TMP_FontAsset val = null; TMP_FontAsset val2 = null; if (ConfigSettings.RussianActive) { if ((Object)(object)_dynFont == (Object)null) { _dynFont = CreateDynamicCyrillicFont(); } TMP_FontAsset val3 = _dynFont; TMP_FontAsset val4 = FindRtlcFont(); if ((Object)(object)val4 != (Object)null) { val3 = val4; } val = (val2 = val3); } else { HUDManager instance = HUDManager.Instance; TMP_FontAsset val5 = (((Object)(object)instance != (Object)null && (Object)(object)instance.chatText != (Object)null) ? ((TMP_Text)instance.chatText).font : null); val = TryOsFont("Pixelify Sans") ?? val5; val2 = TryOsFont("Jersey 10") ?? val5; } if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null) { return; } if ((Object)(object)val == (Object)null) { val = val2; } if ((Object)(object)val2 == (Object)null) { val2 = val; } _fontBody = val; _fontBig = val2; _fontsResolved = true; foreach (TextMeshProUGUI allText in _allTexts) { if ((Object)(object)allText != (Object)null) { ((TMP_Text)allText).font = val; } } foreach (TextMeshProUGUI bigText in _bigTexts) { if ((Object)(object)bigText != (Object)null) { ((TMP_Text)bigText).font = val2; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Шрифты оверлея: заголовки=" + ((Object)val2).name + ", текст=" + ((Object)val).name)); } } catch { } } private static TMP_FontAsset FindRtlcFont() { try { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset val in array) { if (!((Object)(object)val == (Object)null) && (((Object)val).name ?? "").ToLowerInvariant().IndexOf("rtlc", StringComparison.Ordinal) >= 0) { bool flag; try { flag = val.HasCharacter('Я', false, false) && val.HasCharacter('а', false, false); } catch { flag = false; } if (flag) { return val; } } } } catch { } return null; } private static TMP_FontAsset TryOsFont(string name) { if (_osFontCache.TryGetValue(name, out var value)) { return value; } TMP_FontAsset val = null; try { string[] oSInstalledFontNames = Font.GetOSInstalledFontNames(); bool flag = false; if (oSInstalledFontNames != null) { string[] array = oSInstalledFontNames; for (int i = 0; i < array.Length; i++) { if (string.Equals(array[i], name, StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } } if (flag) { Font val2 = Font.CreateDynamicFontFromOSFont(name, 32); if ((Object)(object)val2 != (Object)null) { val = TMP_FontAsset.CreateFontAsset(val2); } } } catch { } _osFontCache[name] = val; return val; } private void ApplyBootstrapFont() { try { TMP_FontAsset val = TMP_Settings.defaultFontAsset; if ((Object)(object)val == (Object)null) { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); if (array != null && array.Length != 0) { val = array[0]; } } if ((Object)(object)val != (Object)null) { foreach (TextMeshProUGUI allText in _allTexts) { if ((Object)(object)allText != (Object)null) { ((TMP_Text)allText).font = val; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Временный шрифт оверлея: " + ((Object)val).name)); } } else { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogWarning((object)"Не найден ни один TMP-шрифт."); } } } catch { } } private static TMP_FontAsset CreateDynamicCyrillicFont() { string[] array = new string[5] { "Arial", "Segoe UI", "Verdana", "Tahoma", "Consolas" }; foreach (string text in array) { try { Font val = Font.CreateDynamicFontFromOSFont(text, 28); if ((Object)(object)val == (Object)null) { continue; } TMP_FontAsset val2 = TMP_FontAsset.CreateFontAsset(val); if (!((Object)(object)val2 != (Object)null)) { continue; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Русский шрифт оверлея: " + text)); } return val2; } catch { } } try { Font val3 = Resources.GetBuiltinResource("LegacyRuntime.ttf") ?? Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)val3 != (Object)null) { return TMP_FontAsset.CreateFontAsset(val3); } } catch { } return null; } private void BuildUi() { //IL_004a: 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_0080: Expected O, but got Unknown //IL_009d: 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_00b9: 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_00e3: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_018e: Expected O, but got Unknown _canvas = ((Component)this).gameObject.AddComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 500; CanvasScaler obj = ((Component)this).gameObject.AddComponent(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; GameObject val = NewUI("Root", ((Component)this).transform); _root = (RectTransform)val.transform; RectTransform root = _root; RectTransform root2 = _root; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(1f, 0.5f); root2.anchorMax = val2; root.anchorMin = val2; _root.pivot = new Vector2(1f, 0.5f); _root.sizeDelta = new Vector2(340f, 100f); ((Transform)_root).localScale = Vector3.one * Mathf.Clamp(ConfigSettings.Scale.Value, 0.5f, 2f); ((Transform)_root).localRotation = Quaternion.Euler(0f, 0f, 1f); _group = val.AddComponent(); _group.interactable = false; _group.blocksRaycasts = false; _group.alpha = 0f; _bgImage = AddImage(val, S.Bg); VerticalLayoutGroup obj2 = val.AddComponent(); ((LayoutGroup)obj2).padding = new RectOffset(15, 15, 13, 11); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 9f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; val.AddComponent().verticalFit = (FitMode)2; BuildHeader(val.transform); BuildLocation(val.transform); BuildQuota(val.transform); BuildDayDeaths(val.transform); BuildVictory(val.transform); BuildTicker(val.transform); BuildEndOfDay(); BuildFrame(val); BuildScanlines(val); BuildRails(); BuildEventPlate(); ApplyBootstrapFont(); ApplyPerspective(); ((Component)_root).gameObject.SetActive(false); } private void ApplyPerspective() { float value = ConfigSettings.PerspectiveStrength.Value; if (value <= 0f) { return; } Graphic[] componentsInChildren = ((Component)_root).GetComponentsInChildren(true); foreach (Graphic val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } if ((Object)(object)_topEye != (Object)null && ((Component)val).transform.IsChildOf(((Component)_topEye).transform)) { PerspectiveWarp perspectiveWarp = ((Component)val).gameObject.AddComponent(); perspectiveWarp.Panel = _root; perspectiveWarp.Width = 340f; perspectiveWarp.Strength = value; perspectiveWarp.Continuous = true; val.SetVerticesDirty(); continue; } bool flag = (Object)(object)_tickerGo != (Object)null && ((Component)val).transform.IsChildOf(_tickerGo.transform); string name = ((Object)((Component)val).gameObject).name; int num; switch (name) { default: num = ((name == "Pixbit") ? 1 : 0); break; case "Corner": case "Bracket": case "Edge": num = 1; break; } bool flag2 = (byte)num != 0; AddPerspective(val, flag || flag2); } } internal void AddPerspective(Graphic g, bool continuous) { float value = ConfigSettings.PerspectiveStrength.Value; if (!(value <= 0f) && !((Object)(object)g == (Object)null)) { if (g is TextMeshProUGUI) { TMPPerspective tMPPerspective = ((Component)g).gameObject.AddComponent(); tMPPerspective.Panel = _root; tMPPerspective.Width = 340f; tMPPerspective.Strength = value; tMPPerspective.Continuous = continuous; } else { PerspectiveWarp perspectiveWarp = ((Component)g).gameObject.AddComponent(); perspectiveWarp.Panel = _root; perspectiveWarp.Width = 340f; perspectiveWarp.Strength = value; perspectiveWarp.Continuous = continuous; } g.SetVerticesDirty(); } } internal void AddPerspectiveToTree(Transform root) { if (ConfigSettings.PerspectiveStrength.Value <= 0f || (Object)(object)root == (Object)null) { return; } Graphic[] componentsInChildren = ((Component)root).GetComponentsInChildren(true); foreach (Graphic val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null) && !((Object)(object)((Component)val).GetComponent() != (Object)null)) { AddPerspective(val, continuous: false); } } _lastPanelH = -1f; } private void RewarpOnResize() { //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) if (ConfigSettings.PerspectiveStrength.Value <= 0f || (Object)(object)_root == (Object)null) { return; } Rect rect = _root.rect; float height = ((Rect)(ref rect)).height; if (Mathf.Abs(height - _lastPanelH) < 0.5f) { return; } _lastPanelH = height; TMP_Text[] componentsInChildren = ((Component)_root).GetComponentsInChildren(true); foreach (TMP_Text val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent() != (Object)null) { val.ForceMeshUpdate(false, false); } } Graphic[] componentsInChildren2 = ((Component)_root).GetComponentsInChildren(true); foreach (Graphic val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && !(val2 is TextMeshProUGUI) && (Object)(object)((Component)val2).GetComponent() != (Object)null) { val2.SetVerticesDirty(); } } } private void BuildScanlines(GameObject panel) { //IL_009a: 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_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) if (ConfigSettings.Scanlines.Value) { if ((Object)(object)_scanTex == (Object)null) { _scanTex = new Texture2D(1, 3, (TextureFormat)4, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)0 }; _scanTex.SetPixels32((Color32[])(object)new Color32[3] { new Color32((byte)0, (byte)0, (byte)0, (byte)160), new Color32((byte)0, (byte)0, (byte)0, (byte)0), new Color32((byte)0, (byte)0, (byte)0, (byte)0) }); _scanTex.Apply(); } GameObject obj = NewUI("Scanlines", panel.transform); RectTransform val = (RectTransform)obj.transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; obj.AddComponent().ignoreLayout = true; RawImage val2 = obj.AddComponent(); val2.texture = (Texture)(object)_scanTex; ((Graphic)val2).raycastTarget = false; ((Graphic)val2).color = new Color(1f, 1f, 1f, 0.5f); ScanlineUV scanlineUV = obj.AddComponent(); scanlineUV.Img = val2; scanlineUV.LinePx = 3f; obj.transform.SetAsLastSibling(); } } private static Sprite Grunge() { //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_0026: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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) if ((Object)(object)_grunge != (Object)null) { return _grunge; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)0 }; Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.PerlinNoise((float)j * 0.35f + 3.1f, (float)i * 0.35f + 7.7f); float num2 = Mathf.PerlinNoise((float)j * 0.9f + 11f, (float)i * 0.9f + 2f); byte b = byte.MaxValue; if (num < 0.3f) { b = 30; } else if (num2 < 0.28f) { b = 140; } array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(); _grunge = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 1f); return _grunge; } private void BuildHeader(Transform parent) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01ed: 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) _headerGo = Row(parent, 8f); Flexible(NewUI("SpacerL", _headerGo.transform), 1f); _topEye = EclipseSun.BuildInlineEye(_headerGo.transform, 60f, 46f); Flexible(NewUI("SpacerR", _headerGo.transform), 1f); GameObject val = NewUI("TimerBox", _headerGo.transform); AddImage(val, S.Frame); LayoutElement obj = val.AddComponent(); obj.preferredWidth = 205f; obj.minWidth = 205f; HorizontalLayoutGroup obj2 = val.AddComponent(); ((LayoutGroup)obj2).padding = new RectOffset(12, 12, 9, 3); ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((LayoutGroup)obj2).childAlignment = (TextAnchor)4; _timerText = MakeText(val.transform, "00:00", 28f, Color.white, (TextAlignmentOptions)514, bold: false, big: true); ((TMP_Text)_timerText).enableWordWrapping = false; ((TMP_Text)_timerText).overflowMode = (TextOverflowModes)0; _headerDivider = NewUI("Divider", parent); _headerDivider.AddComponent().preferredHeight = 2f; if (S.LegacyCorners) { Vector2 val3 = default(Vector2); for (float num = 0f; num < 312f; num += 10f) { GameObject obj3 = NewUI("Dash", _headerDivider.transform); RectTransform val2 = (RectTransform)obj3.transform; ((Vector2)(ref val3))..ctor(0f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 0.5f); val2.sizeDelta = new Vector2(6f, 2f); val2.anchoredPosition = new Vector2(num, 0f); AddImage(obj3, OverlayStyle.WithA(S.Frame, 0.3f)); } } else { AddImage(_headerDivider, OverlayStyle.WithA(S.Frame, 0.5f)); } } private void BuildLocation(Transform parent) { //IL_0033: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014c: 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_015d: 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_0172: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) _locationGo = Col(parent, 2f); MakeText(_locationGo.transform, Localization.T("location"), 13f, S.TextDim, (TextAlignmentOptions)513, bold: true); _moonText = MakeText(_locationGo.transform, "- -", 26f, S.Text, (TextAlignmentOptions)513, bold: false, big: true); GameObject val = Row(_locationGo.transform, 6f); ((LayoutGroup)val.GetComponent()).childAlignment = (TextAnchor)3; _interiorText = MakeText(val.transform, "", 15f, S.Text, (TextAlignmentOptions)513); ((TMP_Text)_interiorText).enableWordWrapping = false; GameObject val2 = NewUI("LampSlot", val.transform); LayoutElement obj = val2.AddComponent(); obj.preferredWidth = 26f; obj.minWidth = 26f; obj.preferredHeight = 20f; obj.minHeight = 20f; GameObject val3 = NewUI("Lamp", val2.transform); RectTransform val4 = (RectTransform)val3.transform; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); val4.anchorMax = val5; val4.anchorMin = val5; val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(26f, 20f); val4.anchoredPosition = new Vector2(0f, 6f); _lampImg = val3.AddComponent(); _lampImg.sprite = SpriteBank.Get("apparatus"); _lampImg.preserveAspect = true; ((Graphic)_lampImg).raycastTarget = false; AddPerspective((Graphic)(object)_lampImg, continuous: false); val2.SetActive(false); _lampSlot = val2; _itemsText = MakeText(_locationGo.transform, "", 14f, S.TextDim, (TextAlignmentOptions)513); _oldBirdText = MakeText(_locationGo.transform, Localization.T("oldBird"), 17f, S.Danger, (TextAlignmentOptions)513, bold: true); ((Component)_oldBirdText).gameObject.SetActive(false); } private void BuildQuota(Transform parent) { //IL_0033: 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_01cb: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) _quotaGo = Col(parent, 4f); MakeText(_quotaGo.transform, Localization.T("deadline"), 13f, S.TextDim, (TextAlignmentOptions)513, bold: true); GameObject val = Row(_quotaGo.transform, 6f); ((HorizontalOrVerticalLayoutGroup)val.GetComponent()).childForceExpandWidth = true; for (int i = 0; i < 3; i++) { GameObject val2 = NewUI("QTab" + (i + 1), val.transform); _qtabBgs[i] = AddImage(val2, new Color(1f, 1f, 1f, 0.06f)); LayoutElement obj = val2.AddComponent(); obj.flexibleWidth = 1f; obj.preferredHeight = 30f; if (S.LegacyCorners) { AddBorder(val2, S.FrameDim, 2f); } TextMeshProUGUI val3 = MakeText(val2.transform, "Q" + (i + 1), 20f, S.TextDim, (TextAlignmentOptions)514, bold: false, big: true); StretchInto(((TMP_Text)val3).rectTransform); _qtabTexts[i] = val3; } _marksGo = Col(_quotaGo.transform, 3f); ((Object)_marksGo).name = "QuotaMarks"; _marksGo.SetActive(false); GameObject val4 = Row(_quotaGo.transform, 8f); Flexible(((Component)MakeText(val4.transform, Localization.T("lootQuota"), 14f, S.TextDim, (TextAlignmentOptions)513, bold: true)).gameObject, 1f); _lootQuotaText = MakeText(val4.transform, "0/0", 26f, S.Text, (TextAlignmentOptions)516, bold: false, big: true); GameObject val5 = NewUI("Bar", _quotaGo.transform); AddImage(val5, OverlayStyle.WithA(S.Frame, S.LegacyCorners ? 0.05f : 0.15f)); val5.AddComponent().preferredHeight = 18f; if (S.LegacyCorners) { AddBorder(val5, S.Frame, 2f); } GameObject val6 = NewUI("Fill", val5.transform); _barFill = (RectTransform)val6.transform; _barFill.anchorMin = Vector2.zero; _barFill.anchorMax = new Vector2(0f, 1f); _barFill.offsetMin = Vector2.zero; _barFill.offsetMax = Vector2.zero; _barFillImg = AddImage(val6, S.LegacyCorners ? S.Frame : OverlayStyle.WithA(S.Accent, 0.7f)); _barText = MakeText(val5.transform, "", 13f, Color.white, (TextAlignmentOptions)514, bold: true); StretchInto(((TMP_Text)_barText).rectTransform); ((Component)_barText).gameObject.SetActive(false); _onPlanetGo = Row(_quotaGo.transform, 6f); GameObject obj2 = NewUI("LBorder", _onPlanetGo.transform); LayoutElement obj3 = obj2.AddComponent(); obj3.preferredWidth = 3f; obj3.preferredHeight = 20f; AddImage(obj2, S.Frame); Flexible(((Component)MakeText(_onPlanetGo.transform, Localization.T("onPlanet"), 11f, S.TextDim, (TextAlignmentOptions)513, bold: true)).gameObject, 1f); _onPlanetVal = MakeText(_onPlanetGo.transform, "$0", 20f, S.Text, (TextAlignmentOptions)516, bold: false, big: true); _onPlanetGo.SetActive(false); _multText = MakeText(_quotaGo.transform, "", 13f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)516, bold: true); ((Component)_multText).gameObject.SetActive(false); } private void BuildEndOfDay() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00bf: 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_00ed: 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_011a: Unknown result type (might be due to invalid IL or missing references) GameObject val = NewUI("EndOfDay", ((Component)this).transform); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(600f, 300f); val2.anchoredPosition = new Vector2(0f, 120f); for (int i = 0; i < 4; i++) { GameObject val4 = NewUI("Digit" + i, val.transform); RectTransform val5 = (RectTransform)val4.transform; ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val5.anchorMax = val3; val5.anchorMin = val3; val5.pivot = new Vector2(0.5f, 0.5f); val5.sizeDelta = new Vector2(400f, 200f); val5.anchoredPosition = Vector2.zero; TextMeshProUGUI val6 = MakeText(val4.transform, "", 92f, S.Danger, (TextAlignmentOptions)514, bold: true, big: true); StretchInto(((TMP_Text)val6).rectTransform); ((TMP_Text)val6).enableWordWrapping = false; ((TMP_Text)val6).overflowMode = (TextOverflowModes)0; val4.SetActive(false); _eodPool.Add(new EodDigit { Go = val4, Rt = val5, Text = val6, Life = -1f }); } val.SetActive(false); _endOfDayGo = val; } private void SpawnEodDigit(int value) { EodDigit eodDigit = null; foreach (EodDigit item in _eodPool) { if (item.Life < 0f) { eodDigit = item; break; } } if (eodDigit == null) { float num = -1f; foreach (EodDigit item2 in _eodPool) { if (item2.Life > num) { num = item2.Life; eodDigit = item2; } } } if (eodDigit != null) { ((TMP_Text)eodDigit.Text).text = value.ToString(); eodDigit.Life = 0f; eodDigit.Go.SetActive(true); eodDigit.Go.transform.SetAsLastSibling(); PlayCountdownTick(); } } private static void PlayCountdownTick() { try { HUDManager instance = HUDManager.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.UIAudio == (Object)null)) { AudioClip val = instance.profitQuotaDaysLeftCalmSFX ?? instance.globalNotificationSFX; if ((Object)(object)val != (Object)null) { instance.UIAudio.PlayOneShot(val, 0.8f); } } } catch { } } private void BuildDayDeaths(Transform parent) { //IL_0024: 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) _dayDeathsGo = Row(parent, 8f); _dayText = MakeCell(Localization.T("day"), S.Text); _deathsText = MakeCell(Localization.T("deaths"), S.Danger); TextMeshProUGUI MakeCell(string label, Color valColor) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_005f: 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_0095: 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) GameObject val = Col(_dayDeathsGo.transform, 1f); VerticalLayoutGroup component = val.GetComponent(); ((LayoutGroup)component).padding = new RectOffset(8, 8, 6, 7); ((LayoutGroup)component).childAlignment = (TextAnchor)4; Flexible(val, 1f); AddBorder(val, S.LegacyCorners ? S.Frame : S.FrameDim, S.LegacyCorners ? 2f : 1f); MakeText(val.transform, label, 12f, S.TextDim, (TextAlignmentOptions)514, bold: true); return MakeText(val.transform, "0", 26f, valColor, (TextAlignmentOptions)514, bold: false, big: true); } } private void BuildVictory(Transform parent) { GameObject val = Col(parent, 4f); ((Object)val).name = "Victory"; _victory = val.AddComponent(); _victory.Init(this); } private void BuildTicker(Transform parent) { //IL_0046: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bc: 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_00db: 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_00f5: 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) //IL_0120: Expected O, but got Unknown //IL_012b: 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_0155: 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_0175: Unknown result type (might be due to invalid IL or missing references) _tickerGo = NewUI("Ticker", parent); _tickerGo.AddComponent().preferredHeight = 20f; Image obj = _tickerGo.AddComponent(); ((Graphic)obj).color = new Color(1f, 1f, 1f, 0.004f); ((Graphic)obj).raycastTarget = false; _tickerGo.AddComponent().showMaskGraphic = false; GameObject obj2 = NewUI("Line", _tickerGo.transform); RectTransform val = (RectTransform)obj2.transform; val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 1f); val.sizeDelta = new Vector2(0f, 2f); val.anchoredPosition = Vector2.zero; AddImage(obj2, OverlayStyle.WithA(S.Frame, 0.6f)); RectTransform val2 = (RectTransform)NewUI("Track", _tickerGo.transform).transform; val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 0.5f); val2.sizeDelta = new Vector2(4000f, 0f); val2.anchoredPosition = Vector2.zero; TextMeshProUGUI copy = MakeTickerCopy((Transform)(object)val2); TextMeshProUGUI copy2 = MakeTickerCopy((Transform)(object)val2); _ticker = _tickerGo.AddComponent(); _ticker.Init(val2, copy, copy2); } private TextMeshProUGUI MakeTickerCopy(Transform track) { //IL_0012: 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_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_0077: 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) TextMeshProUGUI obj = MakeText(track, "", 13f, S.TextDim, (TextAlignmentOptions)513); ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(0f, 0.5f); rectTransform.pivot = new Vector2(0f, 0.5f); rectTransform.anchoredPosition = Vector2.zero; rectTransform.sizeDelta = new Vector2(400f, 18f); return obj; } private void BuildRails() { //IL_0010: 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_002e: 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_0058: 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_0082: 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_0096: 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_00c0: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) RectTransform left = Rail("MobLeft", new Vector2(0f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -64f)); RectTransform right = Rail("MobRight", new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -64f)); RectTransform val = Rail("TrapRail", new Vector2(0.5f, 0f), new Vector2(0.5f, 0.5f), Vector2.zero); RectTransform val2 = Rail("TrapFx", new Vector2(0.5f, 0f), new Vector2(0.5f, 0.5f), Vector2.zero); _trapRailRt = val; _trapFxRt = val2; GameObject val3 = NewUI("Rails", (Transform)(object)_root); val3.AddComponent().ignoreLayout = true; _mobRail = val3.AddComponent(); _mobRail.Init(this, left, right, val); _mobRail.CountColor = S.Frame; _trapFire = ((Component)val2).gameObject.AddComponent(); _trapFire.Init(val2, null, S.Accent); _trapFire.Emitters = _mobRail.TurretIcons; RectTransform Rail(string name, Vector2 anchor, Vector2 pivot, Vector2 pos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0029: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GameObject val4 = NewUI(name, (Transform)(object)_root); RectTransform val5 = (RectTransform)val4.transform; Vector2 anchorMin = (val5.anchorMax = anchor); val5.anchorMin = anchorMin; val5.pivot = pivot; val5.sizeDelta = Vector2.zero; val5.anchoredPosition = pos; val4.AddComponent().ignoreLayout = true; return val5; } } private void PositionTrapRail() { //IL_0070: 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_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)_trapRailRt == (Object)null)) { float num = 0f; if ((Object)(object)_eventPlate != (Object)null && ((Component)_eventPlate).gameObject.activeSelf && (Object)(object)_eventPlateRt != (Object)null) { Rect rect = _eventPlateRt.rect; num = ((Rect)(ref rect)).height * _eventPlate.Progress; } _trapRailRt.anchoredPosition = new Vector2(0f, 0f - num); if ((Object)(object)_trapFxRt != (Object)null) { _trapFxRt.anchoredPosition = new Vector2(0f, 0f - num); } } } private void BuildEventPlate() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0030: 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_0047: 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_0071: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0107: 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) GameObject val = NewUI("EventPlate", (Transform)(object)_root); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(316f, 56f); val2.anchoredPosition = new Vector2(0f, -14f); _eventPlateRt = val2; val.AddComponent().ignoreLayout = true; AddImage(val, S.Bg); VerticalLayoutGroup obj = val.AddComponent(); ((LayoutGroup)obj).padding = new RectOffset(16, 16, 9, 11); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 2f; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; val.AddComponent().verticalFit = (FitMode)2; MakeText(val.transform, Localization.T("brutalEvent"), 13f, S.Danger, (TextAlignmentOptions)513, bold: true); _eventText = MakeText(val.transform, "", 22f, S.Text, (TextAlignmentOptions)513, bold: false, big: true); AddStyleFrame(val, full: false); _eventPlate = val.AddComponent(); _eventPlate.Init(val2); } private void BuildFrame(GameObject rootGo) { AddStyleFrame(rootGo, full: true); } private void AddStyleFrame(GameObject host, bool full) { //IL_006f: 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_002f: 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_005b: Unknown result type (might be due to invalid IL or missing references) if (S.LegacyCorners) { AddCorner(host, new Vector2(0f, 1f)); AddCorner(host, new Vector2(1f, 1f)); AddCorner(host, new Vector2(0f, 0f)); AddCorner(host, new Vector2(1f, 0f)); } else { AddBrackets(host, S.Frame); } AddPixbits(host, full); } private void AddCorner(GameObject rootGo, Vector2 corner) { //IL_0000: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006d: 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) float num = ((corner.x == 0f) ? 1f : (-1f)); float num2 = ((corner.y == 0f) ? 1f : (-1f)); AddCornerBar(rootGo, corner, new Vector2(26f, 4f), new Vector2((0f - num) * 2f, (0f - num2) * 2f)); AddCornerBar(rootGo, corner, new Vector2(4f, 26f), new Vector2((0f - num) * 2f, (0f - num2) * 2f)); } private void AddCornerBar(GameObject rootGo, Vector2 corner, Vector2 size, Vector2 offset) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0047: Unknown result type (might be due to invalid IL or missing references) GameObject obj = NewUI("Corner", rootGo.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = corner); val.anchorMin = anchorMin; val.pivot = corner; val.sizeDelta = size; val.anchoredPosition = offset; Image val3 = AddImage(obj, S.Frame); val3.sprite = Grunge(); val3.type = (Type)0; _frameImages.Add(val3); obj.AddComponent().ignoreLayout = true; } private void AddBrackets(GameObject host, Color c) { //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_0023: 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_0051: 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) Bracket(new Vector2(0f, 1f)); Bracket(new Vector2(1f, 1f)); Bracket(new Vector2(0f, 0f)); Bracket(new Vector2(1f, 0f)); void Bracket(Vector2 corner) { //IL_0000: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0070: 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_008e: 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) float num = ((corner.x == 0f) ? 1f : (-1f)); float num2 = ((corner.y == 0f) ? 1f : (-1f)); Bar(host, corner, new Vector2(20f, 3f), new Vector2(num * 0f, num2 * 0f), c); Bar(host, corner, new Vector2(3f, 20f), new Vector2(num * 0f, num2 * 0f), c); } } private void Bar(GameObject host, Vector2 corner, Vector2 size, Vector2 offset, Color c) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0041: Unknown result type (might be due to invalid IL or missing references) GameObject obj = NewUI("Bracket", host.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = corner); val.anchorMin = anchorMin; val.pivot = corner; val.sizeDelta = size; val.anchoredPosition = offset; Image val3 = AddImage(obj, c); val3.sprite = Grunge(); val3.type = (Type)0; _frameImages.Add(val3); obj.AddComponent().ignoreLayout = true; } private void AddBorder(GameObject go, Color c, float t) { //IL_000b: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_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_006d: 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_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_009e: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) MakeEdge(go, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, t), c); MakeEdge(go, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, t), c); MakeEdge(go, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(t, 0f), c); MakeEdge(go, new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(t, 0f), c); } private static Image MakeEdge(GameObject parent, Vector2 aMin, Vector2 aMax, Vector2 thickness, Color c) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_002a: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_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_0072: 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) GameObject val = NewUI("Edge", parent.transform); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = aMin; val2.anchorMax = aMax; val2.pivot = new Vector2((aMin.x == aMax.x) ? aMin.x : 0.5f, (aMin.y == aMax.y) ? aMin.y : 0.5f); val2.sizeDelta = thickness; val2.anchoredPosition = Vector2.zero; Image obj = AddImage(val, c); obj.sprite = Grunge(); obj.type = (Type)0; val.AddComponent().ignoreLayout = true; return obj; } private void AddPixbits(GameObject rootGo, bool full) { //IL_001b: 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_004b: 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_007b: 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_00ab: 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_00db: 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_010b: 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) //IL_013b: 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_016b: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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_023e: Unknown result type (might be due to invalid IL or missing references) Bit(new Vector2(0f, 1f), new Vector2(32f, 0f), 1.1f, 0f); Bit(new Vector2(0f, 1f), new Vector2(42f, 0f), 1.5f, 0.4f); Bit(new Vector2(1f, 1f), new Vector2(-32f, 0f), 0.7f, 0.15f); Bit(new Vector2(1f, 1f), new Vector2(-42f, 0f), 0.9f, 0.6f); Bit(new Vector2(0f, 0f), new Vector2(32f, -0f), 0.9f, 0.6f); Bit(new Vector2(0f, 0f), new Vector2(42f, -0f), 0.7f, 0.15f); Bit(new Vector2(1f, 0f), new Vector2(-32f, -0f), 1.1f, 0f); Bit(new Vector2(1f, 0f), new Vector2(-42f, -0f), 1.5f, 0.4f); if (full) { Bit(new Vector2(0f, 1f), new Vector2(-0f, -32f), 0.7f, 0.15f); Bit(new Vector2(0f, 0f), new Vector2(-0f, 32f), 0.9f, 0.6f); Bit(new Vector2(1f, 1f), new Vector2(0f, -32f), 1.5f, 0.4f); Bit(new Vector2(1f, 0f), new Vector2(0f, 32f), 1.1f, 0f); } void Bit(Vector2 anchor, Vector2 pos, float period, float phase) { //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_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0046: 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_005b: 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) GameObject obj = NewUI("Pixbit", rootGo.transform); RectTransform val = (RectTransform)obj.transform; Vector2 anchorMin = (val.anchorMax = anchor); val.anchorMin = anchorMin; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(5f, 5f); val.anchoredPosition = pos; Image img = AddImage(obj, S.Frame); obj.AddComponent().ignoreLayout = true; PixbitFlicker pixbitFlicker = obj.AddComponent(); pixbitFlicker.Init(img, period, phase); _pixbits.Add(pixbitFlicker); } } internal static GameObject NewUI(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return val; } private static Image AddImage(GameObject go, Color c) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Image obj = go.AddComponent(); ((Graphic)obj).color = c; ((Graphic)obj).raycastTarget = false; return obj; } private GameObject Row(Transform parent, float spacing) { GameObject obj = NewUI("Row", parent); HorizontalLayoutGroup obj2 = obj.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; return obj; } private GameObject Col(Transform parent, float spacing) { GameObject obj = NewUI("Col", parent); VerticalLayoutGroup obj2 = obj.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; return obj; } internal GameObject MakeCol(Transform parent, float spacing) { return Col(parent, spacing); } private static void Flexible(GameObject go, float w) { LayoutElement val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } val.flexibleWidth = w; } private static void StretchInto(RectTransform rt) { //IL_0001: 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_0017: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; ((Component)rt).gameObject.AddComponent().ignoreLayout = true; } internal TextMeshProUGUI MakeText(Transform parent, string text, float size, Color color, TextAlignmentOptions align = (TextAlignmentOptions)513, bool bold = false, bool big = false) { //IL_0020: 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) TextMeshProUGUI val = NewUI("Text", parent).AddComponent(); ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = size; ((Graphic)val).color = color; ((TMP_Text)val).alignment = align; ((TMP_Text)val).enableWordWrapping = true; ((TMP_Text)val).richText = true; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).fontStyle = (FontStyles)1; TMP_FontAsset val2 = (big ? (_fontBig ?? _fontBody) : _fontBody); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val).font = val2; } _allTexts.Add(val); if (big) { _bigTexts.Add(val); } return val; } } public class OverlayStyle { public Color Bg; public Color Accent; public Color AccentDim; public Color Frame; public Color FrameDim; public Color Text; public Color TextDim; public Color Danger; public bool LegacyCorners; public bool BlueBrackets; public static OverlayStyle Legacy() { //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_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_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_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_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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_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) return new OverlayStyle { Bg = new Color(4f / 51f, 2f / 85f, 2f / 85f, 0.62f), Accent = FromHex("FF7A1A"), AccentDim = FromHex("C25910"), Frame = FromHex("FF3A2E"), FrameDim = FromHex("C43022"), Text = FromHex("FF7A1A"), TextDim = FromHex("C25910"), Danger = FromHex("FF5141"), LegacyCorners = true, BlueBrackets = false }; } public static OverlayStyle Game() { //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_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_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_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_0078: 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_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_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_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) return new OverlayStyle { Bg = new Color(0f, 0f, 0f, 0f), Accent = FromHex("FF9A3D"), AccentDim = FromHex("B96A20"), Frame = new Color(0.43f, 0.44f, 0.86f, 0.85f), FrameDim = new Color(0.43f, 0.44f, 0.86f, 0.45f), Text = FromHex("E6E6F2"), TextDim = FromHex("9BA0C4"), Danger = FromHex("FF5C5C"), LegacyCorners = false, BlueBrackets = true }; } public static Color FromHex(string hex) { //IL_001a: 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) Color result = default(Color); if (!ColorUtility.TryParseHtmlString("#" + hex, ref result)) { return Color.white; } return result; } public static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGB(c); } public static Color WithA(Color c, float a) { //IL_0000: 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_000c: 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) return new Color(c.r, c.g, c.b, a); } } [BepInPlugin("gdlp.lcbridgeoverlay", "LCBridgeOverlay", "1.7.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "gdlp.lcbridgeoverlay"; public const string NAME = "LCBridgeOverlay"; public const string VERSION = "1.7.0"; private Harmony _harmony; private static bool _quitting; private static GameObject _tickerGo; private float _watchdogT; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; ConfigSettings.Bind(((BaseUnityPlugin)this).Config); if (!ConfigSettings.Enabled.Value) { Log.LogInfo((object)"LCBridgeOverlay выключен РІ конфиге (General.Enabled = false)."); return; } try { _harmony = new Harmony("gdlp.lcbridgeoverlay"); int num = 0; int num2 = 0; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { try { if (type.GetCustomAttributes(typeof(HarmonyPatch), inherit: true).Length != 0) { _harmony.CreateClassProcessor(type).Patch(); num++; } } catch (Exception ex) { num2++; Log.LogError((object)("патч " + type.Name + " не применён: " + ex.Message)); } } Log.LogInfo((object)$"Harmony: применено классов {num}, с ошибкой {num2}."); Log.LogInfo((object)"Harmony-патчи применены."); } catch (Exception ex2) { Log.LogWarning((object)("РќРµ удалось применить Harmony-патчи: " + ex2.Message)); } TryPatchBcmeTips(); if (ConfigSettings.WebSocketEnabled.Value) { int value = ConfigSettings.Port.Value; try { BridgeServer.Start(value); Log.LogInfo((object)$"WebSocket-мост включён в конфиге: слушаю ws://127.0.0.1:{value} (только этот компьютер)."); } catch (Exception ex3) { Log.LogError((object)$"Не удалось поднять мост на порту {value} (возможно, порт занят): {ex3.Message}"); } } else { Log.LogInfo((object)"WebSocket-мост выключен (по умолчанию) — порты не открываются. Включается в конфиге: [WebSocket] Enabled."); } EnsureTicker(); Application.quitting += OnApplicationQuitting; CreateOverlay(); Log.LogInfo((object)"LCBridgeOverlay v1.7.0 готов (РјРѕСЃС‚ встроен, отдельный LCBridge РЅРµ требуется)."); } private void TryPatchBcmeTips() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("BrutalCompanyMinus.Net"); if (type == null) { Log.LogInfo((object)"BCME.Net РЅРµ найден — ловля ивентов РЅР° клиенте пропущена."); return; } MethodInfo methodInfo = AccessTools.Method(type, "DisplayTipClientRpc", (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogWarning((object)"BCME.Net.DisplayTipClientRpc РЅРµ найден — сигнатура изменилась?"); return; } HarmonyMethod val = new HarmonyMethod(typeof(BcmeClientEvents).GetMethod("OnDisplayTip", BindingFlags.Static | BindingFlags.Public)); _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"BCME.Net.DisplayTipClientRpc пропатчен — клиенты Р±СѓРґСѓС‚ видеть ивенты."); } catch (Exception ex) { Log.LogWarning((object)("РќРµ удалось пропатчить BCME-анонсы ивентов: " + ex.Message)); } } private static void EnsureTicker() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (!((Object)(object)_tickerGo != (Object)null)) { _tickerGo = new GameObject("LCBridgeTicker") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)_tickerGo); _tickerGo.AddComponent(); } } private static void CreateOverlay() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown GameObject val = new GameObject("LCBridgeOverlay") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); val.AddComponent(); } private void Update() { if (!ConfigSettings.Enabled.Value) { return; } _watchdogT += Time.unscaledDeltaTime; if (!(_watchdogT < 3f)) { _watchdogT = 0f; if ((Object)(object)_tickerGo == (Object)null) { EnsureTicker(); } if ((Object)(object)OverlayManager.Instance == (Object)null) { Log.LogWarning((object)"Объект оверлея был уничтожен — пересоздаю."); CreateOverlay(); } } } private static void OnApplicationQuitting() { _quitting = true; try { BridgeServer.Stop(); } catch { } } private void OnDestroy() { if (!_quitting) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)"Компонент LCBridgeOverlay уничтожен сменой сцены — РјРѕСЃС‚ Рё тикер продолжают работать."); } return; } try { BridgeServer.Stop(); } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } } public static class Rtlc { private static bool _checked; private static bool _present; public static bool Present { get { if (_checked) { return _present; } _checked = true; try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { string obj = pluginInfo.Key ?? ""; PluginInfo value = pluginInfo.Value; object obj2; if (value == null) { obj2 = null; } else { BepInPlugin metadata = value.Metadata; obj2 = ((metadata != null) ? metadata.Name : null); } if (obj2 == null) { obj2 = ""; } string text = (string)obj2; string text2 = obj + " " + text; if (text2.IndexOf("RTLC", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Russian", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("314ZDA", StringComparison.OrdinalIgnoreCase) >= 0 || (text2.IndexOf("BrutalCompany", StringComparison.OrdinalIgnoreCase) >= 0 && text2.IndexOf("RUS", StringComparison.OrdinalIgnoreCase) >= 0)) { _present = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("Обнаружен русификатор (" + text + ") — язык оверлея по умолчанию русский.")); } break; } } } catch { } return _present; } } } public static class SpriteBank { private static readonly Dictionary _cache = new Dictionary(); public static Sprite Get(string key) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a2: 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) if (string.IsNullOrEmpty(key)) { return null; } if (_cache.TryGetValue(key, out var value)) { return value; } Sprite val = null; try { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LCBridgeOverlay.res.mobs." + key + ".png"); if (manifestResourceStream != null) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { manifestResourceStream.CopyTo(memoryStream); array = memoryStream.ToArray(); } manifestResourceStream.Dispose(); Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val2, array)) { ((Texture)val2).filterMode = (FilterMode)1; val = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f); } } } catch { } _cache[key] = val; return val; } public static Sprite GetBloody(string key) { //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02de: 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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown if (string.IsNullOrEmpty(key)) { return null; } string key2 = key + "#blood"; if (_cache.TryGetValue(key2, out var value)) { return value; } Sprite val = null; try { Sprite val2 = Get(key); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.texture != (Object)null) { Texture2D texture = val2.texture; int width = ((Texture)texture).width; int height = ((Texture)texture).height; Color32[] pixels = texture.GetPixels32(); int num = width; int num2 = height; int num3 = -1; int num4 = -1; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (pixels[i * width + j].a > 24) { if (j < num) { num = j; } if (j > num3) { num3 = j; } if (i < num2) { num2 = i; } if (i > num4) { num4 = i; } } } } if (num3 >= num) { Random random = new Random(key.GetHashCode()); int num5 = num3 - num + 1; int num6 = num4 - num2 + 1; int num7 = Mathf.Clamp(num5 * num6 / 900, 18, 60); float num8 = Mathf.Max(3f, (float)Mathf.Min(num5, num6) * 0.13f); for (int k = 0; k < num7; k++) { float num9 = (float)num + (float)random.NextDouble() * (float)num5; float num10 = (float)num2 + (float)random.NextDouble() * (float)num6; float num11 = num8 * (0.35f + (float)random.NextDouble() * 1.1f); float squash = 0.7f + (float)random.NextDouble() * 0.6f; Splat(pixels, width, height, num9, num10, num11, squash); int num12 = 2 + random.Next(4); for (int l = 0; l < num12; l++) { float num13 = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); float num14 = num11 * (1.1f + (float)random.NextDouble() * 1.8f); Splat(pixels, width, height, num9 + Mathf.Cos(num13) * num14, num10 + Mathf.Sin(num13) * num14, Mathf.Max(1f, num11 * 0.3f), 1f); } if (random.NextDouble() < 0.5) { float num15 = num11 * (1.2f + (float)random.NextDouble() * 2.4f); float num16 = Mathf.Max(1f, num11 * 0.26f); for (float num17 = 0f; num17 < num15; num17 += 1f) { Splat(pixels, width, height, num9, num10 - num17, num16 * (1f - num17 / num15 * 0.65f), 1f); } } } Texture2D val3 = new Texture2D(width, height, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; val3.SetPixels32(pixels); val3.Apply(); val = Sprite.Create(val3, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f); } } } catch { } _cache[key2] = val; return val; } private static void Splat(Color32[] px, int w, int h, float cx, float cy, float r, float squash) { int num = Mathf.Max(0, Mathf.FloorToInt(cx - r)); int num2 = Mathf.Min(w - 1, Mathf.CeilToInt(cx + r)); int num3 = Mathf.Max(0, Mathf.FloorToInt(cy - r * squash)); int num4 = Mathf.Min(h - 1, Mathf.CeilToInt(cy + r * squash)); for (int i = num3; i <= num4; i++) { for (int j = num; j <= num2; j++) { int num5 = i * w + j; if (px[num5].a > 24) { float num6 = ((float)j - cx) / Mathf.Max(0.01f, r); float num7 = ((float)i - cy) / Mathf.Max(0.01f, r * squash); float num8 = num6 * num6 + num7 * num7; if (!(num8 > 1f)) { float num9 = Mathf.Clamp01(1f - num8); num9 = num9 * num9 * 0.96f; px[num5].r = (byte)Mathf.Lerp((float)(int)px[num5].r, 68f, num9); px[num5].g = (byte)Mathf.Lerp((float)(int)px[num5].g, 3f, num9); px[num5].b = (byte)Mathf.Lerp((float)(int)px[num5].b, 6f, num9); } } } } } } public static class EclipseSun { private static Sprite _sprite; public static Sprite Get() { if ((Object)(object)_sprite != (Object)null) { return _sprite; } _sprite = LoadEmbedded() ?? Procedural(); return _sprite; } private static Sprite LoadEmbedded() { //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_0056: Expected O, but got Unknown //IL_007c: 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 { Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LCBridgeOverlay.res.eye.png"); if (manifestResourceStream == null) { return null; } byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { manifestResourceStream.CopyTo(memoryStream); array = memoryStream.ToArray(); } manifestResourceStream.Dispose(); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; if (!ImageConversion.LoadImage(val, array)) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } catch { return null; } } private static Sprite Procedural() { //IL_01d8: 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_01e4: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_01aa: 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) int num = 240; int num2 = 136; float num3 = (float)(num - 1) / 2f; float num4 = (float)(num2 - 1) / 2f; float num5 = 108f; float num6 = 58f; float num7 = 9.6f; float num8 = 38f; float num9 = 9.6f; float num10 = 16.8f; float[] array = new float[num * num2]; for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { float num11 = (float)j - num3; float num12 = (float)i - num4; float num13 = num11 / num5; bool flag = false; if (Mathf.Abs(num13) <= 1f) { float num14 = num6 * (1f - num13 * num13); if (Mathf.Abs(num12 - num14) < num7 || Mathf.Abs(num12 + num14) < num7) { flag = true; } } float num15 = Mathf.Sqrt(num11 * num11 + num12 * num12); if (num15 < num10) { flag = true; } else if (Mathf.Abs(num15 - num8) < num9) { flag = true; } if (flag) { array[i * num + j] = 1f; } } } Color32[] array2 = (Color32[])(object)new Color32[2040]; for (int k = 0; k < 34; k++) { for (int l = 0; l < 60; l++) { float num16 = 0f; for (int m = 0; m < 4; m++) { for (int n = 0; n < 4; n++) { num16 += array[(k * 4 + m) * num + (l * 4 + n)]; } } byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(num16 / 16f * 255f), 0, 255); array2[k * 60 + l] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } Texture2D val = new Texture2D(60, 34, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; val.SetPixels32(array2); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 60f, 34f), new Vector2(0.5f, 0.5f), 100f); } public static EyeWidget BuildInlineEye(Transform parent, float w, float h) { //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_002a: 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_0036: Expected O, but got Unknown //IL_0036: 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) GameObject val = new GameObject("EyeLogo", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform rt = (RectTransform)val.transform; Image val2 = val.AddComponent(); val2.sprite = Get(); ((Graphic)val2).raycastTarget = false; val2.preserveAspect = true; LayoutElement obj = val.AddComponent(); obj.preferredWidth = w; obj.preferredHeight = h; EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(rt, val2); return eyeWidget; } public static EyeWidget BuildCornerEye(RectTransform panel) { //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_002a: 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_0036: Expected O, but got Unknown //IL_0049: 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_0060: 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_008a: 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_00a0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EyeLogo", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)panel, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 1f); val2.sizeDelta = new Vector2(44f, 32f); val2.anchoredPosition = new Vector2(15f, -12f); val.AddComponent().ignoreLayout = true; Image val4 = val.AddComponent(); val4.sprite = Get(); ((Graphic)val4).raycastTarget = false; val4.preserveAspect = true; EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(val2, val4); return eyeWidget; } public static EyeWidget BuildOverlay(RectTransform panel) { //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_002a: 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_0036: Expected O, but got Unknown //IL_0049: 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_0060: 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_008a: 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_00a0: 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) GameObject val = new GameObject("EyeTop", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)panel, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(52f, 52f); val2.anchoredPosition = new Vector2(0f, 8f); val.AddComponent().ignoreLayout = true; Image val4 = val.AddComponent(); val4.sprite = Get(); ((Graphic)val4).raycastTarget = false; val4.preserveAspect = true; val.transform.SetAsFirstSibling(); EyeWidget eyeWidget = val.AddComponent(); eyeWidget.Init(val2, val4); return eyeWidget; } } public class EventPlateWidget : MonoBehaviour { private const float AnimTime = 0.4f; private RectTransform _rt; private CanvasGroup _cg; private bool _wantVisible; private float _t; public bool Visible => _wantVisible; public float Progress => _t; public void Init(RectTransform rt) { _rt = rt; _cg = ((Component)rt).gameObject.GetComponent(); if ((Object)(object)_cg == (Object)null) { _cg = ((Component)rt).gameObject.AddComponent(); } _cg.alpha = 0f; ((Component)this).gameObject.SetActive(false); } public void SetVisible(bool v) { if (_wantVisible != v) { _wantVisible = v; if (v) { ((Component)this).gameObject.SetActive(true); } } } private void Update() { float num = (_wantVisible ? 1f : 0f); _t = Mathf.MoveTowards(_t, num, Time.unscaledDeltaTime / 0.4f); float alpha = 1f - Mathf.Pow(1f - _t, 3f); if ((Object)(object)_cg != (Object)null) { _cg.alpha = alpha; } if (!_wantVisible && _t <= 0.001f && ((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(false); } } } public class EyeWidget : MonoBehaviour { public Image Img; private RectTransform _rt; private float _open = 1f; private float _target = 1f; public void Init(RectTransform rt, Image img) { _rt = rt; Img = img; } public void SetOpen(float target) { _target = Mathf.Clamp01(target); } private void Update() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0057: Unknown result type (might be due to invalid IL or missing references) _open = Mathf.MoveTowards(_open, _target, Time.unscaledDeltaTime / 0.35f); float num = Mathf.Lerp(0.06f, 1f, _open); Vector3 localScale = ((Transform)_rt).localScale; ((Transform)_rt).localScale = new Vector3(localScale.x, num, localScale.z); } } public class MobRailWidget : MonoBehaviour { private class SwayItem { public RectTransform Rt; public Image Img; public string GroupKey; public float Speed; public float Phase; public float Amp; public float Scale; public float Appear; public float Alpha = 1f; public Color BaseColor = Color.white; public float HurtFlash; public float FlipY = 1f; public List Variants; public int CurVariant; public float CycleT; public float SwapFade = 1f; public bool Swapping; public Vector2 HomePos; public bool Shaking; public bool HomeSet; public float WindSmooth; public float NearSmooth; } private class VariantView { public string IconKey; public bool Angry; public bool Deviant; public string DistKey; } private class Desc { public string Name; public int Cnt; public bool Turret; public bool Slayer; public bool Kamikaze; public bool Aggro; public bool Angry; public bool Adult; public bool Attack; public bool Ceiling; public bool Frozen; public bool Scanned; public bool Firing; public bool Hurt; public bool Deviant; public int WindLevel = -1; public float Dist = -1f; public string GroupKey; public string IconKey; public int Rank => ((Slayer || Kamikaze) ? 2 : 0) + (Turret ? 1 : 0) + (Deviant ? 4 : 0); } private class Group { public string Key; public int Total; public readonly List Variants = new List(); } private const float Icon = 42f; private const float Overlap = 21f; private const float RowStep = 48f; private const float TrapDrop = 20f; private OverlayManager _mgr; private RectTransform _left; private RectTransform _right; private RectTransform _traps; private string _sigMobs = ""; private string _sigTraps = ""; private const float SwapFadeTime = 0.35f; private const float HurtFlashTime = 0.45f; private static readonly Color HurtColor = new Color(1f, 0.22f, 0.18f, 1f); private readonly List _sway = new List(); private readonly Dictionary _distByGroup = new Dictionary(); private readonly Dictionary _byGroup = new Dictionary(); private readonly Dictionary _distByVariant = new Dictionary(); private readonly Dictionary _windByGroup = new Dictionary(); public readonly List TurretIcons = new List(); public Color CountColor = OverlayStyle.FromHex("FF5141"); private TrapFireEffect _fireLeft; private TrapFireEffect _fireRight; private readonly List _firingLeft = new List(); private readonly List _firingRight = new List(); private static readonly string[] HideKeys = new string[5] { "manticoil", "locust", "docile", "vain", "shroud" }; private static readonly HashSet _loggedNoIcon = new HashSet(); public void Init(OverlayManager mgr, RectTransform left, RectTransform right, RectTransform traps) { //IL_0036: 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) _mgr = mgr; _left = left; _right = right; _traps = traps; _fireLeft = ((Component)left).gameObject.AddComponent(); _fireLeft.Init(left, null, Color.white); _fireLeft.Emitters = _firingLeft; _fireRight = ((Component)right).gameObject.AddComponent(); _fireRight.Init(right, null, Color.white); _fireRight.Emitters = _firingRight; } private void Update() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_0260: 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_0280: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; float unscaledDeltaTime = Time.unscaledDeltaTime; for (int i = 0; i < _sway.Count; i++) { SwayItem swayItem = _sway[i]; if ((Object)(object)swayItem.Rt == (Object)null) { continue; } if (!swayItem.HomeSet) { swayItem.HomePos = swayItem.Rt.anchoredPosition; swayItem.HomeSet = true; } if (swayItem.Appear < 1f) { swayItem.Appear = Mathf.MoveTowards(swayItem.Appear, 1f, unscaledDeltaTime / 0.3f); } float num = swayItem.Scale * EaseOutBack(swayItem.Appear); swayItem.WindSmooth = Mathf.MoveTowards(swayItem.WindSmooth, WindFor(swayItem.GroupKey), unscaledDeltaTime / 1.2f); swayItem.NearSmooth = Mathf.MoveTowards(swayItem.NearSmooth, NearFor(swayItem.GroupKey), unscaledDeltaTime / 0.8f); float windSmooth = swayItem.WindSmooth; float nearSmooth = swayItem.NearSmooth; float num2 = swayItem.Amp; float num3 = swayItem.Speed; float num4 = 0f; float num5 = 0f; float num6 = windSmooth * windSmooth; float num7 = nearSmooth * nearSmooth * nearSmooth; bool flag = windSmooth > 0.001f || nearSmooth > 0.001f; if (flag) { num2 = swayItem.Amp + Mathf.Max(14f * num6, 9f * num7); num3 = swayItem.Speed + Mathf.Max(22f * num6, 15f * num7); float num8 = Mathf.Max(3.5f * num6, 2.4f * num7); num4 = (Mathf.PerlinNoise(unscaledTime * 26f + swayItem.Phase, 0f) - 0.5f) * 2f * num8; num5 = (Mathf.PerlinNoise(0f, unscaledTime * 26f + swayItem.Phase) - 0.5f) * 2f * num8; num *= 1f + 0.06f * Mathf.Max(num6, num7) * Mathf.Abs(Mathf.Sin(unscaledTime * 18f)); } ((Transform)swayItem.Rt).localScale = new Vector3(num, num * swayItem.FlipY, 1f); ((Transform)swayItem.Rt).localRotation = Quaternion.Euler(0f, 0f, Mathf.Sin((unscaledTime + swayItem.Phase) * num3) * num2); if (flag) { swayItem.Rt.anchoredPosition = swayItem.HomePos + new Vector2(num4, num5); } else if (swayItem.Shaking) { swayItem.Rt.anchoredPosition = swayItem.HomePos; } swayItem.Shaking = flag; UpdateVariant(swayItem, unscaledDeltaTime); if ((Object)(object)swayItem.Img != (Object)null) { float num9 = AlphaForGroup(swayItem.GroupKey); swayItem.Alpha = Mathf.Lerp(swayItem.Alpha, num9, 1f - Mathf.Exp(-6f * unscaledDeltaTime)); if (swayItem.HurtFlash > 0f) { swayItem.HurtFlash = Mathf.MoveTowards(swayItem.HurtFlash, 0f, unscaledDeltaTime / 0.45f); } Color color = Color.Lerp(swayItem.BaseColor, HurtColor, swayItem.HurtFlash); color.a = swayItem.Alpha * swayItem.Appear * swayItem.SwapFade; ((Graphic)swayItem.Img).color = color; } } } private float NearFor(string groupKey) { if (!ConfigSettings.ProximityShake.Value || string.IsNullOrEmpty(groupKey)) { return 0f; } if (!_distByGroup.TryGetValue(groupKey, out var value)) { return 0f; } return Mathf.InverseLerp(40f, 4f, value); } private float AlphaForGroup(string groupKey) { if (!ConfigSettings.ProximityFade.Value || string.IsNullOrEmpty(groupKey)) { return 1f; } if (!_distByGroup.TryGetValue(groupKey, out var value)) { return 1f; } float num = Mathf.InverseLerp(34f, 6f, value); return Mathf.Lerp(0.28f, 1f, num); } private void UpdateVariant(SwayItem s, float dt) { List variants = s.Variants; if (variants == null || variants.Count < 2 || (Object)(object)s.Img == (Object)null) { return; } float num = Mathf.Max(0f, ConfigSettings.VariantNearDistance.Value); int num2 = -1; if (num > 0f) { float num3 = num; for (int i = 0; i < variants.Count; i++) { if (_distByVariant.TryGetValue(variants[i].DistKey, out var value) && value <= num3) { num3 = value; num2 = i; } } } if (num2 >= 0) { s.CycleT = 0f; if (num2 != s.CurVariant) { if (!s.Swapping) { s.Swapping = true; } s.SwapFade = Mathf.MoveTowards(s.SwapFade, 0f, dt / 0.35f); if (s.SwapFade <= 0.01f) { ApplyVariant(s, num2); s.Swapping = false; } } else { s.Swapping = false; s.SwapFade = Mathf.MoveTowards(s.SwapFade, 1f, dt / 0.35f); } return; } float value2 = ConfigSettings.VariantCycleSeconds.Value; if (value2 <= 0f) { int num4 = 0; float num5 = float.MaxValue; for (int j = 0; j < variants.Count; j++) { float value3; float num6 = (_distByVariant.TryGetValue(variants[j].DistKey, out value3) ? value3 : float.MaxValue); if (num6 < num5) { num5 = num6; num4 = j; } } if (num4 != s.CurVariant) { ApplyVariant(s, num4); } s.SwapFade = Mathf.MoveTowards(s.SwapFade, 1f, dt / 0.35f); } else if (s.Swapping) { s.SwapFade = Mathf.MoveTowards(s.SwapFade, 0f, dt / 0.35f); if (s.SwapFade <= 0.01f) { ApplyVariant(s, (s.CurVariant + 1) % variants.Count); s.Swapping = false; s.CycleT = 0f; } } else { s.SwapFade = Mathf.MoveTowards(s.SwapFade, 1f, dt / 0.35f); s.CycleT += dt; if (s.CycleT >= value2) { s.Swapping = true; } } } private void ApplyVariant(SwayItem s, int index) { List variants = s.Variants; if (variants != null && index >= 0 && index < variants.Count && !((Object)(object)s.Img == (Object)null)) { VariantView variantView = variants[index]; s.CurVariant = index; Sprite val = (variantView.Angry ? SpriteBank.GetBloody(variantView.IconKey) : null); Sprite val2 = (((Object)(object)val != (Object)null) ? val : SpriteBank.Get(variantView.IconKey)); if ((Object)(object)val2 != (Object)null) { s.Img.sprite = val2; } s.FlipY = ((variantView.Deviant && ConfigSettings.DeviantFlipIcon.Value) ? (-1f) : 1f); } } private float WindFor(string groupKey) { if (!ConfigSettings.JesterWindUpShake.Value || string.IsNullOrEmpty(groupKey)) { return 0f; } if (!_windByGroup.TryGetValue(groupKey, out var value)) { return 0f; } return value; } private static float EaseOutBack(float x) { if (x >= 1f) { return 1f; } float num = x - 1f; return 1f + 2.70158f * num * num * num + 1.70158f * num * num; } public void SetMobs(string[] outside, string[] inside) { _distByGroup.Clear(); _distByVariant.Clear(); _windByGroup.Clear(); UpdateDistances(outside, outsideRail: true); UpdateDistances(inside, outsideRail: false); TriggerHurt(outside, outsideRail: true); TriggerHurt(inside, outsideRail: false); string text = JoinSorted(outside) + "||" + JoinSorted(inside); if (!(text == _sigMobs)) { _sigMobs = text; RebuildRail(_left, outside, growLeft: true); RebuildRail(_right, inside, growLeft: false); } } private static string SideKey(bool outsideRail, string groupKey) { return (outsideRail ? "o|" : "i|") + groupKey; } private static string VariantKey(bool outsideRail, Desc d) { return SideKey(outsideRail, d.GroupKey) + "#" + d.IconKey + "#" + d.Rank; } public void FlashMonster(string rawName, bool outside) { try { if (ConfigSettings.DamageFlash.Value && !string.IsNullOrEmpty(rawName)) { Desc desc = Parse(rawName); if (!string.IsNullOrEmpty(desc.GroupKey) && _byGroup.TryGetValue(SideKey(outside, desc.GroupKey), out var value) && value != null && (Object)(object)value.Rt != (Object)null) { value.HurtFlash = 1f; } } } catch { } } private void TriggerHurt(string[] arr, bool outsideRail) { if (arr == null || !ConfigSettings.DamageFlash.Value) { return; } foreach (string text in arr) { if (text != null && text.IndexOf("+Hurt", StringComparison.OrdinalIgnoreCase) >= 0) { Desc desc = Parse(text); if (!string.IsNullOrEmpty(desc.GroupKey) && _byGroup.TryGetValue(SideKey(outsideRail, desc.GroupKey), out var value) && value != null && (Object)(object)value.Rt != (Object)null) { value.HurtFlash = 1f; } } } } private void UpdateDistances(string[] arr, bool outsideRail) { if (arr == null) { return; } for (int i = 0; i < arr.Length; i++) { Desc desc = Parse(arr[i]); if (desc.WindLevel >= 0 && !string.IsNullOrEmpty(desc.GroupKey)) { _windByGroup[SideKey(outsideRail, desc.GroupKey)] = Mathf.Clamp01((float)desc.WindLevel / 9f); } if (!(desc.Dist < 0f) && !string.IsNullOrEmpty(desc.GroupKey)) { string key = SideKey(outsideRail, desc.GroupKey); if (!_distByGroup.TryGetValue(key, out var value) || desc.Dist < value) { _distByGroup[key] = desc.Dist; } string key2 = VariantKey(outsideRail, desc); if (!_distByVariant.TryGetValue(key2, out var value2) || desc.Dist < value2) { _distByVariant[key2] = desc.Dist; } } } } private static string StripVolatile(string s) { if (string.IsNullOrEmpty(s)) { return s; } s = Regex.Replace(s, "\\s*@\\d+\\s*$", ""); s = Regex.Replace(s, "\\+hurt", "", RegexOptions.IgnoreCase); s = Regex.Replace(s, "\\+w\\d", "", RegexOptions.IgnoreCase); return s; } public void SetTraps(string[] traps) { UpdateTrapDistances(traps); string text = JoinSorted(traps); if (!(text == _sigTraps)) { _sigTraps = text; RebuildTraps(traps); } } private void UpdateTrapDistances(string[] traps) { if (traps == null) { return; } for (int i = 0; i < traps.Length; i++) { Desc desc = Parse(traps[i]); string text = TrapIcon(desc.Name); if (text != null && !(desc.Dist < 0f) && (!_distByGroup.TryGetValue(text, out var value) || desc.Dist < value)) { _distByGroup[text] = desc.Dist; } } } private static string TrapIcon(string name) { string text = Norm(name); if (text.Contains("turret") || text.Contains("турел")) { return "turret"; } if (text.Contains("mine") || text.Contains("мин")) { return "landmine"; } if (text.Contains("spike") || text.Contains("шип")) { return "spiketrap"; } return null; } private static string JoinSorted(string[] arr) { if (arr == null || arr.Length == 0) { return ""; } string[] array = new string[arr.Length]; for (int i = 0; i < arr.Length; i++) { array[i] = StripVolatile(arr[i]); } Array.Sort(array, (IComparer?)StringComparer.Ordinal); return string.Join("|", array); } private static string Norm(string s) { StringBuilder stringBuilder = new StringBuilder(); string text = (s ?? "").ToLowerInvariant(); foreach (char c in text) { if ((c >= 'a' && c <= 'z') || (c >= 'а' && c <= 'я') || c == '+') { stringBuilder.Append(c); } } return stringBuilder.ToString(); } private static bool Hidden(string name) { string text = (name ?? "").ToLowerInvariant(); if (text.Contains("+turret") || text.Contains("slayer")) { return false; } string text2 = Norm(name); string[] hideKeys = HideKeys; foreach (string value in hideKeys) { if (text2.Contains(value)) { return true; } } return false; } private static string Canon(string name) { string text = Norm(name); if (text.Contains("nut")) { return "Nutcracker"; } if (text.Contains("manti")) { return "Manticoil"; } if (text.Contains("toil") || text.Contains("spring") || text.Contains("coil")) { return "Coil-Head"; } if (text.Contains("hoard") || text.Contains("kamikaz")) { return "Hoarding bug"; } return name; } private static string IconFor(string baseName) { string text = Norm(baseName); if (text.Contains("masked") || text.Contains("mimic")) { return "masked"; } if (text.Contains("spring") || text.Contains("coil")) { return "coil"; } if (text.Contains("nutcracker")) { return "nutcracker"; } if (text.Contains("spider")) { return "spider"; } if (text.Contains("flowerman") || text.Contains("bracken")) { return "bracken"; } if (text.Contains("crawler") || text.Contains("thumper")) { return "thumper"; } if (text.Contains("hoard")) { return "hoardingbug"; } if (text.Contains("centipede") || text.Contains("snare")) { return "snareflea"; } if (text.Contains("jester")) { return "jester"; } if (text.Contains("blob") || text.Contains("hygrodere")) { return "hygrodere"; } if (text.Contains("girl") || text.Contains("ghost")) { return "ghostgirl"; } if (text.Contains("puffer") || text.Contains("spore")) { return "sporelizard"; } if (text.Contains("hornet") || text.Contains("butlerbees")) { return "maskhornets"; } if (text.Contains("butler")) { return "butler"; } if (text.Contains("mouthdog") || text.Contains("eyeless")) { return "eyelessdog"; } if (text.Contains("sapsucker") || text.Contains("kiwi")) { return "sapsucker"; } if (text.Contains("forest") || text.Contains("giant")) { return "forestkeeper"; } if (text.Contains("leviathan")) { return "leviathan"; } if (text.Contains("baboon")) { return "baboonhawk"; } if (text.Contains("oldbird") || text.Contains("radmech")) { return "oldbird"; } if (text.Contains("tulip") || text.Contains("flowersnake")) { return "tulip"; } if (text.Contains("bushwolf") || text.Contains("kidnapper") || text.Contains("fox")) { return "kidnapper"; } if (text.Contains("barber") || text.Contains("surgeon") || text.Contains("claysurgeon")) { return "barber"; } if (text.Contains("maneater") || text.Contains("cavedweller")) { return "maneater"; } if (text.Contains("cadaverbloom")) { return "cadaverbloom"; } if (text.Contains("cadaver")) { return "cadaver"; } if (text.Contains("feiopar")) { return "feiopar"; } if (text.Contains("gunkfish") || text.Contains("gunk") || text.Contains("backwater") || text.Contains("stingray")) { return "gunkfish"; } if (text.Contains("manticoil")) { return "manticoil"; } if (text.Contains("redlocust")) { return "redlocust"; } if (text.Contains("lasso")) { return "lassoman"; } return null; } private static void LogNoIcon(string raw, string iconKey) { if (!string.IsNullOrEmpty(raw) && _loggedNoIcon.Add(raw)) { string text = ((iconKey == null) ? "нет маппинга имени → иконки" : ("нет/битый спрайт '" + iconKey + "'")); ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[no-icon] монстр \"" + raw + "\" не показан (" + text + "). Пришли эту строку — добавлю иконку/алиас.")); } } } private static Desc Parse(string entry) { string text = entry ?? ""; float dist = -1f; Match match = Regex.Match(text, "\\s*@(\\d+)\\s*$"); if (match.Success) { if (int.TryParse(match.Groups[1].Value, out var result)) { dist = result; } text = text.Substring(0, match.Index); } Match match2 = Regex.Match(text, "^(.*?)(?:\\s+x(\\d+))?$"); string text2 = (match2.Success ? match2.Groups[1].Value.Trim() : text); int result2 = 1; if (match2.Success && match2.Groups[2].Success) { int.TryParse(match2.Groups[2].Value, out result2); } string text3 = text2.ToLowerInvariant(); bool flag = text3.Contains("+turret") || text3.Contains("toil"); bool slayer = text3.Contains("slayer"); bool flag2 = text3.Contains("kamikaz"); bool aggro = text3.Contains("+aggro"); bool angry = text3.Contains("+angry"); bool adult = text3.Contains("+adult"); bool attack = text3.Contains("+attack"); bool ceiling = text3.Contains("+ceiling"); bool frozen = text3.Contains("+frozen"); bool scanned = text3.Contains("+scanned"); bool firing = text3.Contains("+firing"); bool hurt = text3.Contains("+hurt"); bool deviant = text3.Contains("+deviant"); int result3 = -1; Match match3 = Regex.Match(text3, "\\+w(\\d)"); if (match3.Success) { int.TryParse(match3.Groups[1].Value, out result3); } string name = Regex.Replace(text2, "\\+turret|\\+slayer|\\+aggro|\\+angry|\\+adult|\\+attack|\\+ceiling|\\+frozen|\\+scanned|\\+firing|\\+hurt|\\+deviant|\\+w\\d", "", RegexOptions.IgnoreCase).Trim(); name = Canon(name); string text4 = Norm(name); if (text4.Length == 0) { text4 = text3; } bool flag3 = text4.Contains("manticoil"); bool flag4 = !flag3 && (text4.Contains("coil") || text4.Contains("spring")); string text5; if (flag && flag3) { text5 = "mantitoil"; } else if (flag && flag4) { text5 = "toilhead"; } else { text5 = IconFor(name); if (text5 == null && flag2) { text5 = "hoardingbug"; } } Desc desc = new Desc { Name = text2, Cnt = Math.Max(1, result2), Turret = flag, Slayer = slayer, Kamikaze = flag2, Aggro = aggro, Angry = angry, Adult = adult, Attack = attack, Ceiling = ceiling, Frozen = frozen, Scanned = scanned, Firing = firing, Hurt = hurt, Deviant = deviant, WindLevel = result3, Dist = dist, GroupKey = text4, IconKey = text5 }; desc.IconKey = StateVariant(text5, desc); return desc; } private static string StateVariant(string icon, Desc d) { if (string.IsNullOrEmpty(icon)) { return icon; } string text = null; switch (icon) { case "snareflea": text = (d.Ceiling ? "snareflea_ceiling" : null); break; case "jester": text = (d.Angry ? "jester_angry" : null); break; case "nutcracker": text = (d.Attack ? "nutcracker_attack" : null); break; case "hoardingbug": text = (d.Aggro ? "hoardingbug_aggro" : null); break; case "maneater": text = (d.Adult ? "maneater_adult" : null); break; } if (text == null) { return icon; } if (!((Object)(object)SpriteBank.Get(text) != (Object)null)) { return icon; } return text; } private void ClearRail(RectTransform rail) { _sway.RemoveAll((SwayItem x) => (Object)(object)x.Rt == (Object)null || ((Transform)x.Rt).IsChildOf((Transform)(object)rail)); List list = new List(); foreach (KeyValuePair item in _byGroup) { if (item.Value == null || (Object)(object)item.Value.Rt == (Object)null || ((Transform)item.Value.Rt).IsChildOf((Transform)(object)rail)) { list.Add(item.Key); } } foreach (string item2 in list) { _byGroup.Remove(item2); } for (int num = ((Transform)rail).childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)((Transform)rail).GetChild(num)).gameObject); } } private void RebuildRail(RectTransform rail, string[] list, bool growLeft) { //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) ClearRail(rail); List list2 = (growLeft ? _firingLeft : _firingRight); TrapFireEffect trapFireEffect = (growLeft ? _fireLeft : _fireRight); list2.Clear(); if ((Object)(object)trapFireEffect != (Object)null) { trapFireEffect.Firing = false; } if (list == null || list.Length == 0) { return; } List list3 = new List(); Dictionary dictionary = new Dictionary(); foreach (string text in list) { if (Hidden(text)) { continue; } Desc d = Parse(text); if (Gate.RequireScan && !d.Scanned) { continue; } if (d.IconKey == null || (Object)(object)SpriteBank.Get(d.IconKey) == (Object)null) { LogNoIcon(text, d.IconKey); continue; } if (!dictionary.TryGetValue(d.GroupKey, out var value)) { value = new Group { Key = d.GroupKey }; dictionary[d.GroupKey] = value; list3.Add(value); } Desc desc = value.Variants.Find((Desc v) => v.Rank == d.Rank && v.IconKey == d.IconKey); if (desc != null) { desc.Cnt += d.Cnt; } else { value.Variants.Add(d); } value.Total += d.Cnt; } bool value2 = ConfigSettings.NearestVariantOnly.Value; list3.Sort((Group a, Group b) => b.Total.CompareTo(a.Total)); bool value3 = ConfigSettings.ScaleMonstersByCount.Value; float num = 0f; foreach (Group item in list3) { float scale = 1f; float num2 = 5f; if (value3) { int num3 = Mathf.Clamp(item.Total - 1, 0, 8); scale = 1f + (float)num3 * 0.1f; num2 = 5f + (float)num3 * 2.2f; } item.Variants.Sort((Desc a, Desc b) => a.Rank.CompareTo(b.Rank)); if (value2 && item.Variants.Count > 0) { List list4 = new List(item.Variants.Count); bool flag = false; bool hurt = false; foreach (Desc variant in item.Variants) { list4.Add(new VariantView { IconKey = variant.IconKey, Angry = (variant.Slayer || variant.Kamikaze), Deviant = variant.Deviant, DistKey = VariantKey(growLeft, variant) }); if (variant.Firing) { flag = true; } if (variant.Hurt) { hurt = true; } } Desc desc2 = item.Variants[0]; float amp = (desc2.Frozen ? 0f : num2); RectTransform val = MakeIcon(rail, desc2.IconKey, desc2.Slayer || desc2.Kamikaze, item.Key.GetHashCode(), scale, amp, SideKey(growLeft, item.Key), hurt, desc2.Deviant, list4); val.anchoredPosition = new Vector2(growLeft ? 0f : 0f, num); if (flag) { list2.Add(val); } if (!value3 && item.Total > 1) { AddCountBadge(rail, item.Total, growLeft, 21f, num); } num -= 48f; continue; } float num4 = 0f; foreach (Desc variant2 in item.Variants) { float amp2 = (variant2.Frozen ? 0f : num2); RectTransform val2 = MakeIcon(rail, variant2.IconKey, variant2.Slayer || variant2.Kamikaze, item.Key.GetHashCode(), scale, amp2, SideKey(growLeft, item.Key), variant2.Hurt, variant2.Deviant); val2.anchoredPosition = new Vector2(growLeft ? (0f - num4) : num4, num); if (variant2.Firing) { list2.Add(val2); } num4 += 21f; } if (!value3 && item.Total > 1) { AddCountBadge(rail, item.Total, growLeft, num4, num); } num -= 48f; } if ((Object)(object)trapFireEffect != (Object)null) { trapFireEffect.Firing = list2.Count > 0; } } private void RebuildTraps(string[] traps) { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01fd: 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_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) ClearRail(_traps); TurretIcons.Clear(); if (traps == null || traps.Length == 0) { return; } List list = new List(); Dictionary dictionary = new Dictionary(); for (int i = 0; i < traps.Length; i++) { Desc desc = Parse(traps[i]); string text = TrapIcon(desc.Name); if (text != null && !((Object)(object)SpriteBank.Get(text) == (Object)null)) { if (!dictionary.ContainsKey(text)) { dictionary[text] = 0; list.Add(text); } dictionary[text] += desc.Cnt; } } if (list.Count == 0) { return; } bool value = ConfigSettings.ScaleMonstersByCount.Value; float num = 52f; float num2 = (0f - ((float)list.Count * num - 10f)) / 2f + 21f; Vector2 val3 = default(Vector2); for (int j = 0; j < list.Count; j++) { string text2 = list[j]; int num3 = dictionary[text2]; float scale = 1f; float amp = 5f; if (value) { int num4 = Mathf.Clamp(num3 - 1, 0, 8); scale = 1f + (float)num4 * 0.1f; amp = 5f + (float)num4 * 2.2f; } RectTransform val = MakeIcon(_traps, text2, angry: false, j * 17, scale, amp, text2); val.anchoredPosition = new Vector2(num2 + (float)j * num, -20f); if (text2 == "turret") { TurretIcons.Add(val); } if (!value && num3 > 1) { TextMeshProUGUI val2 = _mgr.MakeText(((Component)val).transform, num3.ToString(), 26f, CountColor, (TextAlignmentOptions)514, bold: true, big: true); ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)val2).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 0f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.pivot = new Vector2(0.5f, 1f); rectTransform.sizeDelta = new Vector2(48f, 30f); rectTransform.anchoredPosition = new Vector2(0f, 2f); _mgr.AddPerspective((Graphic)(object)val2, continuous: false); } } } private void AddCountBadge(RectTransform rail, int total, bool growLeft, float x, float y) { //IL_0014: 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_0053: 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_0079: 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) TextMeshProUGUI val = _mgr.MakeText((Transform)(object)rail, total.ToString(), 26f, CountColor, (TextAlignmentOptions)514, bold: true, big: true); ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)0; RectTransform rectTransform = ((TMP_Text)val).rectTransform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(34f, 30f); float num = (growLeft ? (0f - (x - 21f)) : (x - 21f)) + (growLeft ? (-11f) : 11f); float num2 = y - 21f + 10f; rectTransform.anchoredPosition = new Vector2(num, num2); _mgr.AddPerspective((Graphic)(object)val, continuous: false); } private RectTransform MakeIcon(RectTransform rail, string iconKey, bool angry, int seed, float scale, float amp, string groupKey = null, bool hurt = false, bool deviant = false, List variants = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0030: 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_0049: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) GameObject obj = OverlayManager.NewUI("Mob_" + iconKey, (Transform)(object)rail); RectTransform val = (RectTransform)obj.transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(42f, 42f); ((Transform)val).localScale = Vector3.zero; Image val3 = obj.AddComponent(); Sprite val4 = (angry ? SpriteBank.GetBloody(iconKey) : null); val3.sprite = (((Object)(object)val4 != (Object)null) ? val4 : SpriteBank.Get(iconKey)); val3.preserveAspect = true; ((Graphic)val3).raycastTarget = false; _mgr.AddPerspective((Graphic)(object)val3, continuous: true); SwayItem swayItem = new SwayItem { Rt = val, Img = val3, GroupKey = groupKey, Speed = 2f + (float)(Mathf.Abs(seed) % 7) * 0.15f, Phase = (float)(Mathf.Abs(seed) % 13) * 0.5f, Amp = amp, Scale = scale, Appear = 0f, BaseColor = Color.white, HurtFlash = (hurt ? 1f : 0f), FlipY = ((deviant && ConfigSettings.DeviantFlipIcon.Value) ? (-1f) : 1f), Variants = ((variants != null && variants.Count > 1) ? variants : null) }; _sway.Add(swayItem); _byGroup[groupKey ?? ""] = swayItem; return val; } } public class PerspectiveWarp : BaseMeshEffect { public RectTransform Panel; public float Width = 340f; public float Strength = 0.16f; public bool Continuous; private void LateUpdate() { if (Continuous && (Object)(object)((BaseMeshEffect)this).graphic != (Object)null) { ((BaseMeshEffect)this).graphic.SetVerticesDirty(); } } public override void ModifyMesh(VertexHelper vh) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0032: 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_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_0063: 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_006c: 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_00d6: 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_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_00ed: Unknown result type (might be due to invalid IL or missing references) if (((UIBehaviour)this).IsActive() && !((Object)(object)Panel == (Object)null) && !(Strength <= 0f)) { RectTransform val = (RectTransform)((Component)this).transform; UIVertex val2 = default(UIVertex); int currentVertCount = vh.currentVertCount; for (int i = 0; i < currentVertCount; i++) { vh.PopulateUIVertex(ref val2, i); Vector3 val3 = ((Transform)val).TransformPoint(val2.position); Vector3 val4 = ((Transform)Panel).InverseTransformPoint(val3); float num = Mathf.Clamp01((0f - val4.x) / Width); val4.y *= Mathf.Lerp(1f, 1f - Strength, num); val4.x *= Mathf.Lerp(1f, 1f - Strength * 0.35f, num); Vector3 val5 = ((Transform)Panel).TransformPoint(val4); val2.position = ((Transform)val).InverseTransformPoint(val5); vh.SetUIVertex(val2, i); } } } } public class PixbitFlicker : MonoBehaviour { private Image _img; private float _period = 1.1f; private float _phase; public bool Master = true; public void Init(Image img, float period, float phase) { _img = img; _period = Mathf.Max(0.2f, period); _phase = phase; } private void Update() { if ((Object)(object)_img == (Object)null) { return; } if (!Master) { if (((Behaviour)_img).enabled) { ((Behaviour)_img).enabled = false; } return; } float num = Mathf.Repeat(Time.unscaledTime / _period + _phase, 1f); bool flag = num < 0.5f || num >= 0.72f; if (((Behaviour)_img).enabled != flag) { ((Behaviour)_img).enabled = flag; } } } public class ScanlineUV : MonoBehaviour { public RawImage Img; public float LinePx = 4f; private void LateUpdate() { //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_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Img == (Object)null)) { Rect rect = ((RectTransform)((Component)this).transform).rect; float num = Mathf.Max(1f, ((Rect)(ref rect)).height / LinePx); Img.uvRect = new Rect(0f, 0f, 1f, num); } } } public class TickerWidget : MonoBehaviour { private const float Speed = 60f; private const float Gap = 48f; private RectTransform _track; private TextMeshProUGUI _copy1; private TextMeshProUGUI _copy2; private float _copyWidth; private float _offset; private string _lastText; private bool _dirtyWidth; public void Init(RectTransform track, TextMeshProUGUI copy1, TextMeshProUGUI copy2) { _track = track; _copy1 = copy1; _copy2 = copy2; } public void SetContent(string text) { if (!(text == _lastText)) { _lastText = text; ((TMP_Text)_copy1).text = text; ((TMP_Text)_copy2).text = text; _dirtyWidth = true; } } private void LateUpdate() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_copy1 == (Object)null || (Object)(object)_track == (Object)null) { return; } if (_dirtyWidth) { _dirtyWidth = false; Vector2 preferredValues = ((TMP_Text)_copy1).GetPreferredValues(((TMP_Text)_copy1).text); float num = Mathf.Max(40f, preferredValues.x); _copyWidth = num + 48f; ((TMP_Text)_copy1).rectTransform.sizeDelta = new Vector2(num + 4f, preferredValues.y); ((TMP_Text)_copy2).rectTransform.sizeDelta = new Vector2(num + 4f, preferredValues.y); ((TMP_Text)_copy2).rectTransform.anchoredPosition = new Vector2(_copyWidth, 0f); if (_offset <= 0f - _copyWidth) { _offset = 0f; } } _offset -= 60f * Time.unscaledDeltaTime; if (_offset <= 0f - _copyWidth) { _offset += _copyWidth; } _track.anchoredPosition = new Vector2(_offset, 0f); } } public class TMPPerspective : MonoBehaviour { public RectTransform Panel; public float Width = 340f; public float Strength = 0.16f; public bool Continuous; private TMP_Text _tmp; private bool _busy; private void Awake() { _tmp = ((Component)this).GetComponent(); } private void LateUpdate() { if (Continuous && (Object)(object)_tmp != (Object)null && Strength > 0f) { _tmp.ForceMeshUpdate(false, false); } } private void OnEnable() { TMPro_EventManager.TEXT_CHANGED_EVENT.Add((Action)OnChanged); if ((Object)(object)_tmp != (Object)null) { ((Graphic)_tmp).SetVerticesDirty(); } } private void OnDisable() { TMPro_EventManager.TEXT_CHANGED_EVENT.Remove((Action)OnChanged); } private void OnChanged(Object obj) { if (obj == (Object)(object)_tmp) { Warp(); } } private void Warp() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //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_0096: 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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_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 (_busy || (Object)(object)_tmp == (Object)null || (Object)(object)Panel == (Object)null || Strength <= 0f) { return; } _busy = true; try { TMP_TextInfo textInfo = _tmp.textInfo; if (textInfo == null || textInfo.meshInfo == null) { return; } RectTransform val = (RectTransform)((Component)this).transform; for (int i = 0; i < textInfo.meshInfo.Length; i++) { Vector3[] vertices = textInfo.meshInfo[i].vertices; if (vertices != null) { for (int j = 0; j < vertices.Length; j++) { Vector3 val2 = ((Transform)val).TransformPoint(vertices[j]); Vector3 val3 = ((Transform)Panel).InverseTransformPoint(val2); float num = Mathf.Clamp01((0f - val3.x) / Width); val3.y *= Mathf.Lerp(1f, 1f - Strength, num); val3.x *= Mathf.Lerp(1f, 1f - Strength * 0.35f, num); vertices[j] = ((Transform)val).InverseTransformPoint(((Transform)Panel).TransformPoint(val3)); } Mesh mesh = textInfo.meshInfo[i].mesh; if ((Object)(object)mesh != (Object)null) { mesh.vertices = vertices; _tmp.UpdateGeometry(mesh, i); } } } } catch { } finally { _busy = false; } } } public class TrapFireEffect : MonoBehaviour { private class Tracer { public RectTransform Rt; public Image Img; public float T; public Vector2 Start; public float DirY; } private const int PoolSize = 8; private const float TracerLife = 0.3f; private const float SpawnEvery = 0.26f; private const float FlyDistance = 84f; private readonly List _pool = new List(8); private RectTransform _layer; private TextMeshProUGUI _text; private Color _baseColor; private float _spawnT; public bool Firing; public List Emitters; public void Init(RectTransform layer, TextMeshProUGUI text, Color baseColor) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_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_004b: 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_0057: Expected O, but got Unknown //IL_006a: 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_0081: 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_00a0: 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) _layer = layer; _text = text; _baseColor = baseColor; Vector2 val3 = default(Vector2); for (int i = 0; i < 8; i++) { GameObject val = new GameObject("Tracer", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)_layer, false); RectTransform val2 = (RectTransform)val.transform; ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(1f, 0.5f); val2.sizeDelta = new Vector2(42f, 3f); Image val4 = val.AddComponent(); ((Graphic)val4).color = OverlayStyle.FromHex("FFD246"); ((Graphic)val4).raycastTarget = false; val.SetActive(false); _pool.Add(new Tracer { Rt = val2, Img = val4, T = -1f }); } } private void Update() { try { UpdateInner(); } catch { } } private void UpdateInner() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_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_009b: 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_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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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) if ((Object)(object)_layer == (Object)null) { return; } float unscaledDeltaTime = Time.unscaledDeltaTime; if (Firing) { _spawnT += unscaledDeltaTime; if (_spawnT >= 0.26f) { _spawnT = 0f; if (Random.value < 0.8f) { Spawn(); } } if ((Object)(object)_text != (Object)null) { float num = 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 14f); ((Graphic)_text).color = Color.Lerp(_baseColor, Color.white, num * 0.6f); } } else if ((Object)(object)_text != (Object)null && ((Graphic)_text).color != _baseColor) { ((Graphic)_text).color = _baseColor; } for (int i = 0; i < _pool.Count; i++) { Tracer tracer = _pool[i]; if (!(tracer.T < 0f)) { tracer.T += unscaledDeltaTime / 0.3f; if (tracer.T >= 1f) { tracer.T = -1f; ((Component)tracer.Rt).gameObject.SetActive(false); continue; } tracer.Rt.anchoredPosition = tracer.Start + new Vector2(-84f * tracer.T, tracer.DirY * tracer.T); float num2 = ((tracer.T < 0.18f) ? (tracer.T / 0.18f) : (1f - (tracer.T - 0.18f) / 0.82f)); Color color = ((Graphic)tracer.Img).color; color.a = num2 * 0.95f; ((Graphic)tracer.Img).color = color; } } } private void Spawn() { //IL_0093: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _pool.Count; i++) { Tracer tracer = _pool[i]; if (tracer.T >= 0f) { continue; } if (Emitters != null && Emitters.Count > 0) { RectTransform val = Emitters[Random.Range(0, Emitters.Count)]; if ((Object)(object)val == (Object)null) { break; } tracer.Start = val.anchoredPosition + new Vector2(-16f, Random.Range(2f, 16f)); } else { Rect rect = _layer.rect; tracer.Start = new Vector2(Random.Range(0f, ((Rect)(ref rect)).width * 0.45f), Random.Range((0f - ((Rect)(ref rect)).height) * 0.25f, ((Rect)(ref rect)).height * 0.25f)); } tracer.DirY = Random.Range(-8f, 8f); tracer.T = 0f; tracer.Rt.anchoredPosition = tracer.Start; ((Transform)tracer.Rt).localRotation = Quaternion.Euler(0f, 0f, Random.Range(-6f, 6f)); ((Component)tracer.Rt).gameObject.SetActive(true); break; } } } public class VictoryWidget : MonoBehaviour { private class DayInfo { public string Moon; public readonly List Events = new List(); public readonly List Deaths = new List(); } private OverlayManager _mgr; private GameObject _content; private static readonly Dictionary KillerRu = new Dictionary { ["Fall"] = "Падение", ["Drowning"] = "Утопление", ["Suffocation"] = "Удушье", ["Fire"] = "Огонь", ["Shock"] = "Ток", ["Crushed"] = "Раздавлен", ["Unknown"] = "Неизвестно" }; public void Init(OverlayManager mgr) { _mgr = mgr; ((Component)this).gameObject.SetActive(false); } public void Show(BridgePayload p, int timerSec) { BuildContent(p, timerSec); ((Component)this).gameObject.SetActive(true); _mgr.AddPerspectiveToTree(((Component)this).transform); } public void Hide() { ((Component)this).gameObject.SetActive(false); } private static string LocKiller(string s) { if (ConfigSettings.RussianActive && s != null && KillerRu.TryGetValue(s.Trim(), out var value)) { return value; } return s; } private void BuildContent(BridgePayload p, int timerSec) { //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_0075: 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_00c1: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_07ab: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_content != (Object)null) { Object.Destroy((Object)(object)_content); } OverlayStyle style = _mgr.Style; _content = _mgr.MakeCol(((Component)this).transform, 4f); GameObject val = new GameObject("Divider", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_content.transform, false); Image obj = val.AddComponent(); ((Graphic)obj).color = style.Frame; ((Graphic)obj).raycastTarget = false; val.AddComponent().preferredHeight = 3f; _mgr.MakeText(_content.transform, Localization.T("vicStamp"), 14f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)514, bold: true, big: true); _mgr.MakeText(_content.transform, Localization.T("vicTitle"), 34f, style.Danger, (TextAlignmentOptions)514, bold: true, big: true); _mgr.MakeText(_content.transform, Localization.T("vicSub"), 11f, style.Text, (TextAlignmentOptions)514); string text = Localization.T("vicTime") + " " + OverlayManager.FmtTime(timerSec) + " " + string.Format("{0} ${1} ", Localization.T("vicLoot"), p?.shipLoot ?? 0) + string.Format("{0} {1}", Localization.T("vicDeaths"), p?.deaths ?? 0); _mgr.MakeText(_content.transform, text, 13f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)514); if (p != null && p.soldLoot > 0) { _mgr.MakeText(_content.transform, string.Format("{0} ${1}", Localization.T("vicSold"), p.soldLoot), 13f, OverlayStyle.FromHex("FFB000"), (TextAlignmentOptions)514); } RunInfo runInfo = p?.run; if (runInfo == null) { return; } if (runInfo.quotas != null && runInfo.quotas.Length != 0) { Section(Localization.T("vicQuotas")); StringBuilder stringBuilder = new StringBuilder(); RunQuota[] quotas = runInfo.quotas; foreach (RunQuota runQuota in quotas) { if (stringBuilder.Length > 0) { stringBuilder.Append('\n'); } stringBuilder.Append(("Q" + runQuota.i).PadRight(4)).Append(("$" + runQuota.money).PadLeft(7)).Append(OverlayManager.FmtTime(runQuota.sec).PadLeft(9)) .Append(("X" + runQuota.deaths).PadLeft(5)); } Body(stringBuilder.ToString()); } if (runInfo.moons != null && runInfo.moons.Length != 0) { Section(Localization.T("vicMoons")); StringBuilder stringBuilder2 = new StringBuilder(); int num = 0; RunMoon[] moons = runInfo.moons; foreach (RunMoon runMoon in moons) { if (num++ >= 6) { break; } if (stringBuilder2.Length > 0) { stringBuilder2.Append('\n'); } string text2 = runMoon.name ?? "?"; if (text2.Length > 13) { text2 = text2.Substring(0, 13); } stringBuilder2.Append((num == 1) ? "* " : " ").Append(text2.PadRight(14)).Append(("$" + runMoon.profit).PadLeft(7)) .Append(("x" + runMoon.visits).PadLeft(4)); } Body(stringBuilder2.ToString()); } if (runInfo.monsters != null && runInfo.monsters.Length != 0) { Section(Localization.T("vicMonsters")); StringBuilder stringBuilder3 = new StringBuilder(); int num2 = 0; RunMonster[] monsters = runInfo.monsters; foreach (RunMonster runMonster in monsters) { if (num2++ >= 8) { break; } if (stringBuilder3.Length > 0) { stringBuilder3.Append('\n'); } string text3 = runMonster.name ?? "?"; if (text3.Length > 18) { text3 = text3.Substring(0, 18); } stringBuilder3.Append(text3.PadRight(19)).Append(("x" + runMonster.count).PadLeft(4)); } Body(stringBuilder3.ToString()); } if (runInfo.timeline == null || runInfo.timeline.Length == 0) { return; } Section(Localization.T("vicTimeline")); SortedDictionary sortedDictionary = new SortedDictionary(); string[] timeline = runInfo.timeline; for (int i = 0; i < timeline.Length; i++) { string[] array = (timeline[i] ?? "").Split(new char[1] { '|' }, 3); if (array.Length >= 3 && int.TryParse(array[0], out var result)) { if (!sortedDictionary.TryGetValue(result, out var value)) { value = (sortedDictionary[result] = new DayInfo()); } switch (array[1]) { case "day": value.Moon = array[2]; break; case "event": value.Events.Add(array[2]); break; case "death": { int num3 = array[2].IndexOf('@'); value.Deaths.Add(LocKiller((num3 > 0) ? array[2].Substring(0, num3) : array[2])); break; } } } } StringBuilder stringBuilder4 = new StringBuilder(); foreach (KeyValuePair item in sortedDictionary) { if (stringBuilder4.Length > 0) { stringBuilder4.Append('\n'); } DayInfo value2 = item.Value; stringBuilder4.Append('D').Append(item.Key).Append(' ') .Append(value2.Moon ?? "?"); if (value2.Events.Count > 0) { stringBuilder4.Append(" ").Append(Localization.T("vicEvent")).Append(": ") .Append(OverlayManager.Esc(string.Join(", ", value2.Events))) .Append(""); } if (value2.Deaths.Count > 0) { stringBuilder4.Append(" ").Append(Localization.T("vicDeath")).Append(": ") .Append(OverlayManager.Esc(string.Join(", ", value2.Deaths))) .Append(""); } else { stringBuilder4.Append(" ') .Append(Localization.T("vicNoLosses")) .Append(""); } } Body(stringBuilder4.ToString(), 11f); } private void Section(string title) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) _mgr.MakeText(_content.transform, title, 11f, _mgr.Style.Danger, (TextAlignmentOptions)514, bold: true); } private void Body(string text, float size = 12f) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) _mgr.MakeText(_content.transform, text, size, _mgr.Style.Text, (TextAlignmentOptions)513); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LCBridgeOverlay"; public const string PLUGIN_NAME = "LCBridgeOverlay"; public const string PLUGIN_VERSION = "1.7.0"; } }