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<Entry> _entries;
private static List<Entry> _filtered;
private static string _filter = "";
private static bool _filterDirty = true;
private static bool _hideWildCards = true;
public static IReadOnlyList<Entry> All => _entries;
public static IReadOnlyList<Entry> 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<ShopItemObject>();
List<Entry> list = new List<Entry>(array.Length);
HashSet<ShopItemObject> hashSet = new HashSet<ShopItemObject>();
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 : "<null>"));
}
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<Entry>();
_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<Entry> 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<string> <>9__64_2;
public static UnityAction <>9__64_3;
public static UnityAction<string> <>9__64_4;
public static UnityAction <>9__64_5;
public static UnityAction <>9__80_0;
internal void <BuildPanel>b__64_0()
{
ToggleHelp();
}
internal void <BuildPanel>b__64_1()
{
SetOpen(open: false);
}
internal void <BuildPanel>b__64_2(string _)
{
OnSearchSubmit();
}
internal void <BuildPanel>b__64_3()
{
SetQuantity(Quantity - 1);
}
internal void <BuildPanel>b__64_4(string s)
{
if (int.TryParse(s, out var result))
{
SetQuantity(result);
}
}
internal void <BuildPanel>b__64_5()
{
SetQuantity(Quantity + 1);
}
internal void <BuildHelp>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<GameObject> _rows = new List<GameObject>();
private static readonly List<Image> _rowBgs = new List<Image>();
private static readonly List<Button> _rowBtns = new List<Button>();
private static readonly List<GameObject> _rowAccentBars = new List<GameObject>();
private static string _lastFilter = "";
private static int _lastItemCount = -1;
private const float PanelW = 380f;
private const float PanelH = 620f;
private const float RowH = 56f;
public static bool VerboseLogging = false;
private static bool _cursorStateSaved;
private static bool _prevCursorVisible;
private static CursorLockMode _prevLockState;
public static bool IsOpen { get; private set; }
public static bool IsHelpOpen { get; private set; }
public static int Quantity { get; private set; } = 1;
public static void Build()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if (!((Object)(object)_root != (Object)null))
{
EnsureResources();
EnsureEventSystem();
_root = new GameObject("ItemSpawner_Canvas");
Object.DontDestroyOnLoad((Object)(object)_root);
_canvas = _root.AddComponent<Canvas>();
_canvas.renderMode = (RenderMode)0;
_canvas.sortingOrder = 32767;
_root.AddComponent<CanvasScaler>();
_root.AddComponent<GraphicRaycaster>();
BuildPanel();
BuildHelp();
SetOpen(open: false);
}
}
public static void SetOpen(bool open)
{
//IL_0073: 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_0040: Unknown result type (might be due to invalid IL or missing references)
IsOpen = open;
if (!open)
{
SetHelpOpen(open: false);
}
if ((Object)(object)_root != (Object)null)
{
_root.SetActive(open);
}
if (open)
{
if (!_cursorStateSaved)
{
_prevCursorVisible = Cursor.visible;
_prevLockState = Cursor.lockState;
_cursorStateSaved = true;
}
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
RebuildList();
FocusSearch();
}
else if (_cursorStateSaved)
{
Cursor.visible = _prevCursorVisible;
Cursor.lockState = _prevLockState;
_cursorStateSaved = false;
}
}
public static void Toggle()
{
SetOpen(!IsOpen);
}
public static ItemDatabase.Entry GetSelected()
{
return _selectedEntry;
}
public static void SetStatus(string text)
{
if ((Object)(object)_statusText != (Object)null)
{
_statusText.text = text;
}
}
private static void BuildPanel()
{
//IL_002e: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00cb: 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_00f5: 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_011e: 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)
//IL_015d: 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_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: 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_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: 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_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: 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_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0420: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_047f: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Expected O, but got Unknown
//IL_051d: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Unknown result type (might be due to invalid IL or missing references)
//IL_0539: Unknown result type (might be due to invalid IL or missing references)
//IL_0544: Unknown result type (might be due to invalid IL or missing references)
//IL_054e: 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_0592: Unknown result type (might be due to invalid IL or missing references)
//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
//IL_060a: Unknown result type (might be due to invalid IL or missing references)
//IL_0614: Unknown result type (might be due to invalid IL or missing references)
//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: Expected O, but got Unknown
//IL_0674: Unknown result type (might be due to invalid IL or missing references)
//IL_0689: Unknown result type (might be due to invalid IL or missing references)
//IL_069e: Unknown result type (might be due to invalid IL or missing references)
//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0700: Unknown result type (might be due to invalid IL or missing references)
//IL_0715: Unknown result type (might be due to invalid IL or missing references)
//IL_072a: Unknown result type (might be due to invalid IL or missing references)
//IL_073f: Unknown result type (might be due to invalid IL or missing references)
//IL_0753: Unknown result type (might be due to invalid IL or missing references)
//IL_077f: Unknown result type (might be due to invalid IL or missing references)
//IL_0794: Unknown result type (might be due to invalid IL or missing references)
//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
//IL_07be: Unknown result type (might be due to invalid IL or missing references)
//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0804: Unknown result type (might be due to invalid IL or missing references)
//IL_0808: Unknown result type (might be due to invalid IL or missing references)
//IL_0814: Unknown result type (might be due to invalid IL or missing references)
//IL_081f: Unknown result type (might be due to invalid IL or missing references)
//IL_0861: Unknown result type (might be due to invalid IL or missing references)
//IL_0872: Unknown result type (might be due to invalid IL or missing references)
//IL_087d: Unknown result type (might be due to invalid IL or missing references)
//IL_0888: Unknown result type (might be due to invalid IL or missing references)
//IL_0892: Unknown result type (might be due to invalid IL or missing references)
//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0906: Unknown result type (might be due to invalid IL or missing references)
//IL_091b: Unknown result type (might be due to invalid IL or missing references)
//IL_092f: Unknown result type (might be due to invalid IL or missing references)
//IL_083f: Unknown result type (might be due to invalid IL or missing references)
//IL_0844: Unknown result type (might be due to invalid IL or missing references)
//IL_084a: Expected O, but got Unknown
//IL_0989: Unknown result type (might be due to invalid IL or missing references)
//IL_099e: Unknown result type (might be due to invalid IL or missing references)
//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0a09: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a12: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
//IL_0a6b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a7c: Unknown result type (might be due to invalid IL or missing references)
//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
//IL_0a92: Unknown result type (might be due to invalid IL or missing references)
//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
//IL_0ace: Unknown result type (might be due to invalid IL or missing references)
//IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
//IL_0af8: Unknown result type (might be due to invalid IL or missing references)
//IL_0b0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
//IL_0b66: Unknown result type (might be due to invalid IL or missing references)
//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba7: Unknown result type (might be due to invalid IL or missing references)
//IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
//IL_0c0f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c28: Unknown result type (might be due to invalid IL or missing references)
//IL_0c41: Unknown result type (might be due to invalid IL or missing references)
//IL_0c50: Unknown result type (might be due to invalid IL or missing references)
//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
//IL_0d0a: Unknown result type (might be due to invalid IL or missing references)
//IL_0d1f: Unknown result type (might be due to invalid IL or missing references)
//IL_0d34: Unknown result type (might be due to invalid IL or missing references)
//IL_0d48: Unknown result type (might be due to invalid IL or missing references)
//IL_0d69: Unknown result type (might be due to invalid IL or missing references)
//IL_0d7a: Unknown result type (might be due to invalid IL or missing references)
//IL_0d85: Unknown result type (might be due to invalid IL or missing references)
//IL_0d90: Unknown result type (might be due to invalid IL or missing references)
//IL_0d9a: Unknown result type (might be due to invalid IL or missing references)
//IL_0dc9: Unknown result type (might be due to invalid IL or missing references)
//IL_0dde: Unknown result type (might be due to invalid IL or missing references)
//IL_0df3: Unknown result type (might be due to invalid IL or missing references)
//IL_0dfe: Unknown result type (might be due to invalid IL or missing references)
//IL_0e12: Unknown result type (might be due to invalid IL or missing references)
//IL_0e22: Unknown result type (might be due to invalid IL or missing references)
//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
//IL_0e64: Unknown result type (might be due to invalid IL or missing references)
//IL_0e79: Unknown result type (might be due to invalid IL or missing references)
//IL_0e8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea3: Unknown result type (might be due to invalid IL or missing references)
//IL_0eb7: Unknown result type (might be due to invalid IL or missing references)
//IL_0ed3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ef8: Unknown result type (might be due to invalid IL or missing references)
//IL_0f0d: Unknown result type (might be due to invalid IL or missing references)
//IL_0f22: Unknown result type (might be due to invalid IL or missing references)
//IL_0f37: Unknown result type (might be due to invalid IL or missing references)
//IL_0f4b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a49: Unknown result type (might be due to invalid IL or missing references)
//IL_0a4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a54: Expected O, but got Unknown
_panelGo = NewUiObject("Panel", ((Component)_canvas).transform);
RectTransform component = _panelGo.GetComponent<RectTransform>();
component.anchorMin = new Vector2(1f, 0.5f);
component.anchorMax = new Vector2(1f, 0.5f);
component.pivot = new Vector2(1f, 0.5f);
component.anchoredPosition = new Vector2(-20f, 0f);
component.sizeDelta = new Vector2(380f, 620f);
Image obj = _panelGo.AddComponent<Image>();
((Graphic)obj).color = BgDark;
((Graphic)obj).raycastTarget = true;
GameObject obj2 = NewUiObject("Accent", _panelGo.transform);
RectTransform component2 = obj2.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 1f);
component2.anchorMax = new Vector2(1f, 1f);
component2.pivot = new Vector2(0.5f, 1f);
component2.anchoredPosition = new Vector2(0f, 0f);
component2.sizeDelta = new Vector2(0f, 3f);
((Graphic)obj2.AddComponent<Image>()).color = Accent;
GameObject val = NewUiObject("Header", _panelGo.transform);
RectTransform component3 = val.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 1f);
component3.anchorMax = new Vector2(1f, 1f);
component3.pivot = new Vector2(0.5f, 1f);
component3.anchoredPosition = new Vector2(0f, -3f);
component3.sizeDelta = new Vector2(0f, 50f);
((Graphic)val.AddComponent<Image>()).color = BgDarkAlt;
_titleText = AddText(val.transform, "Title", "ITEM SPAWNER", 19, (FontStyle)1, Color.white, (TextAnchor)3);
RectTransform rectTransform = ((Graphic)_titleText).rectTransform;
rectTransform.anchorMin = new Vector2(0f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.offsetMin = new Vector2(18f, 0f);
rectTransform.offsetMax = new Vector2(-90f, 0f);
_helpButton = NewUiObject("HelpBtn", val.transform);
RectTransform component4 = _helpButton.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(1f, 0.5f);
component4.anchorMax = new Vector2(1f, 0.5f);
component4.pivot = new Vector2(1f, 0.5f);
component4.anchoredPosition = new Vector2(-48f, 0f);
component4.sizeDelta = new Vector2(36f, 36f);
Image val2 = _helpButton.AddComponent<Image>();
((Graphic)val2).color = new Color(0.2f, 0.85f, 0.95f, 0.85f);
Button obj3 = _helpButton.AddComponent<Button>();
((Selectable)obj3).targetGraphic = (Graphic)(object)val2;
ColorBlock colors = ((Selectable)obj3).colors;
((ColorBlock)(ref colors)).highlightedColor = new Color(0.3f, 0.95f, 1f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.1f, 0.75f, 0.85f, 1f);
((Selectable)obj3).colors = colors;
ButtonClickedEvent onClick = obj3.onClick;
object obj4 = <>c.<>9__64_0;
if (obj4 == null)
{
UnityAction val3 = delegate
{
ToggleHelp();
};
<>c.<>9__64_0 = val3;
obj4 = (object)val3;
}
((UnityEvent)onClick).AddListener((UnityAction)obj4);
RectTransform rectTransform2 = ((Graphic)AddText(_helpButton.transform, "T", "?", 19, (FontStyle)1, Color.white, (TextAnchor)4)).rectTransform;
rectTransform2.anchorMin = Vector2.zero;
rectTransform2.anchorMax = Vector2.one;
rectTransform2.sizeDelta = Vector2.zero;
rectTransform2.anchoredPosition = Vector2.zero;
GameObject obj5 = NewUiObject("Close", val.transform);
RectTransform component5 = obj5.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(1f, 0.5f);
component5.anchorMax = new Vector2(1f, 0.5f);
component5.pivot = new Vector2(1f, 0.5f);
component5.anchoredPosition = new Vector2(-6f, 0f);
component5.sizeDelta = new Vector2(36f, 36f);
Button val4 = obj5.AddComponent<Button>();
((Selectable)val4).targetGraphic = null;
Image val5 = obj5.AddComponent<Image>();
((Graphic)val5).color = new Color(1f, 0.3f, 0.4f, 0.85f);
((Selectable)val4).targetGraphic = (Graphic)(object)val5;
ColorBlock colors2 = ((Selectable)val4).colors;
((ColorBlock)(ref colors2)).highlightedColor = new Color(1f, 0.4f, 0.5f, 1f);
((ColorBlock)(ref colors2)).pressedColor = new Color(0.85f, 0.2f, 0.3f, 1f);
((Selectable)val4).colors = colors2;
ButtonClickedEvent onClick2 = val4.onClick;
object obj6 = <>c.<>9__64_1;
if (obj6 == null)
{
UnityAction val6 = delegate
{
SetOpen(open: false);
};
<>c.<>9__64_1 = val6;
obj6 = (object)val6;
}
((UnityEvent)onClick2).AddListener((UnityAction)obj6);
RectTransform rectTransform3 = ((Graphic)AddText(obj5.transform, "X", "X", 17, (FontStyle)1, Color.white, (TextAnchor)4)).rectTransform;
rectTransform3.anchorMin = Vector2.zero;
rectTransform3.anchorMax = Vector2.one;
rectTransform3.sizeDelta = Vector2.zero;
rectTransform3.anchoredPosition = Vector2.zero;
GameObject obj7 = NewUiObject("Search", _panelGo.transform);
RectTransform component6 = obj7.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 1f);
component6.anchorMax = new Vector2(1f, 1f);
component6.pivot = new Vector2(0.5f, 1f);
component6.anchoredPosition = new Vector2(0f, -56f);
component6.sizeDelta = new Vector2(-24f, 34f);
_searchField = AddInputField(obj7, "Type to search...");
RectTransform component7 = ((Component)_searchField).GetComponent<RectTransform>();
component7.anchorMin = Vector2.zero;
component7.anchorMax = Vector2.one;
component7.sizeDelta = Vector2.zero;
component7.anchoredPosition = Vector2.zero;
((UnityEvent<string>)(object)_searchField.onEndEdit).AddListener((UnityAction<string>)delegate
{
OnSearchSubmit();
});
GameObject val7 = NewUiObject("Qty", _panelGo.transform);
RectTransform component8 = val7.GetComponent<RectTransform>();
component8.anchorMin = new Vector2(0f, 1f);
component8.anchorMax = new Vector2(1f, 1f);
component8.pivot = new Vector2(0.5f, 1f);
component8.anchoredPosition = new Vector2(0f, -100f);
component8.sizeDelta = new Vector2(-24f, 30f);
RectTransform rectTransform4 = ((Graphic)AddText(val7.transform, "QtyLabel", "QTY", 13, (FontStyle)1, TextDim, (TextAnchor)3)).rectTransform;
rectTransform4.anchorMin = new Vector2(0f, 0f);
rectTransform4.anchorMax = new Vector2(0f, 1f);
rectTransform4.pivot = new Vector2(0f, 0.5f);
rectTransform4.sizeDelta = new Vector2(40f, 0f);
rectTransform4.anchoredPosition = new Vector2(0f, 0f);
GameObject obj8 = NewUiObject("Minus", val7.transform);
RectTransform component9 = obj8.GetComponent<RectTransform>();
component9.anchorMin = new Vector2(0f, 0.5f);
component9.anchorMax = new Vector2(0f, 0.5f);
component9.pivot = new Vector2(0f, 0.5f);
component9.anchoredPosition = new Vector2(46f, 0f);
component9.sizeDelta = new Vector2(28f, 28f);
Image val8 = obj8.AddComponent<Image>();
((Graphic)val8).color = InputBg;
Button obj9 = obj8.AddComponent<Button>();
((Selectable)obj9).targetGraphic = (Graphic)(object)val8;
ColorBlock colors3 = ((Selectable)obj9).colors;
((ColorBlock)(ref colors3)).highlightedColor = RowHover;
((ColorBlock)(ref colors3)).pressedColor = RowSelected;
((Selectable)obj9).colors = colors3;
ButtonClickedEvent onClick3 = obj9.onClick;
object obj10 = <>c.<>9__64_3;
if (obj10 == null)
{
UnityAction val9 = delegate
{
SetQuantity(Quantity - 1);
};
<>c.<>9__64_3 = val9;
obj10 = (object)val9;
}
((UnityEvent)onClick3).AddListener((UnityAction)obj10);
RectTransform rectTransform5 = ((Graphic)AddText(obj8.transform, "T", "-", 17, (FontStyle)1, Color.white, (TextAnchor)4)).rectTransform;
rectTransform5.anchorMin = Vector2.zero;
rectTransform5.anchorMax = Vector2.one;
rectTransform5.sizeDelta = Vector2.zero;
rectTransform5.anchoredPosition = Vector2.zero;
_qtyField = AddInputField(val7, "1");
_qtyField.text = "1";
_qtyField.contentType = (ContentType)2;
RectTransform component10 = ((Component)_qtyField).GetComponent<RectTransform>();
component10.anchorMin = new Vector2(0f, 0.5f);
component10.anchorMax = new Vector2(0f, 0.5f);
component10.pivot = new Vector2(0f, 0.5f);
component10.anchoredPosition = new Vector2(80f, 0f);
component10.sizeDelta = new Vector2(60f, 28f);
((UnityEvent<string>)(object)_qtyField.onEndEdit).AddListener((UnityAction<string>)delegate(string s)
{
if (int.TryParse(s, out var result))
{
SetQuantity(result);
}
});
GameObject obj11 = NewUiObject("Plus", val7.transform);
RectTransform component11 = obj11.GetComponent<RectTransform>();
component11.anchorMin = new Vector2(0f, 0.5f);
component11.anchorMax = new Vector2(0f, 0.5f);
component11.pivot = new Vector2(0f, 0.5f);
component11.anchoredPosition = new Vector2(146f, 0f);
component11.sizeDelta = new Vector2(28f, 28f);
Image val10 = obj11.AddComponent<Image>();
((Graphic)val10).color = InputBg;
Button obj12 = obj11.AddComponent<Button>();
((Selectable)obj12).targetGraphic = (Graphic)(object)val10;
ColorBlock colors4 = ((Selectable)obj12).colors;
((ColorBlock)(ref colors4)).highlightedColor = RowHover;
((ColorBlock)(ref colors4)).pressedColor = RowSelected;
((Selectable)obj12).colors = colors4;
ButtonClickedEvent onClick4 = obj12.onClick;
object obj13 = <>c.<>9__64_5;
if (obj13 == null)
{
UnityAction val11 = delegate
{
SetQuantity(Quantity + 1);
};
<>c.<>9__64_5 = val11;
obj13 = (object)val11;
}
((UnityEvent)onClick4).AddListener((UnityAction)obj13);
RectTransform rectTransform6 = ((Graphic)AddText(obj11.transform, "T", "+", 17, (FontStyle)1, Color.white, (TextAnchor)4)).rectTransform;
rectTransform6.anchorMin = Vector2.zero;
rectTransform6.anchorMax = Vector2.one;
rectTransform6.sizeDelta = Vector2.zero;
rectTransform6.anchoredPosition = Vector2.zero;
GameObject val12 = NewUiObject("ScrollView", _panelGo.transform);
RectTransform component12 = val12.GetComponent<RectTransform>();
component12.anchorMin = new Vector2(0f, 0f);
component12.anchorMax = new Vector2(1f, 1f);
component12.offsetMin = new Vector2(12f, 78f);
component12.offsetMax = new Vector2(-12f, -140f);
Image obj14 = val12.AddComponent<Image>();
((Graphic)obj14).color = new Color(0f, 0f, 0f, 0.2f);
((Graphic)obj14).raycastTarget = true;
GameObject val13 = NewUiObject("Viewport", val12.transform);
_viewportRt = val13.GetComponent<RectTransform>();
_viewportRt.anchorMin = Vector2.zero;
_viewportRt.anchorMax = Vector2.one;
_viewportRt.sizeDelta = new Vector2(-8f, 0f);
_viewportRt.anchoredPosition = new Vector2(-4f, 0f);
Image obj15 = val13.AddComponent<Image>();
((Graphic)obj15).color = new Color(0f, 0f, 0f, 0.001f);
((Graphic)obj15).raycastTarget = true;
val13.AddComponent<RectMask2D>();
_contentRt = NewUiObject("Content", val13.transform).GetComponent<RectTransform>();
_contentRt.anchorMin = new Vector2(0f, 1f);
_contentRt.anchorMax = new Vector2(1f, 1f);
_contentRt.pivot = new Vector2(0.5f, 1f);
_contentRt.anchoredPosition = Vector2.zero;
_contentRt.sizeDelta = new Vector2(0f, 0f);
_scrollRect = val12.AddComponent<ScrollRect>();
_scrollRect.viewport = _viewportRt;
_scrollRect.content = _contentRt;
_scrollRect.horizontal = false;
_scrollRect.vertical = true;
_scrollRect.movementType = (MovementType)1;
_scrollRect.scrollSensitivity = 30f;
_scrollRect.elasticity = 0.08f;
_emptyHint = NewUiObject("Empty", _panelGo.transform);
RectTransform component13 = _emptyHint.GetComponent<RectTransform>();
component13.anchorMin = new Vector2(0f, 0f);
component13.anchorMax = new Vector2(1f, 1f);
component13.offsetMin = new Vector2(20f, 70f);
component13.offsetMax = new Vector2(-20f, -150f);
RectTransform rectTransform7 = ((Graphic)AddText(_emptyHint.transform, "T", "No items found.\nItems load once the game has run far enough to instantiate them.", 14, (FontStyle)2, TextMuted, (TextAnchor)4)).rectTransform;
rectTransform7.anchorMin = Vector2.zero;
rectTransform7.anchorMax = Vector2.one;
rectTransform7.sizeDelta = Vector2.zero;
rectTransform7.anchoredPosition = Vector2.zero;
GameObject obj16 = NewUiObject("Footer", _panelGo.transform);
RectTransform component14 = obj16.GetComponent<RectTransform>();
component14.anchorMin = new Vector2(0f, 0f);
component14.anchorMax = new Vector2(1f, 0f);
component14.pivot = new Vector2(0.5f, 0f);
component14.anchoredPosition = Vector2.zero;
component14.sizeDelta = new Vector2(0f, 68f);
((Graphic)obj16.AddComponent<Image>()).color = BgDarkAlt;
_countText = AddText(obj16.transform, "Count", "0 items", 16, (FontStyle)0, TextDim, (TextAnchor)3);
RectTransform rectTransform8 = ((Graphic)_countText).rectTransform;
rectTransform8.anchorMin = new Vector2(0f, 1f);
rectTransform8.anchorMax = new Vector2(1f, 1f);
rectTransform8.pivot = new Vector2(0.5f, 1f);
rectTransform8.anchoredPosition = new Vector2(0f, -6f);
rectTransform8.sizeDelta = new Vector2(-24f, 24f);
_statusText = AddText(obj16.transform, "Status", "Click to select · Enter to spawn · F1 for help", 14, (FontStyle)0, TextMuted, (TextAnchor)3);
RectTransform rectTransform9 = ((Graphic)_statusText).rectTransform;
rectTransform9.anchorMin = new Vector2(0f, 0f);
rectTransform9.anchorMax = new Vector2(1f, 0f);
rectTransform9.pivot = new Vector2(0.5f, 0f);
rectTransform9.anchoredPosition = new Vector2(0f, 10f);
rectTransform9.sizeDelta = new Vector2(-24f, 22f);
}
public static void RebuildList()
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_contentRt == (Object)null)
{
return;
}
string text = (((Object)(object)_searchField != (Object)null) ? _searchField.text : "");
int filteredCount = ItemDatabase.FilteredCount;
if (text == _lastFilter && filteredCount == _lastItemCount)
{
return;
}
_lastFilter = text;
_lastItemCount = filteredCount;
foreach (GameObject row in _rows)
{
if ((Object)(object)row != (Object)null)
{
Object.Destroy((Object)(object)row);
}
}
_rows.Clear();
_rowBgs.Clear();
_rowBtns.Clear();
_rowAccentBars.Clear();
if (filteredCount == 0)
{
_contentRt.sizeDelta = new Vector2(0f, 0f);
if ((Object)(object)_emptyHint != (Object)null)
{
_emptyHint.SetActive(true);
}
if ((Object)(object)_countText != (Object)null)
{
_countText.text = "0 items";
}
return;
}
if ((Object)(object)_emptyHint != (Object)null)
{
_emptyHint.SetActive(false);
}
if ((Object)(object)_countText != (Object)null)
{
_countText.text = string.Format("{0} item{1}", filteredCount, (filteredCount == 1) ? "" : "s");
}
IReadOnlyList<ItemDatabase.Entry> filtered = ItemDatabase.Filtered;
for (int i = 0; i < filtered.Count; i++)
{
ItemDatabase.Entry entry = filtered[i];
GameObject item = BuildRow(i, entry);
_rows.Add(item);
}
_contentRt.sizeDelta = new Vector2(0f, (float)filteredCount * 56f + 8f);
if (_selectedIndex >= filteredCount)
{
Deselect();
}
else if (_selectedIndex >= 0 && _selectedIndex < _rows.Count)
{
_selectedEntry = ItemDatabase.Filtered[_selectedIndex];
_selectedRow = _rows[_selectedIndex];
if (_rowBgs.Count > _selectedIndex)
{
((Graphic)_rowBgs[_selectedIndex]).color = RowSelected;
}
if (_rowAccentBars.Count > _selectedIndex)
{
_rowAccentBars[_selectedIndex].SetActive(true);
}
ScrollToSelected();
}
}
private static GameObject BuildRow(int index, ItemDatabase.Entry entry)
{
//IL_0032: 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_007b: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: 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_0104: 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)
//IL_0129: Expected O, but got Unknown
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: 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_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: 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_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: 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)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03e0: 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_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_045e: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Unknown result type (might be due to invalid IL or missing references)
//IL_0483: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_048a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = NewUiObject($"Row_{index}", (Transform)(object)_contentRt);
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 1f);
component.anchorMax = new Vector2(1f, 1f);
component.pivot = new Vector2(0.5f, 1f);
component.anchoredPosition = new Vector2(0f, 0f - ((float)index * 56f + 4f));
component.sizeDelta = new Vector2(-8f, 52f);
Image val2 = val.AddComponent<Image>();
((Graphic)val2).color = RowIdle;
((Graphic)val2).raycastTarget = true;
_rowBgs.Add(val2);
Button val3 = val.AddComponent<Button>();
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
ColorBlock colors = ((Selectable)val3).colors;
((ColorBlock)(ref colors)).highlightedColor = RowHover;
((ColorBlock)(ref colors)).pressedColor = RowSelected;
((ColorBlock)(ref colors)).selectedColor = RowSelected;
((ColorBlock)(ref colors)).normalColor = Color.white;
((Selectable)val3).colors = colors;
int captured = index;
((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
{
OnRowClicked(captured);
});
_rowBtns.Add(val3);
GameObject val4 = NewUiObject("Accent", val.transform);
RectTransform component2 = val4.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0f);
component2.anchorMax = new Vector2(0f, 1f);
component2.pivot = new Vector2(0f, 0.5f);
component2.anchoredPosition = new Vector2(0f, 0f);
component2.sizeDelta = new Vector2(3f, 0f);
Image obj = val4.AddComponent<Image>();
((Graphic)obj).color = Accent;
((Graphic)obj).raycastTarget = false;
val4.SetActive(false);
_rowAccentBars.Add(val4);
GameObject obj2 = NewUiObject("Icon", val.transform);
RectTransform component3 = obj2.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 0.5f);
component3.anchorMax = new Vector2(0f, 0.5f);
component3.pivot = new Vector2(0f, 0.5f);
component3.anchoredPosition = new Vector2(8f, 0f);
component3.sizeDelta = new Vector2(40f, 40f);
Image val5 = obj2.AddComponent<Image>();
if ((Object)(object)entry.Icon != (Object)null)
{
val5.sprite = entry.Icon;
}
else
{
val5.sprite = _whiteSprite;
((Graphic)val5).color = new Color(1f, 1f, 1f, 0.06f);
}
val5.preserveAspect = true;
((Graphic)val5).raycastTarget = false;
RectTransform rectTransform = ((Graphic)AddText(val.transform, "Name", entry.Name, 14, (FontStyle)1, Color.white, (TextAnchor)3)).rectTransform;
rectTransform.anchorMin = new Vector2(0f, 0.5f);
rectTransform.anchorMax = new Vector2(1f, 0.5f);
rectTransform.pivot = new Vector2(0f, 0.5f);
rectTransform.anchoredPosition = new Vector2(56f, 6f);
rectTransform.sizeDelta = new Vector2(-130f, 18f);
string arg = (((int)entry.Type == 0) ? "Station" : "Upgrade");
RectTransform rectTransform2 = ((Graphic)AddText(val.transform, "Sub", $"{arg} | ${entry.Cost}", 11, (FontStyle)0, TextMuted, (TextAnchor)3)).rectTransform;
rectTransform2.anchorMin = new Vector2(0f, 0.5f);
rectTransform2.anchorMax = new Vector2(1f, 0.5f);
rectTransform2.pivot = new Vector2(0f, 0.5f);
rectTransform2.anchoredPosition = new Vector2(56f, -10f);
rectTransform2.sizeDelta = new Vector2(-130f, 14f);
GameObject obj3 = NewUiObject("Dot", val.transform);
RectTransform component4 = obj3.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(1f, 0.5f);
component4.anchorMax = new Vector2(1f, 0.5f);
component4.pivot = new Vector2(1f, 0.5f);
component4.anchoredPosition = new Vector2(-12f, 0f);
component4.sizeDelta = new Vector2(8f, 8f);
Image obj4 = obj3.AddComponent<Image>();
((Graphic)obj4).color = (((int)entry.Type == 0) ? Accent2 : Accent);
((Graphic)obj4).raycastTarget = false;
return val;
}
private static void OnRowClicked(int index)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
if (_selectedIndex >= 0)
{
if (_selectedIndex < _rowBgs.Count)
{
((Graphic)_rowBgs[_selectedIndex]).color = RowIdle;
}
if (_selectedIndex < _rowAccentBars.Count)
{
_rowAccentBars[_selectedIndex].SetActive(false);
}
}
_selectedIndex = index;
_selectedEntry = ((index >= 0 && index < ItemDatabase.FilteredCount) ? ItemDatabase.Filtered[index] : null);
_selectedRow = ((index >= 0 && index < _rows.Count) ? _rows[index] : null);
if (VerboseLogging && _selectedEntry != null)
{
try
{
string text = (((Object)(object)_selectedEntry.WorldPrefab != (Object)null) ? ((Object)_selectedEntry.WorldPrefab).name : "<null>");
int num = (((Object)(object)_selectedEntry.Item != (Object)null) ? ((Object)_selectedEntry.Item).GetInstanceID() : 0);
Debug.Log((object)$"[ItemSpawner] OnRowClicked idx={index} name='{_selectedEntry.Name}' prefab='{text}' id={num}");
}
catch
{
}
}
if (_selectedIndex >= 0)
{
if (_rowBgs.Count > _selectedIndex)
{
((Graphic)_rowBgs[_selectedIndex]).color = RowSelected;
}
if (_rowAccentBars.Count > _selectedIndex)
{
_rowAccentBars[_selectedIndex].SetActive(true);
}
}
FocusRow(index);
ScrollToSelected();
}
public static void FocusRow(int index)
{
if (index < 0 || index >= _rows.Count || (Object)(object)_rows[index] == (Object)null)
{
return;
}
try
{
EventSystem current = EventSystem.current;
if (!((Object)(object)current == (Object)null))
{
if ((Object)(object)_searchField != (Object)null && _searchField.isFocused)
{
_searchField.DeactivateInputField();
}
current.SetSelectedGameObject(_rows[index]);
}
}
catch
{
}
}
public static void ScrollToSelected()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b2: 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)
if (_selectedIndex < 0 || _selectedIndex >= _rows.Count || (Object)(object)_scrollRect == (Object)null || (Object)(object)_contentRt == (Object)null || (Object)(object)_viewportRt == (Object)null)
{
return;
}
Rect rect = _contentRt.rect;
float height = ((Rect)(ref rect)).height;
rect = _viewportRt.rect;
float height2 = ((Rect)(ref rect)).height;
if (!(height <= height2 + 0.5f))
{
float num = (float)_selectedIndex * 56f + 28f - height2 * 0.5f;
float num2 = height - height2;
if (num < 0f)
{
num = 0f;
}
if (num > num2)
{
num = num2;
}
_contentRt.anchoredPosition = new Vector2(_contentRt.anchoredPosition.x, num);
}
}
public static void Deselect()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (_selectedIndex >= 0)
{
if (_selectedIndex < _rowBgs.Count)
{
((Graphic)_rowBgs[_selectedIndex]).color = RowIdle;
}
if (_selectedIndex < _rowAccentBars.Count)
{
_rowAccentBars[_selectedIndex].SetActive(false);
}
}
_selectedIndex = -1;
_selectedEntry = null;
_selectedRow = null;
}
public static void SetQuantity(int q)
{
if (q < 1)
{
q = 1;
}
if (q > 99)
{
q = 99;
}
Quantity = q;
if ((Object)(object)_qtyField != (Object)null)
{
_qtyField.text = q.ToString();
}
}
public static void NotifySearchChanged()
{
if (!((Object)(object)_searchField == (Object)null))
{
ItemDatabase.SetFilter(_searchField.text);
ItemDatabase.UpdateFilter();
RebuildList();
}
}
public static void SetHideWildCards(bool hide)
{
ItemDatabase.HideWildCards = hide;
ItemDatabase.UpdateFilter();
RebuildList();
}
public static void OnSearchSubmit()
{
if ((Object)(object)_searchField != (Object)null)
{
_searchField.DeactivateInputField();
}
}
public static void FocusSearch()
{
if ((Object)(object)_searchField == (Object)null)
{
return;
}
try
{
EventSystem current = EventSystem.current;
if ((Object)(object)current != (Object)null)
{
current.SetSelectedGameObject(((Component)_searchField).gameObject);
}
_searchField.ActivateInputField();
}
catch
{
}
}
public static bool IsRowFocused()
{
try
{
EventSystem current = EventSystem.current;
if ((Object)(object)current == (Object)null || (Object)(object)_contentRt == (Object)null)
{
return false;
}
GameObject currentSelectedGameObject = current.currentSelectedGameObject;
if ((Object)(object)currentSelectedGameObject == (Object)null)
{
return false;
}
return currentSelectedGameObject.transform.IsChildOf((Transform)(object)_contentRt);
}
catch
{
return false;
}
}
public static bool IsSearchFocused()
{
try
{
return (Object)(object)_searchField != (Object)null && _searchField.isFocused;
}
catch
{
return false;
}
}
public static bool IsQtyFocused()
{
try
{
return (Object)(object)_qtyField != (Object)null && _qtyField.isFocused;
}
catch
{
return false;
}
}
private static void EnsureEventSystem()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
EventSystem[] array = Object.FindObjectsOfType<EventSystem>();
if (array != null && array.Length != 0 && (Object)(object)array[0] != (Object)null)
{
Scene scene = ((Component)array[0]).gameObject.scene;
if (((Scene)(ref scene)).IsValid())
{
Object.DontDestroyOnLoad((Object)(object)((Component)array[0]).gameObject);
}
}
else
{
GameObject val = new GameObject("ItemSpawner_EventSystem");
val.AddComponent<EventSystem>();
val.AddComponent<StandaloneInputModule>();
Object.DontDestroyOnLoad((Object)val);
}
}
private static void BuildHelp()
{
//IL_0032: 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_0048: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: 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_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: 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_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: 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_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_0424: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0439: Unknown result type (might be due to invalid IL or missing references)
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_0492: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_0571: Unknown result type (might be due to invalid IL or missing references)
//IL_0586: Unknown result type (might be due to invalid IL or missing references)
//IL_0591: Unknown result type (might be due to invalid IL or missing references)
//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Expected O, but got Unknown
if (_helpBuilt)
{
return;
}
_helpBuilt = true;
_helpBackdrop = NewUiObject("HelpBackdrop", _root.transform);
RectTransform component = _helpBackdrop.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = Vector2.zero;
component.anchoredPosition = Vector2.zero;
Image obj = _helpBackdrop.AddComponent<Image>();
((Graphic)obj).color = new Color(0f, 0f, 0f, 0.55f);
((Graphic)obj).raycastTarget = true;
_helpBackdrop.SetActive(false);
_helpPanel = NewUiObject("HelpPanel", _helpBackdrop.transform);
RectTransform component2 = _helpPanel.GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0.5f, 0.5f);
component2.anchorMax = new Vector2(0.5f, 0.5f);
component2.pivot = new Vector2(0.5f, 0.5f);
component2.sizeDelta = new Vector2(420f, 480f);
component2.anchoredPosition = Vector2.zero;
Image obj2 = _helpPanel.AddComponent<Image>();
((Graphic)obj2).color = BgDark;
((Graphic)obj2).raycastTarget = true;
GameObject obj3 = NewUiObject("Accent", _helpPanel.transform);
RectTransform component3 = obj3.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(0f, 1f);
component3.anchorMax = new Vector2(1f, 1f);
component3.pivot = new Vector2(0.5f, 1f);
component3.anchoredPosition = new Vector2(0f, 0f);
component3.sizeDelta = new Vector2(0f, 3f);
((Graphic)obj3.AddComponent<Image>()).color = Accent;
GameObject val = NewUiObject("Header", _helpPanel.transform);
RectTransform component4 = val.GetComponent<RectTransform>();
component4.anchorMin = new Vector2(0f, 1f);
component4.anchorMax = new Vector2(1f, 1f);
component4.pivot = new Vector2(0.5f, 1f);
component4.anchoredPosition = new Vector2(0f, -3f);
component4.sizeDelta = new Vector2(0f, 50f);
((Graphic)val.AddComponent<Image>()).color = BgDarkAlt;
RectTransform rectTransform = ((Graphic)AddText(val.transform, "Title", "HOTKEYS", 19, (FontStyle)1, Color.white, (TextAnchor)3)).rectTransform;
rectTransform.anchorMin = new Vector2(0f, 0f);
rectTransform.anchorMax = new Vector2(1f, 1f);
rectTransform.offsetMin = new Vector2(18f, 0f);
rectTransform.offsetMax = new Vector2(-50f, 0f);
GameObject obj4 = NewUiObject("Close", val.transform);
RectTransform component5 = obj4.GetComponent<RectTransform>();
component5.anchorMin = new Vector2(1f, 0.5f);
component5.anchorMax = new Vector2(1f, 0.5f);
component5.pivot = new Vector2(1f, 0.5f);
component5.anchoredPosition = new Vector2(-6f, 0f);
component5.sizeDelta = new Vector2(36f, 36f);
Button val2 = obj4.AddComponent<Button>();
Image val3 = obj4.AddComponent<Image>();
((Graphic)val3).color = new Color(1f, 0.3f, 0.4f, 0.85f);
((Selectable)val2).targetGraphic = (Graphic)(object)val3;
ColorBlock colors = ((Selectable)val2).colors;
((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 0.4f, 0.5f, 1f);
((ColorBlock)(ref colors)).pressedColor = new Color(0.85f, 0.2f, 0.3f, 1f);
((Selectable)val2).colors = colors;
ButtonClickedEvent onClick = val2.onClick;
object obj5 = <>c.<>9__80_0;
if (obj5 == null)
{
UnityAction val4 = delegate
{
SetHelpOpen(open: false);
};
<>c.<>9__80_0 = val4;
obj5 = (object)val4;
}
((UnityEvent)onClick).AddListener((UnityAction)obj5);
RectTransform rectTransform2 = ((Graphic)AddText(obj4.transform, "X", "X", 17, (FontStyle)1, Color.white, (TextAnchor)4)).rectTransform;
rectTransform2.anchorMin = Vector2.zero;
rectTransform2.anchorMax = Vector2.one;
rectTransform2.sizeDelta = Vector2.zero;
rectTransform2.anchoredPosition = Vector2.zero;
GameObject obj6 = NewUiObject("Content", _helpPanel.transform);
RectTransform component6 = obj6.GetComponent<RectTransform>();
component6.anchorMin = new Vector2(0f, 0f);
component6.anchorMax = new Vector2(1f, 1f);
component6.offsetMin = new Vector2(20f, 20f);
component6.offsetMax = new Vector2(-20f, -55f);
_helpContent = AddText(obj6.transform, "HelpContent", "Loading...", 13, (FontStyle)0, TextDim, (TextAnchor)0);
RectTransform rectTransform3 = ((Graphic)_helpContent).rectTransform;
rectTransform3.anchorMin = Vector2.zero;
rectTransform3.anchorMax = Vector2.one;
rectTransform3.sizeDelta = Vector2.zero;
rectTransform3.anchoredPosition = Vector2.zero;
_helpContent.verticalOverflow = (VerticalWrapMode)1;
_helpContent.horizontalOverflow = (HorizontalWrapMode)0;
_helpContent.lineSpacing = 1.25f;
_helpContent.supportRichText = true;
GameObject obj7 = NewUiObject("Footer", _helpPanel.transform);
RectTransform component7 = obj7.GetComponent<RectTransform>();
component7.anchorMin = new Vector2(0f, 0f);
component7.anchorMax = new Vector2(1f, 0f);
component7.pivot = new Vector2(0.5f, 0f);
component7.anchoredPosition = Vector2.zero;
component7.sizeDelta = new Vector2(0f, 32f);
((Graphic)obj7.AddComponent<Image>()).color = BgDarkAlt;
RectTransform rectTransform4 = ((Graphic)AddText(obj7.transform, "Hint", "Press F1 or Esc to close", 11, (FontStyle)2, TextMuted, (TextAnchor)4)).rectTransform;
rectTransform4.anchorMin = Vector2.zero;
rectTransform4.anchorMax = Vector2.one;
rectTransform4.sizeDelta = Vector2.zero;
rectTransform4.anchoredPosition = Vector2.zero;
}
public static void SetHelpOpen(bool open)
{
IsHelpOpen = open;
if ((Object)(object)_helpBackdrop != (Object)null)
{
_helpBackdrop.SetActive(open);
}
if (open)
{
UpdateHelpText();
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
}
}
public static void ToggleHelp()
{
SetHelpOpen(!IsHelpOpen);
}
private static void UpdateHelpText()
{
if (!((Object)(object)_helpContent == (Object)null))
{
string arg = KeyDisplay(Plugin.ToggleKey, "F6");
string arg2 = KeyDisplay(Plugin.CloseKey, "Esc");
string arg3 = KeyDisplay(Plugin.HelpKey, "F1");
string text = KeyDisplay(Plugin.UpKey, "↑");
string text2 = KeyDisplay(Plugin.DownKey, "↓");
string arg4 = KeyDisplay(Plugin.SpawnKey, "Enter");
string arg5 = KeyDisplay(Plugin.IncreaseQtyKey, "=");
string arg6 = KeyDisplay(Plugin.DecreaseQtyKey, "-");
int num = ((Plugin.QuantityStep == null || Plugin.QuantityStep.Value <= 1) ? 1 : Plugin.QuantityStep.Value);
string text3 = ((num == 1) ? "" : $" (step: {num})");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("<b>PANEL</b>");
stringBuilder.AppendLine($" {arg,-10} toggle panel");
stringBuilder.AppendLine($" {arg2,-10} close panel");
stringBuilder.AppendLine($" {arg3,-10} show this help");
stringBuilder.AppendLine();
stringBuilder.AppendLine("<b>NAVIGATION</b>");
stringBuilder.AppendLine(string.Format(" {0,-10} move selection", text + " / " + text2));
stringBuilder.AppendLine(string.Format(" {0,-10} page up / down", "PgUp/PgDn"));
stringBuilder.AppendLine(string.Format(" {0,-10} jump first / last", "Home/End"));
stringBuilder.AppendLine(string.Format(" {0,-10} first-letter jump", "A-Z"));
stringBuilder.AppendLine();
stringBuilder.AppendLine("<b>SEARCH & SELECT</b>");
stringBuilder.AppendLine(string.Format(" {0,-10} filter list", "Type"));
stringBuilder.AppendLine(string.Format(" {0,-10} select item", "Click"));
stringBuilder.AppendLine();
stringBuilder.AppendLine("<b>QUANTITY</b>" + ((text3.Length > 0) ? (" <i>" + text3.Trim() + "</i>") : ""));
stringBuilder.AppendLine($" {arg5,-10} increase by {num}");
stringBuilder.AppendLine($" {arg6,-10} decrease by {num}");
stringBuilder.AppendLine();
stringBuilder.AppendLine("<b>SPAWN</b>");
stringBuilder.AppendLine($" {arg4,-10} spawn selected");
stringBuilder.AppendLine(string.Format(" {0,-10} spawn selected", "Space"));
_helpContent.text = stringBuilder.ToString();
}
}
private static string KeyDisplay(ConfigEntry<KeyboardShortcut> entry, string fallback)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (entry == null)
{
return fallback;
}
KeyboardShortcut value = entry.Value;
return KeyToDisplay(((KeyboardShortcut)(ref value)).MainKey, fallback);
}
private unsafe static string KeyToDisplay(KeyCode k, string fallback = null)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_001a: 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_00af: Expected I4, but got Unknown
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_00af: 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_00d0: Expected I4, but got Unknown
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_00d0: 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_0110: Expected I4, but got Unknown
if ((int)k <= 13)
{
if ((int)k == 9)
{
return "Tab";
}
if ((int)k == 13)
{
return "Enter";
}
}
else
{
switch (k - 27)
{
default:
switch (k - 91)
{
default:
switch (k - 269)
{
case 2:
return "Num Enter";
case 4:
return "Up";
case 5:
return "Down";
case 7:
return "Left";
case 6:
return "Right";
case 11:
return "PgUp";
case 12:
return "PgDn";
case 9:
return "Home";
case 10:
return "End";
case 1:
return "Num+";
case 0:
return "Num-";
}
break;
case 5:
return "`";
case 0:
return "[";
case 2:
return "]";
case 1:
return "\\";
case 3:
case 4:
break;
}
break;
case 34:
return "=";
case 18:
return "-";
case 16:
return "+";
case 5:
return "Space";
case 0:
return "Esc";
case 32:
return ";";
case 12:
return "'";
case 17:
return ",";
case 19:
return ".";
case 20:
return "/";
case 21:
return "0";
case 22:
return "1";
case 23:
return "2";
case 24:
return "3";
case 25:
return "4";
case 26:
return "5";
case 27:
return "6";
case 28:
return "7";
case 29:
return "8";
case 30:
return "9";
case 1:
case 2:
case 3:
case 4:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 13:
case 14:
case 15:
case 31:
case 33:
break;
}
}
return fallback ?? ((object)(*(KeyCode*)(&k))/*cast due to .constrained prefix*/).ToString();
}
private static void EnsureResources()
{
if ((Object)(object)_font == (Object)null)
{
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if ((Object)(object)val != (Object)null && ((Object)val).name != null && !((Object)val).name.Contains("Fallback"))
{
_font = val;
break;
}
}
if ((Object)(object)_font == (Object)null)
{
_font = Font.CreateDynamicFontFromOSFont("Arial", 14);
}
}
if ((Object)(object)_whiteSprite == (Object)null)
{
_whiteSprite = Resources.GetBuiltinResource<Sprite>("UI/Skin/Background.psd");
}
if ((Object)(object)_whiteSprite == (Object)null)
{
_whiteSprite = Resources.GetBuiltinResource<Sprite>("UISprite.psd");
}
if ((Object)(object)_whiteSprite == (Object)null)
{
_whiteSprite = Resources.GetBuiltinResource<Sprite>("Square.psd");
}
}
private static GameObject NewUiObject(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 Text AddText(Transform parent, string name, string text, int size, FontStyle style, Color color, TextAnchor align)
{
//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_0045: 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_0055: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent, false);
Text obj = val.AddComponent<Text>();
obj.text = text;
obj.font = _font;
obj.fontSize = size;
obj.fontStyle = style;
((Graphic)obj).color = color;
obj.alignment = align;
obj.horizontalOverflow = (HorizontalWrapMode)1;
obj.verticalOverflow = (VerticalWrapMode)1;
((Graphic)obj).raycastTarget = false;
return obj;
}
private static InputField AddInputField(GameObject parent, string placeholder)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: 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_0155: 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_018a: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("Input", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(parent.transform, false);
Image val2 = val.AddComponent<Image>();
((Graphic)val2).color = InputBg;
InputField val3 = val.AddComponent<InputField>();
((Selectable)val3).targetGraphic = (Graphic)(object)val2;
val3.text = "";
GameObject val4 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
val4.transform.SetParent(val.transform, false);
Text val5 = val4.AddComponent<Text>();
val5.font = _font;
val5.fontSize = 14;
((Graphic)val5).color = Color.white;
val5.supportRichText = false;
val5.horizontalOverflow = (HorizontalWrapMode)0;
val5.verticalOverflow = (VerticalWrapMode)1;
RectTransform rectTransform = ((Graphic)val5).rectTransform;
rectTransform.anchorMin = Vector2.zero;
rectTransform.anchorMax = Vector2.one;
rectTransform.offsetMin = new Vector2(8f, 4f);
rectTransform.offsetMax = new Vector2(-8f, -4f);
GameObject val6 = new GameObject("Placeholder", new Type[1] { typeof(RectTransform) });
val6.transform.SetParent(val.transform, false);
Text val7 = val6.AddComponent<Text>();
val7.font = _font;
val7.fontSize = 14;
((Graphic)val7).color = TextMuted;
val7.fontStyle = (FontStyle)2;
val7.text = placeholder;
val7.supportRichText = false;
RectTransform rectTransform2 = ((Graphic)val7).rectTransform;
rectTransform2.anchorMin = Vector2.zero;
rectTransform2.anchorMax = Vector2.one;
rectTransform2.offsetMin = new Vector2(8f, 4f);
rectTransform2.offsetMax = new Vector2(-8f, -4f);
val3.textComponent = val5;
val3.placeholder = (Graphic)(object)val7;
return val3;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.crashout.itemspawner";
public const string PLUGIN_NAME = "CrashoutCrewItemSpawner";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("com.crashout.itemspawner", "CrashoutCrewItemSpawner", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(NetworkManager), "Update")]
public static class NetworkManagerUpdatePatch
{
[HarmonyPrefix]
public static void Prefix()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_00f7: Invalid comparison between Unknown and I4
//IL_00d9: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: 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_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: 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)
ItemSpawnerUI.Build();
if (!_dbAttempted || (ItemDatabase.Count == 0 && Time.frameCount % 120 == 0))
{
_dbAttempted = true;
ItemDatabase.Refresh(Logger);
}
KeyboardShortcut value = ToggleKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
ItemSpawnerUI.Toggle();
if (ItemSpawnerUI.IsOpen)
{
ItemSpawnerUI.SetQuantity(DefaultQuantity.Value);
}
}
if (!ItemSpawnerUI.IsOpen)
{
return;
}
value = HelpKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
ItemSpawnerUI.ToggleHelp();
return;
}
if (ItemSpawnerUI.IsHelpOpen)
{
value = CloseKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown() || Input.GetKeyDown((KeyCode)27))
{
ItemSpawnerUI.SetHelpOpen(open: false);
}
return;
}
value = CloseKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown() || Input.GetKeyDown((KeyCode)27))
{
ItemSpawnerUI.SetOpen(open: false);
return;
}
if (ItemSpawnerUI.IsRowFocused())
{
for (KeyCode val = (KeyCode)97; (int)val <= 122; val = (KeyCode)(val + 1))
{
if (Input.GetKeyDown(val))
{
JumpToFirstLetter((char)(97 + (val - 97)));
break;
}
}
}
value = SpawnKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown() || Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271) || Input.GetKeyDown((KeyCode)32))
{
TrySpawnSelected();
}
if (!ItemSpawnerUI.IsSearchFocused() && !ItemSpawnerUI.IsQtyFocused())
{
value = IncreaseQtyKey.Value;
bool flag = ((KeyboardShortcut)(ref value)).IsDown() || Input.GetKeyDown((KeyCode)270);
value = DecreaseQtyKey.Value;
bool flag2 = ((KeyboardShortcut)(ref value)).IsDown() || Input.GetKeyDown((KeyCode)269);
if (flag || flag2)
{
int num = Mathf.Max(1, QuantityStep.Value);
ItemSpawnerUI.SetQuantity(flag ? (ItemSpawnerUI.Quantity + num) : (ItemSpawnerUI.Quantity - num));
}
}
value = UpKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
MoveSelection(-1);
}
value = DownKey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
MoveSelection(1);
}
if (Input.GetKeyDown((KeyCode)280))
{
MoveSelection(-8);
}
if (Input.GetKeyDown((KeyCode)281))
{
MoveSelection(8);
}
if (Input.GetKeyDown((KeyCode)278))
{
MoveSelectionTo(0);
}
if (Input.GetKeyDown((KeyCode)279))
{
MoveSelectionTo(int.MaxValue);
}
ItemSpawnerUI.NotifySearchChanged();
}
}
private static ManualLogSource _logger;
public static ConfigEntry<KeyboardShortcut> ToggleKey;
public static ConfigEntry<KeyboardShortcut> SpawnKey;
public static ConfigEntry<KeyboardShortcut> UpKey;
public static ConfigEntry<KeyboardShortcut> DownKey;
public static ConfigEntry<KeyboardShortcut> CloseKey;
public static ConfigEntry<KeyboardShortcut> HelpKey;
public static ConfigEntry<KeyboardShortcut> IncreaseQtyKey;
public static ConfigEntry<KeyboardShortcut> DecreaseQtyKey;
public static ConfigEntry<int> QuantityStep;
public static ConfigEntry<int> DefaultQuantity;
public static ConfigEntry<float> DropDistance;
public static ConfigEntry<float> DropHeight;
public static ConfigEntry<bool> HideWildCards;
public static ConfigEntry<bool> DebugLogging;
private static bool _dbAttempted;
internal static ManualLogSource Logger => _logger;
private void Awake()
{
//IL_0025: 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_007e: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Expected O, but got Unknown
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Expected O, but got Unknown
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Expected O, but got Unknown
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
_logger = ((BaseUnityPlugin)this).Logger;
ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "ToggleUI", new KeyboardShortcut((KeyCode)287, Array.Empty<KeyCode>()), "Open/close the item spawner panel.");
SpawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "SpawnSelected", new KeyboardShortcut((KeyCode)13, Array.Empty<KeyCode>()), "Spawn the currently selected item at the player's feet. Default is the regular Enter key. Numpad Enter (KeypadEnter) is also accepted automatically.");
UpKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "PrevItem", new KeyboardShortcut((KeyCode)273, Array.Empty<KeyCode>()), "Move selection up (when panel is open).");
DownKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "NextItem", new KeyboardShortcut((KeyCode)274, Array.Empty<KeyCode>()), "Move selection down (when panel is open).");
CloseKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "CloseUI", new KeyboardShortcut((KeyCode)27, Array.Empty<KeyCode>()), "Close the item spawner panel (Escape is also accepted when the panel is open).");
HelpKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "ToggleHelp", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), "Show or hide the in-panel hotkey help. Default F1. Works whenever the spawner panel is open.");
IncreaseQtyKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "IncreaseQuantity", new KeyboardShortcut((KeyCode)61, Array.Empty<KeyCode>()), "Increase the spawn quantity by QuantityStep (default +1). Default is the Equals/Plus key (=). Numpad Plus is also accepted automatically. Active when the panel is open AND the search/qty fields aren't focused.");
DecreaseQtyKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "DecreaseQuantity", new KeyboardShortcut((KeyCode)45, Array.Empty<KeyCode>()), "Decrease the spawn quantity by QuantityStep (default -1). Default is the Minus key (-). Numpad Minus is also accepted automatically. Active when the panel is open AND the search/qty fields aren't focused.");
QuantityStep = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "QuantityStep", 1, new ConfigDescription("How much each press of IncreaseQuantity/DecreaseQuantity changes the qty by.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>()));
DefaultQuantity = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "DefaultQuantity", 1, new ConfigDescription("Initial quantity when opening the panel.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), Array.Empty<object>()));
DropDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "DropDistance", 1.5f, new ConfigDescription("How far in front of the player the item drops (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
DropHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "DropHeight", 0f, new ConfigDescription("Vertical offset from camera for drop point (meters).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-2f, 5f), Array.Empty<object>()));
HideWildCards = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "HideWildCards", true, "When true (default), items whose worldItemPrefab is a WildCard mystery-box are hidden. Edit this value and restart the panel to apply.");
DebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "DebugLogging", false, "When true, log every click and spawn to LogOutput.log. Off by default for clean logs.");
new Harmony("com.crashout.itemspawner").PatchAll();
ItemSpawnerUI.SetQuantity(DefaultQuantity.Value);
ItemSpawnerUI.SetHideWildCards(HideWildCards.Value);
ItemSpawnerUI.VerboseLogging = DebugLogging.Value;
Logger.LogInfo((object)string.Format("{0} v{1} loaded — press {2} to toggle", "CrashoutCrewItemSpawner", "1.0.0", ToggleKey.Value));
}
private static void MoveSelection(int delta)
{
if (ItemDatabase.FilteredCount != 0)
{
int num = GetSelectedIndex();
if (num < 0)
{
num = -1;
}
MoveSelectionTo(num + delta);
}
}
private static void MoveSelectionTo(int target)
{
int filteredCount = ItemDatabase.FilteredCount;
if (filteredCount != 0)
{
if (target < 0)
{
target = 0;
}
if (target >= filteredCount)
{
target = filteredCount - 1;
}
UI_SelectByIndex(target);
}
}
private static void JumpToFirstLetter(char letter)
{
int filteredCount = ItemDatabase.FilteredCount;
if (filteredCount == 0)
{
return;
}
string value = char.ToLowerInvariant(letter).ToString();
int selectedIndex = GetSelectedIndex();
for (int i = 1; i <= filteredCount; i++)
{
int num = (selectedIndex + i) % filteredCount;
if (num < 0)
{
num += filteredCount;
}
ItemDatabase.Entry entry = ItemDatabase.Filtered[num];
if (entry != null)
{
string name = entry.Name;
if (!string.IsNullOrEmpty(name) && name.ToLowerInvariant().StartsWith(value))
{
UI_SelectByIndex(num);
break;
}
}
}
}
private static int GetSelectedIndex()
{
FieldInfo field = typeof(ItemSpawnerUI).GetField("_selectedIndex", BindingFlags.Static | BindingFlags.NonPublic);
if (!(field != null))
{
return -1;
}
return (int)field.GetValue(null);
}
private static void UI_SelectByIndex(int idx)
{
typeof(ItemSpawnerUI).GetMethod("OnRowClicked", BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, new object[1] { idx });
}
private static void TrySpawnSelected()
{
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: 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_0162: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
ItemDatabase.Entry selected = ItemSpawnerUI.GetSelected();
if (selected == null)
{
ItemSpawnerUI.SetStatus("No item selected — click an item first");
Logger.LogWarning((object)"[ItemSpawner] TrySpawnSelected: no entry selected");
return;
}
GameObject val = (((Object)(object)selected.Item != (Object)null) ? selected.Item.worldItemPrefab : null);
GameObject val2 = (((Object)(object)val != (Object)null) ? val : selected.WorldPrefab);
if ((Object)(object)val2 == (Object)null)
{
ItemSpawnerUI.SetStatus("Item '" + selected.Name + "' has no worldItemPrefab");
Logger.LogWarning((object)("[ItemSpawner] Item '" + selected.Name + "' has no worldItemPrefab"));
return;
}
int num = Mathf.Max(1, ItemSpawnerUI.Quantity);
Vector3 val3 = ResolveDropPosition();
Quaternion identity = Quaternion.identity;
if (DebugLogging.Value)
{
int num2 = (((Object)(object)selected.Item != (Object)null) ? ((Object)selected.Item).GetInstanceID() : 0);
Logger.LogInfo((object)$"[ItemSpawner] TrySpawnSelected name='{selected.Name}' prefab='{((Object)val2).name}' id={num2} qty={num} pos={val3}");
}
int num3 = 0;
Vector3 val4 = default(Vector3);
for (int i = 0; i < num; i++)
{
((Vector3)(ref val4))..ctor(Random.Range(-0.25f, 0.25f), 0f, Random.Range(-0.25f, 0.25f));
GameObject val5 = Object.Instantiate<GameObject>(val2, val3 + val4, identity);
if ((Object)(object)val5 == (Object)null)
{
continue;
}
num3++;
if ((Object)(object)val5.GetComponent<NetworkIdentity>() != (Object)null && NetworkServer.active)
{
try
{
NetworkServer.Spawn(val5, (NetworkConnectionToClient)null);
}
catch (Exception ex)
{
Logger.LogWarning((object)("[ItemSpawner] NetworkServer.Spawn failed: " + ex.Message));
}
}
}
Logger.LogInfo((object)$"[ItemSpawner] Spawned {num3}x {selected.Name} (prefab={((Object)val2).name}) at {val3}");
}
private static Vector3 ResolveDropPosition()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: 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_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Vector3.zero;
bool flag = false;
try
{
if ((Object)(object)NetworkClient.localPlayer != (Object)null && (Object)(object)((Component)NetworkClient.localPlayer).transform != (Object)null)
{
val = ((Component)NetworkClient.localPlayer).transform.position;
flag = true;
}
}
catch
{
}
if (!flag)
{
try
{
NetworkIdentity[] array = Object.FindObjectsOfType<NetworkIdentity>();
foreach (NetworkIdentity val2 in array)
{
if (val2.isLocalPlayer && (Object)(object)((Component)val2).transform != (Object)null)
{
val = ((Component)val2).transform.position;
flag = true;
break;
}
}
}
catch
{
}
}
if (!flag)
{
Camera main = Camera.main;
if ((Object)(object)main != (Object)null)
{
val = ((Component)main).transform.position + ((Component)main).transform.forward * DropDistance.Value;
}
}
Camera main2 = Camera.main;
if ((Object)(object)main2 != (Object)null)
{
Vector3 forward = ((Component)main2).transform.forward;
forward.y = 0f;
if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
{
forward = Vector3.forward;
}
((Vector3)(ref forward)).Normalize();
val += forward * DropDistance.Value;
val += Vector3.up * DropHeight.Value;
}
return val;
}
}
}