using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using ComfortUI.Patches; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ComfortUI")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ComfortUI")] [assembly: AssemblyTitle("ComfortUI")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 ComfortUI { [BepInPlugin("com.pickteam.comfortui", "ComfortUI", "0.1.0")] public class ComfortUIPlugin : BasePlugin { public const string PluginGuid = "com.pickteam.comfortui"; public const string PluginName = "ComfortUI"; public const string PluginVersion = "0.1.0"; internal static ManualLogSource Logger; internal static Harmony HarmonyInstance; internal static string ModFolder; public override void Load() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown Logger = ((BasePlugin)this).Log; ModFolder = Path.GetDirectoryName(((object)this).GetType().Assembly.Location); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("ComfortUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("0.1.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ==="); } log.LogInfo(val); HarmonyInstance = new Harmony("com.pickteam.comfortui"); HarmonyInstance.PatchAll(); Patch_VendorSearch.Apply(HarmonyInstance); Patch_PlayerVendorSearch.Apply(HarmonyInstance); ((BasePlugin)this).Log.LogInfo((object)"ComfortUI initialized."); } } } namespace ComfortUI.Patches { public static class Patch_PlayerVendorSearch { private static IntPtr _vendorSlotsFieldPtr = IntPtr.Zero; private static bool _vendorSlotsLookedUp; private static IntPtr _vendablesFieldPtr = IntPtr.Zero; private static bool _vendablesLookedUp; internal static ManualLogSource Log => ComfortUIPlugin.Logger; public static void Apply(Harmony harmony) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp(); Type typeFromHandle = typeof(PlayerVendorSubController); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle, "Setup", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patch_PlayerVendorSearch), "Setup_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle, "Clear", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patch_PlayerVendorSearch), "Clear_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeFromHandle, "OnChangeVendorHideUnusable", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Patch_PlayerVendorSearch), "Recapture_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"Player vendor search patches applied."); } public static void Setup_Postfix(PlayerVendorSubController __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown try { PlayerVendorSearchComponent orCreate = GetOrCreate(__instance); orCreate.Show(); orCreate.ClearSearch(); orCreate.ScheduleRecapture(); } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] Setup_Postfix: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } public static void Clear_Postfix(PlayerVendorSubController __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown try { PlayerVendorSearchComponent component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { component.ClearSearch(); component.Hide(); } } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] Clear_Postfix: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } public static void Recapture_Postfix(PlayerVendorSubController __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown try { PlayerVendorSearchComponent component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ScheduleRecapture(); } } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] Recapture_Postfix: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private static PlayerVendorSearchComponent GetOrCreate(PlayerVendorSubController v) { PlayerVendorSearchComponent component = ((Component)v).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } component = ((Component)v).gameObject.AddComponent(); component.Init(v); return component; } internal static List ReadVendorSlots(PlayerVendorSubController vendor) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown List list = new List(); bool flag = default(bool); try { if (!_vendorSlotsLookedUp) { _vendorSlotsLookedUp = true; IntPtr nativeClassPtr = Il2CppClassPointerStore.NativeClassPtr; if (nativeClassPtr != IntPtr.Zero) { _vendorSlotsFieldPtr = IL2CPP.il2cpp_class_get_field_from_name(nativeClassPtr, "vendorSlots"); } ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] vendorSlots field lookup: classPtr="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(nativeClassPtr != IntPtr.Zero); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", fieldPtr="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_vendorSlotsFieldPtr != IntPtr.Zero); } log.LogInfo(val); } if (_vendorSlotsFieldPtr == IntPtr.Zero) { Log.LogWarning((object)"[PVS] vendorSlots IL2CPP field not found"); return list; } IntPtr intPtr = IL2CPP.il2cpp_field_get_value_object(_vendorSlotsFieldPtr, ((Il2CppObjectBase)vendor).Pointer); if (intPtr == IntPtr.Zero) { Log.LogWarning((object)"[PVS] vendorSlots value is null"); return list; } List val2 = new List(intPtr); for (int i = 0; i < val2.Count; i++) { list.Add(val2[i]); } } catch (Exception ex) { ManualLogSource log2 = Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PVS] ReadVendorSlots error: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log2.LogError(val3); } return list; } internal static List ReadVendables(PlayerVendorSubController vendor) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown List list = new List(); bool flag = default(bool); try { if (!_vendablesLookedUp) { _vendablesLookedUp = true; IntPtr nativeClassPtr = Il2CppClassPointerStore.NativeClassPtr; if (nativeClassPtr != IntPtr.Zero) { _vendablesFieldPtr = IL2CPP.il2cpp_class_get_field_from_name(nativeClassPtr, "vendables"); } ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] vendables field lookup: classPtr="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(nativeClassPtr != IntPtr.Zero); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", fieldPtr="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_vendablesFieldPtr != IntPtr.Zero); } log.LogInfo(val); } if (_vendablesFieldPtr == IntPtr.Zero) { Log.LogWarning((object)"[PVS] vendables IL2CPP field not found"); return list; } IntPtr intPtr = IL2CPP.il2cpp_field_get_value_object(_vendablesFieldPtr, ((Il2CppObjectBase)vendor).Pointer); if (intPtr == IntPtr.Zero) { Log.LogWarning((object)"[PVS] vendables value is null"); return list; } List val2 = new List(intPtr); for (int i = 0; i < val2.Count; i++) { list.Add(val2[i]); } } catch (Exception ex) { ManualLogSource log2 = Log; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PVS] ReadVendables error: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex); } log2.LogError(val3); } return list; } } public class PlayerVendorSearchComponent : MonoBehaviour { private PlayerVendorSubController _vendor; private GameObject _container; private TMP_InputField _inputField; private string _currentFilter = ""; private string _lastText = ""; private bool _layoutAdjusted; private static bool _hierarchyDumped; private Dictionary _allItems = new Dictionary(); private Dictionary _allItemsTranslated = new Dictionary(); private Dictionary _slotsByIID = new Dictionary(); private List _allItemOrder = new List(); private static bool _translationMethodLookedUp; private static MethodInfo _translateMethod; private int _recaptureCountdown = -1; private static ManualLogSource Log => ComfortUIPlugin.Logger; public PlayerVendorSearchComponent(IntPtr ptr) : base(ptr) { } public void Init(PlayerVendorSubController vendor) { _vendor = vendor; BuildUI(); } public void Show() { if ((Object)(object)_container != (Object)null) { _container.SetActive(true); } } public void Hide() { if ((Object)(object)_container != (Object)null) { _container.SetActive(false); } } public void ClearSearch() { _currentFilter = ""; _lastText = ""; if ((Object)(object)_inputField != (Object)null) { _inputField.text = ""; } RestoreAllVisible(); } public void ScheduleRecapture() { _recaptureCountdown = 2; } public void CaptureItems() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown if ((Object)(object)_vendor == (Object)null) { return; } _allItems.Clear(); _allItemsTranslated.Clear(); _allItemOrder.Clear(); _slotsByIID.Clear(); List list = Patch_PlayerVendorSearch.ReadVendables(_vendor); List list2 = Patch_PlayerVendorSearch.ReadVendorSlots(_vendor); int num = Math.Min(list.Count, list2.Count); bool flag = default(bool); for (int i = 0; i < num; i++) { try { PlayerVendorItemForSale val = list[i]; if (val != null && val.item != null) { int iID = val.item.IID; string value = val.item.Name ?? ""; _allItems[iID] = value; _allItemOrder.Add(iID); _slotsByIID[iID] = list2[i]; } } catch (Exception ex) { ManualLogSource log = Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(32, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] Error reading vendable #"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(i); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } } BuildTranslationCache(); ManualLogSource log2 = Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[PVS] Captured "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(_allItems.Count); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" player vendor items"); } log2.LogInfo(val3); } public void ApplyFilter() { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown if ((Object)(object)_vendor == (Object)null || _allItems.Count == 0) { return; } string currentFilter = _currentFilter; int num = 0; foreach (int item in _allItemOrder) { if (!_allItems.TryGetValue(item, out var value) || !_slotsByIID.TryGetValue(item, out var value2)) { continue; } string value3; bool flag = string.IsNullOrEmpty(currentFilter) || value.IndexOf(currentFilter, StringComparison.OrdinalIgnoreCase) >= 0 || (_allItemsTranslated.TryGetValue(item, out value3) && value3.IndexOf(currentFilter, StringComparison.OrdinalIgnoreCase) >= 0); if ((Object)(object)value2 != (Object)null && (Object)(object)((Component)value2).gameObject != (Object)null) { ((Component)value2).gameObject.SetActive(flag); if (flag) { num++; } } } ManualLogSource log = Log; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] ApplyFilter: '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(currentFilter); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' → showing "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_allItems.Count); } log.LogInfo(val); } private void RestoreAllVisible() { foreach (KeyValuePair item in _slotsByIID) { try { if ((Object)(object)item.Value != (Object)null && (Object)(object)((Component)item.Value).gameObject != (Object)null) { ((Component)item.Value).gameObject.SetActive(true); } } catch { } } } private void BuildTranslationCache() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown MethodInfo translateMethod = GetTranslateMethod(); if (translateMethod == null) { return; } int num = 0; foreach (KeyValuePair allItem in _allItems) { try { string text = (string)translateMethod.Invoke(null, new object[1] { allItem.Value }); if (text != null && text != allItem.Value) { _allItemsTranslated[allItem.Key] = text; num++; } } catch { } } ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_allItems.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" items translated"); } log.LogInfo(val); } private static MethodInfo GetTranslateMethod() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (_translationMethodLookedUp) { return _translateMethod; } _translationMethodLookedUp = true; bool flag = default(bool); try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name != "Translator") { continue; } Type type = assembly.GetType("TranslationDictionary"); if (!(type == null)) { _translateMethod = type.GetMethod("Translate", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PVS] Found TranslationDictionary.Translate: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_translateMethod != null); } log.LogInfo(val); break; } } } catch (Exception ex) { ManualLogSource log2 = Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] TranslationDictionary lookup failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log2.LogWarning(val2); } return _translateMethod; } private void Update() { if ((Object)(object)_inputField == (Object)null || (Object)(object)_vendor == (Object)null) { return; } if (_recaptureCountdown > 0) { _recaptureCountdown--; } else if (_recaptureCountdown == 0) { _recaptureCountdown = -1; CaptureItems(); if (!string.IsNullOrEmpty(_currentFilter)) { ApplyFilter(); } } if (_inputField.isFocused) { _inputField.ForceLabelUpdate(); } string text = _inputField.text ?? ""; if (text != _lastText) { _lastText = text; OnSearchChanged(text); } } private void BuildUI() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0302: 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_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_vendor == (Object)null) { return; } RectTransform vendorPanel = _vendor.VendorPanel; if ((Object)(object)vendorPanel == (Object)null) { Log.LogWarning((object)"[PVS] VendorPanel is null"); return; } if (!_hierarchyDumped) { _hierarchyDumped = true; Log.LogInfo((object)"===== PlayerVendorPanel hierarchy ====="); Patch_VendorSearch.DumpHierarchy((Transform)(object)vendorPanel); Log.LogInfo((object)"===== End hierarchy ====="); } ScrollRect inventoryScrollRect = _vendor.InventoryScrollRect; Transform val; int num; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2; if ((Object)(object)inventoryScrollRect != (Object)null) { val = ((Component)inventoryScrollRect).transform.parent; num = ((Component)inventoryScrollRect).transform.GetSiblingIndex(); ManualLogSource log = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(59, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] Anchoring relative to ScrollRect '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)inventoryScrollRect).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("sibIdx="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" parent='"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'"); } log.LogInfo(val2); } else { RectTransform vendorInventoryArea = _vendor.VendorInventoryArea; if ((Object)(object)vendorInventoryArea != (Object)null) { val = ((Transform)vendorInventoryArea).parent; num = ((Transform)vendorInventoryArea).GetSiblingIndex(); ManualLogSource log2 = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(56, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] Anchoring relative to InvArea '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)vendorInventoryArea).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("sibIdx="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" parent='"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'"); } log2.LogInfo(val2); } else { val = (Transform)(object)vendorPanel; num = 0; Log.LogInfo((object)"[PVS] Fallback: using VendorPanel as parent"); } } int layer = ((Component)vendorPanel).gameObject.layer; _container = new GameObject("ComfortUI_PlayerVendorSearch"); _container.layer = layer; _container.transform.SetParent(val, false); _container.transform.SetSiblingIndex(num); RectTransform val3 = _container.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = _container.AddComponent(); } if ((Object)(object)((Component)val).GetComponent() != (Object)null) { ManualLogSource log3 = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] Parent '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' has LayoutGroup — using LayoutElement"); } log3.LogInfo(val2); LayoutElement obj = _container.AddComponent(); obj.preferredHeight = 30f; obj.minHeight = 30f; obj.flexibleWidth = 1f; } else { Log.LogInfo((object)"[PVS] No LayoutGroup — using manual anchoring"); RectTransform val4 = (RectTransform)(((Object)(object)inventoryScrollRect != (Object)null) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)_vendor.VendorInventoryArea)); if ((Object)(object)val4 != (Object)null) { val3.anchorMin = new Vector2(val4.anchorMin.x, val4.anchorMax.y); val3.anchorMax = new Vector2(val4.anchorMax.x, val4.anchorMax.y); val3.pivot = new Vector2(0.5f, 1f); val3.offsetMin = new Vector2(val4.offsetMin.x, 0f); val3.offsetMax = new Vector2(val4.offsetMax.x, 0f); val3.sizeDelta = new Vector2(val3.sizeDelta.x, 30f); val3.anchoredPosition = new Vector2(val3.anchoredPosition.x, 0f); } else { val3.anchorMin = new Vector2(0f, 1f); val3.anchorMax = new Vector2(1f, 1f); val3.pivot = new Vector2(0.5f, 1f); val3.anchoredPosition = Vector2.zero; val3.sizeDelta = new Vector2(-16f, 30f); } } _container.AddComponent(); ((Graphic)_container.AddComponent()).color = new Color(0.15f, 0.15f, 0.15f, 0.95f); ManualLogSource log4 = Log; val2 = new BepInExInfoLogInterpolatedStringHandler(63, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] Container: parent='"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("sibIdx="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(_container.transform.GetSiblingIndex()); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("rt.rect="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(val3.rect); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" anchPos="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(val3.anchoredPosition); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("sizeDelta="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(val3.sizeDelta); } log4.LogInfo(val2); _inputField = TryCloneInputField(_container.transform, layer); if ((Object)(object)_inputField == (Object)null) { Log.LogWarning((object)"[PVS] Clone failed — manual fallback"); _inputField = CreateInputFieldManual(_container.transform, layer); } if ((Object)(object)_inputField != (Object)null) { Log.LogInfo((object)"[PVS] InputField ready."); } else { Log.LogError((object)"[PVS] Failed to create InputField!"); } AdjustScrollArea(); Log.LogInfo((object)"[PVS] UI created."); } private TMP_InputField TryCloneInputField(Transform parent, int layer) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) TMP_InputField val = null; bool flag = default(bool); try { UIAbilitiesController instance = UIBehaviourSingleton.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.SearchBar != (Object)null) { val = instance.SearchBar; Log.LogInfo((object)"[PVS] Source: UIAbilitiesController.SearchBar"); } } catch (Exception ex) { ManualLogSource log = Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] UIAbilitiesController: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log.LogWarning(val2); } if ((Object)(object)val == (Object)null) { try { Il2CppArrayBase val3 = Resources.FindObjectsOfTypeAll(); if (val3 != null && val3.Length > 0) { val = val3[0]; ManualLogSource log2 = Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[PVS] Source: Resources ("); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(val3.Length); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" found, using '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("')"); } log2.LogInfo(val4); } } catch (Exception ex2) { ManualLogSource log3 = Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(15, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[PVS] FindAll: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex2.Message); } log3.LogWarning(val2); } } if ((Object)(object)val == (Object)null) { return null; } try { GameObject val5 = Object.Instantiate(((Component)val).gameObject, parent); ((Object)val5).name = "SearchInput_Clone"; val5.layer = layer; val5.SetActive(true); RectTransform component = val5.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(6f, 2f); component.offsetMax = new Vector2(-6f, -2f); } SetLayerRecursive(val5.transform, layer); TMP_InputField component2 = val5.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((UnityEventBase)component2.onValueChanged).RemoveAllListeners(); component2.text = ""; component2.characterLimit = 50; Graphic placeholder = component2.placeholder; if ((Object)(object)placeholder != (Object)null) { TextMeshProUGUI component3 = ((Component)placeholder).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((TMP_Text)component3).text = "Search..."; } else { Text component4 = ((Component)placeholder).GetComponent(); if ((Object)(object)component4 != (Object)null) { component4.text = "Search..."; } } } Log.LogInfo((object)"[PVS] Cloned OK"); WireClearButtons(val5.transform, component2); return component2; } Object.Destroy((Object)(object)val5); } catch (Exception ex3) { ManualLogSource log4 = Log; BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[PVS] Clone error: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(ex3); } log4.LogError(val6); } return null; } private TMP_InputField CreateInputFieldManual(Transform parent, int layer) { //IL_0014: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00a4: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown try { GameObject val = MakeUI("SearchInput_Manual", parent, layer); RectTransform component = val.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(6f, 2f); component.offsetMax = new Vector2(-6f, -2f); Image val2 = val.AddComponent(); ((Graphic)val2).color = new Color(0.08f, 0.08f, 0.08f, 0.95f); ((Graphic)val2).raycastTarget = true; GameObject val3 = MakeUI("Text Area", val.transform, layer); RectTransform component2 = val3.GetComponent(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(6f, 0f); component2.offsetMax = new Vector2(-6f, 0f); val3.AddComponent(); GameObject obj = MakeUI("Placeholder", val3.transform, layer); Stretch(obj.GetComponent()); TextMeshProUGUI val4 = obj.AddComponent(); ((TMP_Text)val4).text = "Search / Поиск..."; ((TMP_Text)val4).fontSize = 14f; ((TMP_Text)val4).fontStyle = (FontStyles)2; ((Graphic)val4).color = new Color(0.5f, 0.5f, 0.5f, 0.7f); ((TMP_Text)val4).alignment = (TextAlignmentOptions)4097; ((Graphic)val4).raycastTarget = false; GameObject obj2 = MakeUI("Text", val3.transform, layer); Stretch(obj2.GetComponent()); TextMeshProUGUI val5 = obj2.AddComponent(); ((TMP_Text)val5).fontSize = 14f; ((Graphic)val5).color = Color.white; ((TMP_Text)val5).alignment = (TextAlignmentOptions)4097; ((Graphic)val5).raycastTarget = false; TMP_InputField obj3 = val.AddComponent(); obj3.textViewport = component2; obj3.textComponent = (TMP_Text)(object)val5; obj3.placeholder = (Graphic)(object)val4; obj3.fontAsset = ((TMP_Text)val5).font; obj3.pointSize = 14f; obj3.characterLimit = 50; ((Selectable)obj3).image = val2; Log.LogInfo((object)"[PVS] Manual InputField created"); return obj3; } catch (Exception ex) { ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[PVS] Manual creation failed: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(ex); } log.LogError(val6); return null; } } private static GameObject MakeUI(string name, Transform parent, int layer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(name); val.layer = layer; val.transform.SetParent(parent, false); if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } if ((Object)(object)val.GetComponent() == (Object)null) { val.AddComponent(); } return val; } private static void Stretch(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; } private static void SetLayerRecursive(Transform t, int layer) { ((Component)t).gameObject.layer = layer; for (int i = 0; i < t.childCount; i++) { SetLayerRecursive(t.GetChild(i), layer); } } private void WireClearButtons(Transform root, TMP_InputField field) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown bool flag = default(bool); for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); Button component = ((Component)child).GetComponent