using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("CrashoutCrewItemSpawner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a2134d47542f150af2c19a05f23711f00d46fd20")] [assembly: AssemblyProduct("CrashoutCrewItemSpawner")] [assembly: AssemblyTitle("CrashoutCrewItemSpawner")] [assembly: AssemblyVersion("1.0.0.0")] [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 CrashoutCrewItemSpawner { internal static class ItemDatabase { public sealed class Entry { public ShopItemObject Item; public string Name; public string Description; public Sprite Icon; public GameObject WorldPrefab; public int Cost; public ShopItemType Type; } private static List _entries; private static List _filtered; private static string _filter = ""; private static bool _filterDirty = true; private static bool _hideWildCards = true; public static IReadOnlyList All => _entries; public static IReadOnlyList Filtered => _filtered; public static int Count => _entries?.Count ?? 0; public static int FilteredCount => _filtered?.Count ?? 0; public static bool HideWildCards { get { return _hideWildCards; } set { if (_hideWildCards != value) { _hideWildCards = value; _filterDirty = true; } } } public static void Refresh(ManualLogSource logger) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) try { ShopItemObject[] array = Resources.FindObjectsOfTypeAll(); List list = new List(array.Length); HashSet hashSet = new HashSet(); ShopItemObject[] array2 = array; foreach (ShopItemObject val in array2) { if (!((Object)(object)val == (Object)null) && hashSet.Add(val)) { string itemName = val.itemName; if (!string.IsNullOrEmpty(itemName) && !itemName.StartsWith("zzz_") && !itemName.StartsWith("_") && !((Object)(object)val.worldItemPrefab == (Object)null)) { list.Add(new Entry { Item = val, Name = itemName, Description = (val.itemDescription ?? ""), Icon = val.icon, WorldPrefab = val.worldItemPrefab, Cost = val.cost, Type = val.type }); } } } list.Sort((Entry a, Entry b) => string.CompareOrdinal(a.Name, b.Name)); _entries = list; _filterDirty = true; logger.LogInfo((object)$"ItemDatabase: discovered {_entries.Count} spawnable items (deduped from {array.Length})"); foreach (Entry item in _entries.Take(8)) { logger.LogInfo((object)string.Format(" - id={0} name='{1}' cost={2} prefab='{3}'", ((Object)item.Item).GetInstanceID(), item.Name, item.Cost, ((Object)(object)item.WorldPrefab != (Object)null) ? ((Object)item.WorldPrefab).name : "")); } if (_entries.Count > 8) { logger.LogInfo((object)$" ... and {_entries.Count - 8} more"); } } catch (Exception arg) { logger.LogError((object)$"ItemDatabase refresh failed: {arg}"); _entries = new List(); _filterDirty = true; } } public static void SetFilter(string text) { if (!(_filter == text)) { _filter = text ?? ""; _filterDirty = true; } } public static void UpdateFilter() { if (!_filterDirty || _entries == null) { return; } _filterDirty = false; IEnumerable source = _entries; if (_hideWildCards) { source = source.Where((Entry e) => (Object)(object)e.WorldPrefab != (Object)null && !((Object)e.WorldPrefab).name.ToLowerInvariant().Contains("wildcard")); } if (!string.IsNullOrEmpty(_filter)) { string lower = _filter.ToLowerInvariant(); source = source.Where((Entry e) => e.Name.ToLowerInvariant().Contains(lower) || (e.Description != null && e.Description.ToLowerInvariant().Contains(lower))); } _filtered = source.ToList(); } } internal static class ItemSpawnerUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__64_0; public static UnityAction <>9__64_1; public static UnityAction <>9__64_2; public static UnityAction <>9__64_3; public static UnityAction <>9__64_4; public static UnityAction <>9__64_5; public static UnityAction <>9__80_0; internal void b__64_0() { ToggleHelp(); } internal void b__64_1() { SetOpen(open: false); } internal void b__64_2(string _) { OnSearchSubmit(); } internal void b__64_3() { SetQuantity(Quantity - 1); } internal void b__64_4(string s) { if (int.TryParse(s, out var result)) { SetQuantity(result); } } internal void b__64_5() { SetQuantity(Quantity + 1); } internal void b__80_0() { SetHelpOpen(open: false); } } private static readonly Color BgDark = new Color(0.05f, 0.05f, 0.1f, 0.78f); private static readonly Color BgDarkAlt = new Color(0.08f, 0.08f, 0.14f, 0.92f); private static readonly Color Accent = new Color(0.55f, 0.3f, 0.95f, 1f); private static readonly Color Accent2 = new Color(0.2f, 0.85f, 0.95f, 1f); private static readonly Color RowIdle = new Color(1f, 1f, 1f, 0.04f); private static readonly Color RowHover = new Color(1f, 1f, 1f, 0.1f); private static readonly Color RowSelected = new Color(0.55f, 0.3f, 0.95f, 0.55f); private static readonly Color TextDim = new Color(0.75f, 0.75f, 0.85f, 1f); private static readonly Color TextMuted = new Color(0.55f, 0.55f, 0.65f, 1f); private static readonly Color BtnBg = new Color(0.55f, 0.3f, 0.95f, 1f); private static readonly Color BtnBgHover = new Color(0.65f, 0.4f, 1f, 1f); private static readonly Color InputBg = new Color(1f, 1f, 1f, 0.07f); private static Font _font; private static Sprite _whiteSprite; private static Canvas _canvas; private static GameObject _root; private static GameObject _panelGo; private static InputField _searchField; private static InputField _qtyField; private static Text _statusText; private static Text _countText; private static Text _titleText; private static RectTransform _contentRt; private static GameObject _emptyHint; private static ScrollRect _scrollRect; private static RectTransform _viewportRt; private static GameObject _helpButton; private static GameObject _helpBackdrop; private static GameObject _helpPanel; private static Text _helpContent; private static bool _helpBuilt; private static int _selectedIndex = -1; private static ItemDatabase.Entry _selectedEntry; private static GameObject _selectedRow; private static readonly List _rows = new List(); private static readonly List _rowBgs = new List(); private static readonly List