using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BuildingRepair")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BuildingRepair")] [assembly: AssemblyTitle("BuildingRepair")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AutoBuildingRepair { public static class LocalizationHelper { public static string GetLanguage() { return PlayerPrefs.GetString("language", "English"); } public static bool IsRussian() { return GetLanguage().Equals("Russian", StringComparison.OrdinalIgnoreCase); } public static bool IsUkrainian() { return GetLanguage().Equals("Ukrainian", StringComparison.OrdinalIgnoreCase); } public static bool IsSpanish() { return GetLanguage().Equals("Spanish", StringComparison.OrdinalIgnoreCase); } public static string T(string english, string russian, string ukrainian, string spanish) { string language = GetLanguage(); if (language.Equals("Russian", StringComparison.OrdinalIgnoreCase)) { return russian; } if (language.Equals("Ukrainian", StringComparison.OrdinalIgnoreCase)) { return ukrainian; } if (language.Equals("Spanish", StringComparison.OrdinalIgnoreCase)) { return spanish; } return english; } } public class RepairTooltipTrigger : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public string Description = ""; public void OnPointerEnter(PointerEventData eventData) { if (!string.IsNullOrEmpty(Description)) { AutoRepairSettingsMenu.ShowTooltip(Description); } } public void OnPointerExit(PointerEventData eventData) { AutoRepairSettingsMenu.HideTooltip(); } } public class RepairTooltipFollower : MonoBehaviour { private RectTransform _rt; private RectTransform _canvasRt; private void Awake() { _rt = ((Component)this).GetComponent(); } private void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_canvasRt == (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null) { _canvasRt = ((Component)((Component)this).transform.parent).GetComponent(); } if ((Object)(object)_canvasRt == (Object)null) { return; } Vector2 val = Vector2.op_Implicit(Input.mousePosition); Vector2 val2 = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(_canvasRt, val, (Camera)null, ref val2)) { float num = 15f; float num2 = -15f; Rect rect = _rt.rect; float num3; if (!(((Rect)(ref rect)).width > 0f)) { num3 = 360f; } else { rect = _rt.rect; num3 = ((Rect)(ref rect)).width; } float num4 = num3; rect = _rt.rect; float num5; if (!(((Rect)(ref rect)).height > 0f)) { num5 = 75f; } else { rect = _rt.rect; num5 = ((Rect)(ref rect)).height; } float num6 = num5; rect = _canvasRt.rect; float num7 = ((Rect)(ref rect)).width / 2f; rect = _canvasRt.rect; float num8 = ((Rect)(ref rect)).height / 2f; float num9 = Mathf.Clamp(val2.x + num, 0f - num7, num7 - num4); float num10 = Mathf.Clamp(val2.y + num2, 0f - num8 + num6, num8); _rt.anchoredPosition = new Vector2(num9, num10); } } } public class RepairKeyBindListener : MonoBehaviour { private ConfigEntryBase _entry; private Text _text; private Image _btnImage; private Action _onFinished; private bool _isListening = false; private float _startTime; public static RepairKeyBindListener ActiveListener { get; private set; } public void StartListening(ConfigEntryBase entry, Text buttonText, Image btnImage, Action onFinished) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ActiveListener != (Object)null && (Object)(object)ActiveListener != (Object)(object)this) { ActiveListener.CancelListening(); } _entry = entry; _text = buttonText; _btnImage = btnImage; _onFinished = onFinished; _isListening = true; _startTime = Time.unscaledTime; ActiveListener = this; _text.text = LocalizationHelper.T("[ PRESS ANY KEY ]", "[ НАЖМИТЕ КЛАВИШУ ]", "[ НАТИСНІТЬ КЛАВІШУ ]", "[ PULSA UNA TECLA ]"); ((Graphic)_text).color = new Color(1f, 0.85f, 0.2f); if ((Object)(object)_btnImage != (Object)null) { ((Graphic)_btnImage).color = new Color(0.32f, 0.38f, 0.52f, 1f); } } public void CancelListening() { //IL_00aa: 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) _isListening = false; if ((Object)(object)ActiveListener == (Object)(object)this) { ActiveListener = null; } if ((Object)(object)_text != (Object)null && _entry != null) { _text.text = _entry.BoxedValue?.ToString().ToUpper() ?? "NONE"; ((Graphic)_text).color = Color.white; } if ((Object)(object)_btnImage != (Object)null) { ((Graphic)_btnImage).color = new Color(0.2f, 0.25f, 0.35f, 1f); } } private void Update() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_007b: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (!_isListening || Time.unscaledTime - _startTime < 0.08f) { return; } if (Input.GetKeyDown((KeyCode)27)) { CancelListening(); } else { if (!Input.anyKeyDown) { return; } foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if ((int)value == 0 || (int)value == 323 || !Input.GetKeyDown(value)) { continue; } ApplyKey(value); break; } } } private void OnGUI() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!_isListening) { return; } Event current = Event.current; if (current != null && current.isKey && (int)current.type == 4) { if ((int)current.keyCode == 27) { CancelListening(); } else if ((int)current.keyCode > 0) { ApplyKey(current.keyCode); } } } private unsafe void ApplyKey(KeyCode key) { //IL_0007: 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_009b: Unknown result type (might be due to invalid IL or missing references) _entry.BoxedValue = key; _isListening = false; if ((Object)(object)ActiveListener == (Object)(object)this) { ActiveListener = null; } if ((Object)(object)_text != (Object)null) { _text.text = ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString().ToUpper(); ((Graphic)_text).color = Color.white; } if ((Object)(object)_btnImage != (Object)null) { ((Graphic)_btnImage).color = new Color(0.2f, 0.25f, 0.35f, 1f); } try { ConfigFile configInstance = AutoRepairSettingsMenu.ConfigInstance; if (configInstance != null) { configInstance.Save(); } } catch { } _onFinished?.Invoke(); } private void OnDisable() { if (_isListening) { CancelListening(); } } } public static class AutoRepairSettingsMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__8_0; internal void b__8_0() { ConfigFile configInstance = ConfigInstance; if (configInstance != null) { configInstance.Save(); } CloseMenu(); } } public static ConfigFile ConfigInstance; private static GameObject _settingsCanvas; private static GameObject _tooltipGO; private static Text _tooltipText; private static readonly List _uiRefreshCallbacks = new List(); public static bool IsOpen => (Object)(object)_settingsCanvas != (Object)null; public static void ToggleSettingsMenu() { if ((Object)(object)_settingsCanvas == (Object)null) { OpenMenu(); } else { CloseMenu(); } } public static void OpenMenu() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_00a0: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Expected O, but got Unknown if ((Object)(object)_settingsCanvas != (Object)null) { return; } _uiRefreshCallbacks.Clear(); _settingsCanvas = new GameObject("AutoRepairSettingsCanvas"); _settingsCanvas.layer = 5; Object.DontDestroyOnLoad((Object)(object)_settingsCanvas); Canvas val = _settingsCanvas.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 10000; _settingsCanvas.AddComponent(); _settingsCanvas.AddComponent(); GameObject val2 = MakeRect("Background", _settingsCanvas.transform, new Color(0.06f, 0.06f, 0.07f, 0.98f)); SetRect(val2, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(680f, 430f), Vector2.zero); Outline val3 = val2.AddComponent(); ((Shadow)val3).effectColor = new Color(0.3f, 0.3f, 0.3f, 1f); ((Shadow)val3).effectDistance = new Vector2(2f, -2f); string text = LocalizationHelper.T("AUTO REPAIR CONFIGURATION", "НАСТРОЙКИ АВТОПОЧИНКИ", "НАЛАШТУВАННЯ АВТОПОЧИНКИ", "CONFIGURACIÓN DE AUTORREPARACIÓN"); Text val4 = MakeText("Header", val2.transform, text, 20, new Color(1f, 0.72f, 0.15f), (FontStyle)1); SetRect(((Component)val4).gameObject, new Vector2(0f, 0.88f), new Vector2(1f, 1f), Vector2.zero, new Vector2(0f, -4f)); GameObject val5 = MakeRect("ScrollArea", val2.transform, new Color(0f, 0f, 0f, 0.5f)); SetRect(val5, new Vector2(0.03f, 0.16f), new Vector2(0.97f, 0.88f), Vector2.zero, Vector2.zero); GameObject val6 = MakeRect("Viewport", val5.transform, Color.clear); SetRect(val6, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); val6.AddComponent(); GameObject val7 = MakeRect("Content", val6.transform, Color.clear); RectTransform component = val7.GetComponent(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = Vector2.zero; VerticalLayoutGroup val8 = val7.AddComponent(); ((HorizontalOrVerticalLayoutGroup)val8).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val8).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val8).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val8).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val8).spacing = 5f; ((LayoutGroup)val8).padding = new RectOffset(10, 10, 6, 6); ContentSizeFitter val9 = val7.AddComponent(); val9.verticalFit = (FitMode)2; ScrollRect val10 = val5.AddComponent(); val10.content = component; val10.viewport = val6.GetComponent(); val10.horizontal = false; val10.vertical = true; val10.scrollSensitivity = 40f; GenerateConfigRows(val7.transform); GameObject val11 = MakeRect("CloseBtn", val2.transform, new Color(0.75f, 0.2f, 0.2f, 1f)); SetRect(val11, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(280f, 40f), new Vector2(0f, 32f)); string text2 = LocalizationHelper.T("CLOSE & SAVE", "ЗАКРЫТЬ И СОХРАНИТЬ", "ЗАКРИТИ ТА ЗБЕРЕГТИ", "CERRAR Y GUARDAR"); MakeText("CloseTxt", val11.transform, text2, 15, Color.white, (FontStyle)1); Button val12 = val11.AddComponent