using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.UnityEngine;
using BepInEx.Logging;
using CrabQuickRecycle.UI;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CrabQuickRecycle")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CrabQuickRecycle")]
[assembly: AssemblyTitle("CrabQuickRecycle")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CrabQuickRecycle
{
internal class Configuration
{
public static KeyCode menuToggle = (KeyCode)46;
public static KeyCode nextKey = (KeyCode)13;
public static KeyCode previousKey = (KeyCode)8;
public static KeyCode upKey = (KeyCode)273;
public static KeyCode downKey = (KeyCode)274;
public static KeyCode leftKey = (KeyCode)276;
public static KeyCode rightKey = (KeyCode)275;
public static float initialScrollDelay = 0.15f;
public static float scrollInterval = 0.05f;
public static void ReloadConfigValues()
{
((BasePlugin)CrabQuickRecycle.Instance).Config.Reload();
GetConfigEntry(ref menuToggle, "menuToggle");
GetConfigEntry(ref nextKey, "nextKey");
GetConfigEntry(ref previousKey, "previousKey");
GetConfigEntry(ref upKey, "upKey");
GetConfigEntry(ref downKey, "downKey");
GetConfigEntry(ref leftKey, "leftKey");
GetConfigEntry(ref rightKey, "rightKey");
GetConfigEntry(ref initialScrollDelay, "initialScrollDelay");
GetConfigEntry(ref scrollInterval, "scrollInterval");
}
internal static void GetConfigEntry<T>(ref T value, string name)
{
ConfigEntry<T> val = default(ConfigEntry<T>);
if (((BasePlugin)CrabQuickRecycle.Instance).Config.TryGetEntry<T>("CrabQuickRecycle", name, ref val))
{
value = val.Value;
}
}
}
internal class Inventory
{
public struct ItemData
{
public int ItemId;
public ulong UniqueId;
public string Name;
public int Quantity;
public Dictionary<string, string> Tags;
public ObjectNPublicIComparableStDi2InStStUnique SteamCosmeticItem;
}
public static List<ItemData> InventoryItemDataList = new List<ItemData>();
public static List<ItemData> RecycleItemDataList = new List<ItemData>();
public static List<string> PossibleTags = new List<string>();
public static Dictionary<string, string[]> PossibleTagValues = new Dictionary<string, string[]>();
public static void GetInventory()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
InventoryItemDataList.Clear();
Enumerator<ulong, ObjectNPublicIComparableStDi2InStStUnique> enumerator = MonoBehaviourPublicStCaSt1ObSthaUIStmaUnique.inventoryItems.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<ulong, ObjectNPublicIComparableStDi2InStStUnique> current = enumerator.Current;
int itemId = (int)current.Value.field_Public_SteamItemDetails_t_0.m_iDefinition;
ItemData itemData = default(ItemData);
itemData.ItemId = itemId;
itemData.UniqueId = current.Key;
itemData.Name = GetItemName(itemId);
itemData.Quantity = current.Value.field_Public_SteamItemDetails_t_0.m_unQuantity;
itemData.Tags = current.Value.field_Public_Dictionary_2_String_String_0;
itemData.SteamCosmeticItem = current.Value;
ItemData item = itemData;
InventoryItemDataList.Add(item);
}
try
{
UIInventoryContent.SetCurrentIndex(0);
UIInventoryContent.UpdateList();
UIInspector.UpdateDisplay(0);
}
catch
{
}
}
public static void GetPossibleTags()
{
PossibleTags.Clear();
foreach (ItemData inventoryItemData in InventoryItemDataList)
{
Enumerator<string, string> enumerator2 = inventoryItemData.Tags.GetEnumerator();
while (enumerator2.MoveNext())
{
KeyValuePair<string, string> current = enumerator2.Current;
if (!PossibleTags.Contains(current.Key))
{
PossibleTags.Add(current.Key);
}
}
}
}
public static void GetPossibleTagValues()
{
PossibleTagValues.Clear();
foreach (string possibleTag in PossibleTags)
{
HashSet<string> hashSet = new HashSet<string>();
foreach (ItemData inventoryItemData in InventoryItemDataList)
{
if (inventoryItemData.Tags.ContainsKey(possibleTag))
{
hashSet.Add(inventoryItemData.Tags[possibleTag]);
}
}
PossibleTagValues[possibleTag] = new List<string>(hashSet).ToArray();
}
}
public static string GetItemName(int ItemId)
{
Enumerator<CosmeticItem> enumerator = MonoBehaviourPublicLi1CoalDi2InitCoUIUnique.Instance.allCosmetics.GetEnumerator();
while (enumerator.MoveNext())
{
CosmeticItem current = enumerator.Current;
if (current.itemdefid == ItemId)
{
return current.name;
}
}
return null;
}
public static string GetItemColor(ObjectNPublicIComparableStDi2InStStUnique item)
{
if (item == null || item.field_Public_Dictionary_2_String_String_0 == null)
{
return "#FFFFFF";
}
string result = default(string);
if (item.field_Public_Dictionary_2_String_String_0.TryGetValue("color", ref result))
{
return result;
}
return "#FFFFFF";
}
}
internal static class Patches
{
private static ManualLogSource logger = Logger.CreateLogSource("CrabQuickRecycle");
private static readonly float initialRepeatDelay = Configuration.initialScrollDelay;
private static readonly float repeatInterval = Configuration.scrollInterval;
private static Dictionary<KeyCode, float> lastActionTime = new Dictionary<KeyCode, float>();
private static Dictionary<KeyCode, bool> wasKeyHeld = new Dictionary<KeyCode, bool>();
[HarmonyPatch(typeof(MonoBehaviourPublicGataInefObInUnique), "Method_Private_Void_GameObject_Boolean_Vector3_Quaternion_0")]
[HarmonyPatch(typeof(MonoBehaviourPublicCSDi2UIInstObUIloDiUnique), "Method_Private_Void_0")]
[HarmonyPrefix]
internal static bool PreBepinexDetection()
{
return false;
}
[HarmonyPatch(typeof(MonoBehaviourPublicGalomeGacrsemiGaupObUnique), "Awake")]
[HarmonyPostfix]
internal static void PostGeneralUiInventoryAwake()
{
Configuration.ReloadConfigValues();
UICreator.InitializeUI();
UIUpdater.SetMenuOpen(open: false);
UIUpdater.UpdateControlsText();
}
[HarmonyPatch(typeof(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique), "Update")]
[HarmonyPostfix]
internal static void SteamManagerUpdate()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected I4, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected I4, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected I4, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected I4, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected I4, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected I4, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: 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_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "Menu")
{
return;
}
try
{
if (Input.GetKeyDown((KeyCode)Configuration.menuToggle))
{
bool menuOpen = !UIUpdater.IsMenuOpen;
UIUpdater.SetMenuOpen(menuOpen);
UIUpdater.UpdateControlsText();
}
UIUpdater.UpdateControlsText();
KeyCode[] array = (KeyCode[])(object)new KeyCode[6]
{
(KeyCode)(int)Configuration.upKey,
(KeyCode)(int)Configuration.downKey,
(KeyCode)(int)Configuration.leftKey,
(KeyCode)(int)Configuration.rightKey,
(KeyCode)(int)Configuration.nextKey,
(KeyCode)(int)Configuration.previousKey
};
KeyCode[] array2 = array;
foreach (KeyCode val in array2)
{
bool key = Input.GetKey(val);
bool keyDown = Input.GetKeyDown(val);
bool flag = wasKeyHeld.ContainsKey(val) && wasKeyHeld[val];
float unscaledTime = Time.unscaledTime;
float num = (lastActionTime.ContainsKey(val) ? lastActionTime[val] : 0f);
if (keyDown)
{
DoNavigation(val);
lastActionTime[val] = unscaledTime;
wasKeyHeld[val] = true;
}
else if (key)
{
if (!flag)
{
lastActionTime[val] = unscaledTime;
wasKeyHeld[val] = true;
continue;
}
float num2 = unscaledTime - num;
if (!(num2 >= initialRepeatDelay))
{
continue;
}
float num3 = (num2 - initialRepeatDelay) / repeatInterval;
if (num3 >= 0f)
{
float num4 = num + initialRepeatDelay + Mathf.Floor(num3) * repeatInterval;
if (unscaledTime >= num4)
{
DoNavigation(val);
lastActionTime[val] = unscaledTime;
}
}
}
else
{
wasKeyHeld[val] = false;
}
}
try
{
bool key2 = Input.GetKey((KeyCode)Configuration.nextKey);
UIMainMenuContent.UpdateHold(key2, Time.unscaledDeltaTime);
}
catch
{
}
}
catch (Exception ex)
{
ManualLogSource val2 = logger;
bool flag2 = default(bool);
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Exception in SteamManagerUpdate: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
}
val2.LogError(val3);
}
}
private static void DoNavigation(KeyCode key)
{
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_00a7: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
try
{
if (key == (KeyCode)Configuration.upKey)
{
if (UIMainMenuContent.isUsingThisPanel)
{
UIMainMenuContent.MoveUp();
}
if (UIInventoryContent.isUsingThisPanel)
{
UIInventoryContent.MoveUp();
}
}
else if (key == (KeyCode)Configuration.downKey)
{
if (UIMainMenuContent.isUsingThisPanel)
{
UIMainMenuContent.MoveDown();
}
if (UIInventoryContent.isUsingThisPanel)
{
UIInventoryContent.MoveDown();
}
}
else if (key == (KeyCode)Configuration.leftKey)
{
UIInventoryContent.isUsingThisPanel = false;
UIMainMenuContent.isUsingThisPanel = true;
}
else if (key == (KeyCode)Configuration.rightKey)
{
UIInventoryContent.isUsingThisPanel = true;
UIMainMenuContent.isUsingThisPanel = false;
}
else if (key == (KeyCode)Configuration.nextKey)
{
if (UIMainMenuContent.isUsingThisPanel)
{
UIMainMenuContent.EnterSelectedOption();
}
else if (UIInventoryContent.isUsingThisPanel)
{
UIInventoryContent.ForceKeepCurrentItem();
}
}
else if (key == (KeyCode)Configuration.previousKey)
{
if (UIMainMenuContent.isUsingThisPanel)
{
UIMainMenuContent.Back();
}
else if (UIInventoryContent.isUsingThisPanel)
{
UIInventoryContent.ForceRecycleCurrentItem();
}
}
UIMainMenuContent.UpdateMenuDisplay();
UIInventoryContent.UpdateList();
try
{
if (UIInventoryContent.isUsingThisPanel)
{
UIInspector.UpdateDisplay(UIInventoryContent.GetCurrentIndex());
}
}
catch
{
}
}
catch (Exception ex)
{
ManualLogSource val = logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DoNavigation error: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
val.LogWarning(val2);
}
}
}
[BepInPlugin("Albion.CrabQuickRecycle", "CrabQuickRecycle", "1.0.0")]
public class CrabQuickRecycle : BasePlugin
{
internal static CrabQuickRecycle Instance;
internal static ManualLogSource logger = Logger.CreateLogSource("CrabQuickRecycle");
public override void Load()
{
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture;
Instance = this;
BindConfigValues(ref Configuration.menuToggle, "menuToggle", "Key to toggle the menu on/off");
BindConfigValues(ref Configuration.nextKey, "nextKey", "Key to interact with");
BindConfigValues(ref Configuration.previousKey, "previousKey", "Key to go back");
BindConfigValues(ref Configuration.upKey, "upKey", "Key to navigate up");
BindConfigValues(ref Configuration.downKey, "downKey", "Key to navigate down");
BindConfigValues(ref Configuration.leftKey, "leftKey", "Key to navigate left");
BindConfigValues(ref Configuration.rightKey, "rightKey", "Key to navigate right");
BindConfigValues(ref Configuration.initialScrollDelay, "initialScrollDelay", "Initial delay before scrolling starts");
BindConfigValues(ref Configuration.scrollInterval, "scrollInterval", "Interval between scroll actions");
Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded [");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CrabQuickRecycle");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
}
log.LogInfo(val);
}
internal void BindConfigValues<T>(ref T value, string name, string description)
{
value = ((BasePlugin)this).Config.Bind<T>("CrabQuickRecycle", name, value, description).Value;
}
}
internal static class ConfirmedRecycle
{
public static void Run()
{
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
bool flag = default(bool);
try
{
if (Inventory.RecycleItemDataList == null || Inventory.RecycleItemDataList.Count == 0)
{
CrabQuickRecycle.logger.LogInfo((object)"ConfirmedRecycle.Run: no items to recycle");
return;
}
foreach (Inventory.ItemData recycleItemData in Inventory.RecycleItemDataList)
{
ManualLogSource logger = CrabQuickRecycle.logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Recycling item: UniqueId=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(recycleItemData.UniqueId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Name='");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(recycleItemData.Name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', ItemId=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(recycleItemData.ItemId);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Quantity=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(recycleItemData.Quantity);
}
logger.LogInfo(val);
MonoBehaviourPublicGapaCacaTrCacawiReSiUnique.Instance.field_Private_UInt64_0 = recycleItemData.UniqueId;
MonoBehaviourPublicGapaCacaTrCacawiReSiUnique.Instance.Recycle();
MonoBehaviourPublicGareTecoObinpaGaIninUnique.Instance.ActuallyRecycle();
}
Inventory.RecycleItemDataList.Clear();
CrabQuickRecycle.logger.LogInfo((object)"ConfirmedRecycle.Run: recycle list processed and cleared.");
try
{
CrabQuickRecycle.logger.LogInfo((object)"ConfirmedRecycle.Run: resetting UI and closing menu");
UIMainMenuContent.ResetAndClose();
}
catch (Exception ex)
{
try
{
ManualLogSource logger2 = CrabQuickRecycle.logger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(42, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ConfirmedRecycle.Run: failed to reset UI: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
logger2.LogWarning(val2);
}
catch
{
}
}
}
catch (Exception ex2)
{
try
{
ManualLogSource logger3 = CrabQuickRecycle.logger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("ConfirmedRecycle.Run error: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex2);
}
logger3.LogError(val3);
}
catch
{
}
}
}
}
internal class UIInspector
{
public static void UpdateDisplay(int index)
{
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Expected O, but got Unknown
bool flag = default(bool);
try
{
if (index < 0 || index >= Inventory.InventoryItemDataList.Count)
{
return;
}
Inventory.ItemData item = Inventory.InventoryItemDataList[index];
object obj = null;
try
{
Enumerator<CosmeticItem> enumerator = MonoBehaviourPublicLi1CoalDi2InitCoUIUnique.Instance.allCosmetics.GetEnumerator();
while (enumerator.MoveNext())
{
CosmeticItem current = enumerator.Current;
if (current.itemdefid == item.ItemId)
{
obj = current;
break;
}
}
}
catch
{
}
try
{
if ((Object)(object)UIObjects.MenuItemDisplay != (Object)null)
{
MethodInfo method = ((object)UIObjects.MenuItemDisplay).GetType().GetMethod("SetItem", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (method != null)
{
try
{
method.Invoke(UIObjects.MenuItemDisplay, new object[2]
{
obj,
item.SteamCosmeticItem.field_Public_Dictionary_2_String_String_0
});
}
catch (TargetInvocationException ex)
{
try
{
ManualLogSource val = Logger.CreateLogSource("CrabQuickRecycle");
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("MenuItemDisplay.SetItem invocation failed: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex.InnerException);
}
val.LogWarning(val2);
}
catch
{
}
}
}
}
}
catch (Exception)
{
}
try
{
string text = InspectItemText(item);
if ((Object)(object)UIObjects.InspectDetailsText != (Object)null)
{
UIObjects.InspectDetailsText.text = text;
}
}
catch (Exception ex3)
{
try
{
ManualLogSource val3 = Logger.CreateLogSource("CrabQuickRecycle");
BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Inspector.UpdateDisplay failed to set details: ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex3);
}
val3.LogError(val4);
}
catch
{
}
}
}
catch (Exception ex4)
{
try
{
ManualLogSource val5 = Logger.CreateLogSource("CrabQuickRecycle");
BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Inspector.UpdateDisplay error: ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex4);
}
val5.LogError(val4);
}
catch
{
}
}
}
public static string InspectItemText(Inventory.ItemData item)
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("Item Inspection:");
stringBuilder.AppendLine($"Item ID: {item.ItemId}");
stringBuilder.AppendLine($"Unique ID: {item.UniqueId}");
stringBuilder.AppendLine("Name: " + item.Name);
string text = "";
string text2 = "";
string text3 = "";
string text4 = "";
string text5 = "";
try
{
if (item.Tags != null)
{
if (item.Tags.ContainsKey("rarity"))
{
text = item.Tags["rarity"];
}
if (item.Tags.ContainsKey("brand"))
{
text2 = item.Tags["brand"];
}
if (item.Tags.ContainsKey("color"))
{
text3 = item.Tags["color"];
}
if (item.Tags.ContainsKey("shiny"))
{
text4 = item.Tags["shiny"];
}
if (item.Tags.ContainsKey("rareness"))
{
text5 = item.Tags["rareness"];
}
}
}
catch
{
}
stringBuilder.AppendLine("Rarity: " + text);
stringBuilder.AppendLine("Brand: " + text2);
stringBuilder.AppendLine("Color: " + text3);
stringBuilder.AppendLine("Shiny: " + text4);
stringBuilder.AppendLine("Rareness: " + text5);
stringBuilder.AppendLine($"Quantity: {item.Quantity}");
return stringBuilder.ToString();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "CrabQuickRecycle";
public const string PLUGIN_NAME = "CrabQuickRecycle";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace CrabQuickRecycle.UI
{
internal class UICreator
{
private static ManualLogSource logger = Logger.CreateLogSource("CrabQuickRecycle");
public static void InitializeUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_00b2: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: 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_0134: Expected O, but got Unknown
//IL_016d: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Expected O, but got Unknown
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Expected O, but got Unknown
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0452: 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)
//IL_0494: Expected O, but got Unknown
//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0501: Unknown result type (might be due to invalid IL or missing references)
//IL_051b: Unknown result type (might be due to invalid IL or missing references)
//IL_0535: Unknown result type (might be due to invalid IL or missing references)
//IL_0585: Unknown result type (might be due to invalid IL or missing references)
//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
//IL_05c7: Expected O, but got Unknown
//IL_0600: Unknown result type (might be due to invalid IL or missing references)
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_0634: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_0668: Unknown result type (might be due to invalid IL or missing references)
//IL_069b: Unknown result type (might be due to invalid IL or missing references)
//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
//IL_06cd: Expected O, but got Unknown
//IL_0706: Unknown result type (might be due to invalid IL or missing references)
//IL_0720: Unknown result type (might be due to invalid IL or missing references)
//IL_073a: Unknown result type (might be due to invalid IL or missing references)
//IL_0754: Unknown result type (might be due to invalid IL or missing references)
//IL_076e: 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_07ea: Unknown result type (might be due to invalid IL or missing references)
//IL_07f4: Expected O, but got Unknown
//IL_082d: Unknown result type (might be due to invalid IL or missing references)
//IL_0847: 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_087b: Unknown result type (might be due to invalid IL or missing references)
//IL_0895: Unknown result type (might be due to invalid IL or missing references)
//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0911: Unknown result type (might be due to invalid IL or missing references)
//IL_091b: Expected O, but got Unknown
//IL_0954: Unknown result type (might be due to invalid IL or missing references)
//IL_096e: Unknown result type (might be due to invalid IL or missing references)
//IL_0988: Unknown result type (might be due to invalid IL or missing references)
//IL_09a2: Unknown result type (might be due to invalid IL or missing references)
//IL_09bc: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0a6f: Unknown result type (might be due to invalid IL or missing references)
//IL_0a85: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
//IL_0aaf: Expected O, but got Unknown
UIObjects.defaultFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
UIObjects.CanvasObj = new GameObject("RecycleMenu_Canvas");
UIObjects.canvas = UIObjects.CanvasObj.AddComponent<Canvas>();
UIObjects.canvas.renderMode = (RenderMode)0;
UIObjects.canvas.sortingOrder = 100;
UIObjects.CanvasObj.AddComponent<CanvasScaler>();
GraphicRaycaster val = UIObjects.CanvasObj.AddComponent<GraphicRaycaster>();
((Behaviour)val).enabled = false;
CanvasGroup val2 = UIObjects.CanvasObj.AddComponent<CanvasGroup>();
val2.blocksRaycasts = false;
val2.interactable = false;
val2.ignoreParentGroups = true;
UIObjects.CanvasObj.SetActive(true);
UIObjects.CanvasObjRect = UIObjects.CanvasObj.GetComponent<RectTransform>();
UIObjects.CanvasObjRect.anchoredPosition = new Vector2(960f, 540f);
UIObjects.CanvasObjRect.sizeDelta = new Vector2(1920f, 1080f);
UIObjects.CanvasObjRect.anchorMin = new Vector2(0f, 0f);
UIObjects.CanvasObjRect.anchorMax = new Vector2(0f, 0f);
UIObjects.CanvasObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.QuestionsObj = new GameObject("Questions");
UIObjects.QuestionsObj.transform.SetParent(UIObjects.CanvasObj.transform, false);
UIObjects.QuestionsObjRect = UIObjects.QuestionsObj.AddComponent<RectTransform>();
UIObjects.QuestionsObjRect.anchoredPosition = new Vector2(217f, 0f);
UIObjects.QuestionsObjRect.sizeDelta = new Vector2(-1432.056f, 0f);
UIObjects.QuestionsObjRect.anchorMin = new Vector2(0f, 0f);
UIObjects.QuestionsObjRect.anchorMax = new Vector2(1f, 1f);
UIObjects.QuestionsObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.QuestionsObjImage = UIObjects.QuestionsObj.AddComponent<Image>();
((Graphic)UIObjects.QuestionsObjImage).color = new Color(0f, 0f, 0f, 0.8f);
((Graphic)UIObjects.QuestionsObjImage).raycastTarget = false;
UIObjects.QuestionsObj.SetActive(false);
UIObjects.HeaderObj = new GameObject("Header");
UIObjects.HeaderObj.transform.SetParent(UIObjects.QuestionsObj.transform, false);
UIObjects.HeaderObjRect = UIObjects.HeaderObj.AddComponent<RectTransform>();
UIObjects.HeaderObjRect.anchoredPosition = new Vector2(0.0005722f, -35.881f);
UIObjects.HeaderObjRect.sizeDelta = new Vector2(487.94f, 71.763f);
UIObjects.HeaderObjRect.anchorMin = new Vector2(0.5f, 1f);
UIObjects.HeaderObjRect.anchorMax = new Vector2(0.5f, 1f);
UIObjects.HeaderObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.HeaderObjText = UIObjects.HeaderObj.AddComponent<Text>();
UIObjects.HeaderObjText.text = "RecycleMenu";
UIObjects.HeaderObjText.fontSize = 60;
((Graphic)UIObjects.HeaderObjText).color = new Color(83f / 106f, 83f / 106f, 83f / 106f, 1f);
UIObjects.HeaderObjText.font = UIObjects.defaultFont;
((Graphic)UIObjects.HeaderObjText).raycastTarget = false;
UIObjects.QuestionTextObj = new GameObject("QuestionText");
UIObjects.QuestionTextObj.transform.SetParent(UIObjects.QuestionsObj.transform, false);
UIObjects.QuestionTextObjRect = UIObjects.QuestionTextObj.AddComponent<RectTransform>();
UIObjects.QuestionTextObjRect.anchoredPosition = new Vector2(0.0005722f, -156.4185f);
UIObjects.QuestionTextObjRect.sizeDelta = new Vector2(487.94f, 169.32f);
UIObjects.QuestionTextObjRect.anchorMin = new Vector2(0.5f, 1f);
UIObjects.QuestionTextObjRect.anchorMax = new Vector2(0.5f, 1f);
UIObjects.QuestionTextObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.QuestionTextObjText = UIObjects.QuestionTextObj.AddComponent<Text>();
UIObjects.QuestionTextObjText.text = "Made by Albion";
UIObjects.QuestionTextObjText.fontSize = 20;
((Graphic)UIObjects.QuestionTextObjText).color = new Color(1f, 1f, 1f, 0.05f);
UIObjects.QuestionTextObjText.font = UIObjects.defaultFont;
UIObjects.QuestionTextObjText.alignment = (TextAnchor)1;
((Graphic)UIObjects.QuestionTextObjText).raycastTarget = false;
UIObjects.ContentObj = new GameObject("Content");
UIObjects.ContentObj.transform.SetParent(UIObjects.QuestionsObj.transform, false);
UIObjects.ContentObjRect = UIObjects.ContentObj.AddComponent<RectTransform>();
UIObjects.ContentObjRect.anchoredPosition = new Vector2(0.002037f, -660.54f);
UIObjects.ContentObjRect.sizeDelta = new Vector2(487.94f, 838.92f);
UIObjects.ContentObjRect.anchorMin = new Vector2(0.5f, 1f);
UIObjects.ContentObjRect.anchorMax = new Vector2(0.5f, 1f);
UIObjects.ContentObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.ContentObjText = UIObjects.ContentObj.AddComponent<Text>();
UIObjects.ContentObjText.text = "Question Text";
UIObjects.ContentObjText.fontSize = 40;
((Graphic)UIObjects.ContentObjText).color = new Color(1f, 1f, 1f, 1f);
UIObjects.ContentObjText.font = UIObjects.defaultFont;
UIObjects.ContentObjText.alignment = (TextAnchor)1;
((Graphic)UIObjects.ContentObjText).raycastTarget = false;
UIObjects.ItemListObj = new GameObject("ItemList");
UIObjects.ItemListObj.transform.SetParent(UIObjects.CanvasObj.transform, false);
UIObjects.ItemListObjRect = UIObjects.ItemListObj.AddComponent<RectTransform>();
UIObjects.ItemListObjRect.anchoredPosition = new Vector2(716.03f, 0f);
UIObjects.ItemListObjRect.sizeDelta = new Vector2(-1432.056f, 0f);
UIObjects.ItemListObjRect.anchorMin = new Vector2(0f, 0f);
UIObjects.ItemListObjRect.anchorMax = new Vector2(1f, 1f);
UIObjects.ItemListObjRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.ItemListObjImage = UIObjects.ItemListObj.AddComponent<Image>();
((Graphic)UIObjects.ItemListObjImage).color = new Color(0f, 0f, 0f, 0.8f);
((Graphic)UIObjects.ItemListObjImage).raycastTarget = false;
UIObjects.ItemListObj.SetActive(false);
UIObjects.ItemListHeader = new GameObject("Header");
UIObjects.ItemListHeader.transform.SetParent(UIObjects.ItemListObj.transform, false);
UIObjects.ItemListHeaderRect = UIObjects.ItemListHeader.AddComponent<RectTransform>();
UIObjects.ItemListHeaderRect.anchoredPosition = new Vector2(0.0005722f, -35.881f);
UIObjects.ItemListHeaderRect.sizeDelta = new Vector2(487.94f, 71.763f);
UIObjects.ItemListHeaderRect.anchorMin = new Vector2(0.5f, 1f);
UIObjects.ItemListHeaderRect.anchorMax = new Vector2(0.5f, 1f);
UIObjects.ItemListHeaderRect.pivot = new Vector2(0.5f, 0.5f);
UIObjects.ItemListHeaderText = UIObjects.ItemListHeader.AddComponent<Text>();
UIObjects.ItemListHeaderText.text = "Cosmetics";
UIObjects.ItemListHeaderText.fontSize = 60;
((Graphic)UIObjects.ItemListHeaderText).color = new Color(83f / 106f, 83f / 106f, 83f / 106f, 1f);
UIObjects.ItemListHeaderText.font = UIObjects.defaultFont;
((Graphic)UIObjects.ItemListHeaderText).raycastTarget = false;
UIObjects.ItemListContent = new GameObject("Content");
UIObjects.ItemListContent.transform.SetParent(UIObjects.ItemListObj.transform, false);
UIObjects.ItemListContentRect = UIObjects.ItemListContent.AddComponent<RectTransform>();
UIObjects.ItemListContentRect.anchoredPosition = new Vector2(5.783203f, -575.88f);
UIObjects.ItemListContentRect.sizeDelta = new Vector2(476.3736f, 1008.2f);
UIObjects.ItemListContentRect.anchorMin = new Vector2(0.5f, 1f);
UIObjects.ItemListContentRect.anchorMax = new Vector2(0.5f, 1f);
UIObjects.ItemListContentRect.pivot = new Vector2(0.5f, 0.4999999f);
UIObjects.ItemListContentText = UIObjects.ItemListContent.AddComponent<Text>();
UIObjects.ItemListContentText.text = "Question Text";
UIObjects.ItemListContentText.fontSize = 30;
((Graphic)UIObjects.ItemListContentText).color = new Color(1f, 1f, 1f, 1f);
UIObjects.ItemListContentText.font = UIObjects.defaultFont;
((Graphic)UIObjects.ItemListContentText).raycastTarget = false;
UIObjects.ControlsTextObj = new GameObject("ControlsText");
UIObjects.ControlsTextObj.transform.SetParent(UIObjects.CanvasObj.transform, false);
UIObjects.ControlsTextObjRect = UIObjects.ControlsTextObj.AddComponent<RectTransform>();
UIObjects.ControlsTextObjRect.anchorMin = new Vector2(0f, 0f);
UIObjects.ControlsTextObjRect.anchorMax = new Vector2(0f, 0f);
UIObjects.ControlsTextObjRect.pivot = new Vector2(0f, 0f);
UIObjects.ControlsTextObjRect.anchoredPosition = new Vector2(20f, 20f);
UIObjects.ControlsTextObjRect.sizeDelta = new Vector2(420f, 220f);
UIObjects.ControlsTextObjText = UIObjects.ControlsTextObj.AddComponent<Text>();
UIObjects.ControlsTextObjText.text = "Controls: [Your controls info here]";
UIObjects.ControlsTextObjText.fontSize = 16;
((Graphic)UIObjects.ControlsTextObjText).color = new Color(1f, 1f, 1f, 1f);
UIObjects.ControlsTextObjText.font = UIObjects.defaultFont;
UIObjects.ControlsTextObjText.alignment = (TextAnchor)6;
UIObjects.ControlsTextObjText.horizontalOverflow = (HorizontalWrapMode)0;
UIObjects.ControlsTextObjText.verticalOverflow = (VerticalWrapMode)1;
UIObjects.ControlsTextObjText.supportRichText = true;
((Graphic)UIObjects.ControlsTextObjText).raycastTarget = false;
Outline val3 = UIObjects.ControlsTextObj.AddComponent<Outline>();
((Shadow)val3).effectColor = Color.black;
((Shadow)val3).effectDistance = new Vector2(2f, -2f);
try
{
UIUpdater.UpdateControlsText();
}
catch (Exception ex)
{
ManualLogSource val4 = logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to update controls text during InitializeUI: ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Exception>(ex);
}
val4.LogWarning(val5);
}
InspectItemDisplayUI();
if ((Object)(object)UIObjects.MenuItemDisplay != (Object)null && (Object)(object)((Component)UIObjects.MenuItemDisplay).gameObject != (Object)null)
{
((Component)UIObjects.MenuItemDisplay).gameObject.SetActive(false);
}
if ((Object)(object)UIObjects.QuestionsObj != (Object)null)
{
UIObjects.QuestionsObj.SetActive(false);
}
if ((Object)(object)UIObjects.ItemListObj != (Object)null)
{
UIObjects.ItemListObj.SetActive(false);
}
}
public static void InspectItemDisplayUI()
{
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Expected O, but got Unknown
//IL_033d: 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_038d: 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_0402: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("EssentialUI/InspectItemDisplay");
if ((Object)(object)val == (Object)null)
{
logger.LogWarning((object)"Could not find EssentialUI/InspectItemDisplay");
return;
}
GameObject val2 = Object.Instantiate<GameObject>(val);
((Object)val2).name = "InspectItemDisplay_Copy";
val2.transform.SetParent(UIObjects.CanvasObj.transform, false);
val2.transform.position = new Vector3(742f, 914f, 0f);
val2.transform.localScale = Vector3.one * 0.5f;
CanvasGroup val3 = val2.GetComponent<CanvasGroup>();
if ((Object)(object)val3 == (Object)null)
{
val3 = val2.AddComponent<CanvasGroup>();
}
val3.blocksRaycasts = false;
val3.interactable = false;
val3.ignoreParentGroups = true;
UIObjects.MenuItemDisplay = val2.GetComponent<MonoBehaviourPublicTeteTritMeMaitMeyiQuUnique>();
Transform val4 = val2.transform.Find("Overlay/GameSettingsWindow/Footer");
if ((Object)(object)val4 != (Object)null)
{
((Component)val4).gameObject.SetActive(false);
}
else
{
logger.LogWarning((object)"Footer not found");
}
Transform val5 = val2.transform.Find("Overlay/GameSettingsWindow/Header");
if ((Object)(object)val5 != (Object)null)
{
((Component)val5).gameObject.SetActive(false);
}
else
{
logger.LogWarning((object)"Header not found");
}
Transform val6 = val2.transform.Find("Overlay");
if ((Object)(object)val6 != (Object)null)
{
((Component)val6).gameObject.SetActive(true);
RawImage component = ((Component)val6).GetComponent<RawImage>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = false;
}
else
{
logger.LogWarning((object)"RawImage not found on Overlay");
}
}
else
{
logger.LogWarning((object)"Overlay not found");
}
Transform val7 = val2.transform.Find("Overlay/GameSettingsWindow");
if ((Object)(object)val7 != (Object)null)
{
RawImage component2 = ((Component)val7).GetComponent<RawImage>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
else
{
logger.LogWarning((object)"RawImage not found on GameSettingsWindow");
}
}
else
{
logger.LogWarning((object)"GameSettingsWindow not found");
}
Transform val8 = val2.transform.Find("Overlay/GameSettingsWindow/Cosmetics/ViewPort");
if ((Object)(object)val8 != (Object)null)
{
RawImage component3 = ((Component)val8).GetComponent<RawImage>();
if ((Object)(object)component3 != (Object)null)
{
((Graphic)component3).color = new Color(0f, 0f, 0f, 0f);
((Graphic)component3).raycastTarget = false;
}
else
{
logger.LogWarning((object)"RawImage not found on ViewPort");
}
}
else
{
logger.LogWarning((object)"ViewPort not found");
}
Transform val9 = val2.transform.Find("Overlay/InspectRoom/RoomModel");
if ((Object)(object)val9 != (Object)null)
{
((Component)val9).gameObject.SetActive(false);
}
else
{
logger.LogWarning((object)"RoomModel not found");
}
try
{
GameObject val10 = new GameObject("InspectDetailsText");
val10.transform.SetParent(val2.transform, false);
RectTransform val11 = val10.AddComponent<RectTransform>();
((Transform)val11).position = new Vector3(742f, 500f, 0f);
val11.sizeDelta = new Vector2(420f, 1000f);
UIObjects.InspectDetailsText = val10.AddComponent<Text>();
UIObjects.InspectDetailsText.font = UIObjects.defaultFont;
UIObjects.InspectDetailsText.fontSize = 24;
((Graphic)UIObjects.InspectDetailsText).color = Color.white;
UIObjects.InspectDetailsText.alignment = (TextAnchor)0;
UIObjects.InspectDetailsText.supportRichText = true;
UIObjects.InspectDetailsText.text = "";
((Graphic)UIObjects.InspectDetailsText).raycastTarget = false;
Outline val12 = val10.AddComponent<Outline>();
((Shadow)val12).effectColor = new Color(0f, 0f, 0f, 1f);
((Shadow)val12).effectDistance = new Vector2(2f, -2f);
}
catch (Exception ex)
{
ManualLogSource val13 = logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val14 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val14).AppendLiteral("Failed to create InspectDetailsText: ");
((BepInExLogInterpolatedStringHandler)val14).AppendFormatted<Exception>(ex);
}
val13.LogWarning(val14);
}
try
{
val2.SetActive(false);
}
catch
{
}
}
}
internal static class UIInventoryContent
{
public static bool isUsingThisPanel = false;
private const int TotalLines = 29;
private const int HeaderLines = 2;
private static int currentIndex = 0;
private static int inventoryViewStart = 0;
private static readonly HashSet<ulong> selectedItemIds = new HashSet<ulong>();
internal static int GetCurrentIndex()
{
return currentIndex;
}
internal static void SetCurrentIndex(int index)
{
List<Inventory.ItemData> inventoryItemDataList = Inventory.InventoryItemDataList;
if (inventoryItemDataList == null || inventoryItemDataList.Count == 0)
{
currentIndex = 0;
inventoryViewStart = 0;
return;
}
if (index < 0)
{
index = 0;
}
if (index >= inventoryItemDataList.Count)
{
index = inventoryItemDataList.Count - 1;
}
currentIndex = index;
EnsureInventoryVisible(inventoryItemDataList.Count);
}
internal static void MoveUp()
{
SetCurrentIndex(currentIndex - 1);
}
internal static void MoveDown()
{
SetCurrentIndex(currentIndex + 1);
}
private static void EnsureIndexInRange(int itemCount)
{
if (itemCount <= 0)
{
currentIndex = 0;
return;
}
if (currentIndex < 0)
{
currentIndex = 0;
}
if (currentIndex >= itemCount)
{
currentIndex = itemCount - 1;
}
}
private static void EnsureInventoryVisible(int itemCount)
{
int num = Math.Max(1, 27);
if (itemCount <= num)
{
inventoryViewStart = 0;
}
else if (currentIndex < inventoryViewStart)
{
inventoryViewStart = currentIndex;
}
else if (currentIndex >= inventoryViewStart + num)
{
inventoryViewStart = currentIndex - num + 1;
}
}
public static void ToggleCurrentItemSelection()
{
List<Inventory.ItemData> inventoryItemDataList = Inventory.InventoryItemDataList;
if (inventoryItemDataList != null && inventoryItemDataList.Count != 0)
{
EnsureIndexInRange(inventoryItemDataList.Count);
Inventory.ItemData itemData = inventoryItemDataList[currentIndex];
if (selectedItemIds.Contains(itemData.UniqueId))
{
selectedItemIds.Remove(itemData.UniqueId);
}
else
{
selectedItemIds.Add(itemData.UniqueId);
}
UpdateList();
UIMainMenuContent.UpdateMenuDisplay();
}
}
public static void ForceKeepCurrentItem()
{
List<Inventory.ItemData> inventoryItemDataList = Inventory.InventoryItemDataList;
if (inventoryItemDataList != null && inventoryItemDataList.Count != 0)
{
EnsureIndexInRange(inventoryItemDataList.Count);
Inventory.ItemData item = inventoryItemDataList[currentIndex];
Inventory.RecycleItemDataList.RemoveAll((Inventory.ItemData x) => x.UniqueId == item.UniqueId);
selectedItemIds.Remove(item.UniqueId);
UpdateList();
UIMainMenuContent.UpdateMenuDisplay();
}
}
public static void ForceRecycleCurrentItem()
{
List<Inventory.ItemData> inventoryItemDataList = Inventory.InventoryItemDataList;
if (inventoryItemDataList != null && inventoryItemDataList.Count != 0)
{
EnsureIndexInRange(inventoryItemDataList.Count);
Inventory.ItemData item = inventoryItemDataList[currentIndex];
if (!Inventory.RecycleItemDataList.Exists((Inventory.ItemData x) => x.UniqueId == item.UniqueId))
{
Inventory.RecycleItemDataList.Add(item);
}
selectedItemIds.Remove(item.UniqueId);
UpdateList();
UIMainMenuContent.UpdateMenuDisplay();
}
}
public static void UpdateList()
{
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Expected O, but got Unknown
bool flag = default(bool);
try
{
if ((Object)(object)UIObjects.ItemListContentText == (Object)null)
{
CrabQuickRecycle.logger.LogWarning((object)"UIInventoryContent.UpdateList: ItemListContentText is null");
return;
}
UIObjects.ItemListContentText.supportRichText = true;
List<Inventory.ItemData> inventoryItemDataList = Inventory.InventoryItemDataList;
if (inventoryItemDataList == null)
{
CrabQuickRecycle.logger.LogWarning((object)"UIInventoryContent.UpdateList: Inventory.InventoryItemDataList is null");
UIObjects.ItemListContentText.text = "<b>No items</b>";
return;
}
int num = Inventory.RecycleItemDataList?.Count ?? 0;
EnsureIndexInRange(inventoryItemDataList.Count);
EnsureInventoryVisible(inventoryItemDataList.Count);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine($"<b>Total Items:</b> <color=#FFFFFF>{inventoryItemDataList.Count}</color>");
stringBuilder.AppendLine($"<b>To Recycle:</b> <color=#FFAAAA>{num}</color> <b>Selected:</b> <color=#66FF66>{selectedItemIds.Count}</color>");
int num2 = Math.Max(1, 27);
int num3 = inventoryViewStart;
int num4 = Math.Min(inventoryItemDataList.Count, num3 + num2);
for (int i = num3; i < num4; i++)
{
Inventory.ItemData item = inventoryItemDataList[i];
string text;
try
{
text = UIInventoryFormatter.FormatCurrentItem(item).ToString();
}
catch (Exception ex)
{
text = "<error formatting item>";
ManualLogSource logger = CrabQuickRecycle.logger;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(64, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UIInventoryContent.UpdateList: Error formatting item at index ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(i);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogError(val);
}
string text2 = (Inventory.RecycleItemDataList.Exists((Inventory.ItemData x) => x.UniqueId == item.UniqueId) ? "#FF6666" : "#66FF66");
string text3 = (selectedItemIds.Contains(item.UniqueId) ? ("<b>" + text + "</b>") : text);
if (i == currentIndex)
{
if (isUsingThisPanel)
{
stringBuilder.AppendLine("<color=#FFFF66>» <color=" + text2 + ">" + text3 + "</color></color>");
}
else
{
stringBuilder.AppendLine("<color=#AAAAAA>» <color=" + text2 + ">" + text3 + "</color></color>");
}
}
else
{
stringBuilder.AppendLine("<color=" + text2 + ">" + text3 + "</color>");
}
}
if (num4 < inventoryItemDataList.Count)
{
stringBuilder.AppendLine("<i>...more...</i>");
}
if ((Object)(object)UIObjects.ItemListContentText != (Object)null)
{
UIObjects.ItemListContentText.text = stringBuilder.ToString();
}
else
{
CrabQuickRecycle.logger.LogWarning((object)"ItemListContentText became null before setting text");
}
}
catch (Exception ex2)
{
ManualLogSource logger2 = CrabQuickRecycle.logger;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("UIInventoryContent.UpdateList: Exception - ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex2);
}
logger2.LogError(val);
}
}
}
internal class UIInventoryFormatter
{
public static string FormatCurrentItem(Inventory.ItemData item)
{
StringBuilder stringBuilder = new StringBuilder();
float result = 0f;
if (item.Tags != null && item.Tags.ContainsKey("shiny"))
{
string text = item.Tags["shiny"];
if (!float.TryParse(text, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result))
{
string s = text?.Replace(',', '.');
if (!float.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result))
{
result = 0f;
}
}
}
stringBuilder.Append(FormatShiny(result));
stringBuilder.Append(item.Name);
stringBuilder.Append($"(<color=#d6d6d6>{item.Quantity}x</color>) ");
string brand = ((item.Tags != null && item.Tags.ContainsKey("brand")) ? item.Tags["brand"] : "");
stringBuilder.Append(FormatBrand(brand));
string color = ((item.Tags != null && item.Tags.ContainsKey("color")) ? item.Tags["color"] : "");
stringBuilder.Append(FormatColor(color));
return stringBuilder.ToString().Trim();
}
public static string FormatBrand(string brand)
{
return (!string.IsNullOrEmpty(brand)) ? ("<color=#FFA500>" + brand + "</color>") : "";
}
public static string FormatColor(string color)
{
return (!string.IsNullOrEmpty(color)) ? ("[" + ColorToRichText(color) + "]") : "";
}
public static string ColorToRichText(string color)
{
return color?.ToLowerInvariant() switch
{
"orange" => "<color=#FFA500>orange</color>",
"red" => "<color=#FF0000>red</color>",
"blue" => "<color=#0000FF>blue</color>",
"gray" => "<color=#808080>gray</color>",
"brown" => "<color=#8B4513>brown</color>",
"creme" => "<color=#FFFACD>creme</color>",
"light blue" => "<color=#ADD8E6>light blue</color>",
"green" => "<color=#00FF00>green</color>",
"blond" => "<color=#FFF700>blond</color>",
"black" => "<color=#000000>black</color>",
"pink" => "<color=#FFC0CB>pink</color>",
"golden" => "<color=#FFD700>golden</color>",
_ => color ?? string.Empty,
};
}
public static string FormatShiny(float shiny)
{
return (shiny != 0f) ? "<color=#FFA500>[S]</color> " : "";
}
}
internal static class UIMainMenuContent
{
public enum MenuState
{
Main,
Filters,
TagValues,
ConfirmRecycle
}
public static bool isUsingThisPanel;
public static Action OnRecycleSelected;
public static Action<string> OnOpenTagValues;
public static Action OnMenuChanged;
private static readonly List<string> mainOptions;
private static int mainSelectedIndex;
private static readonly List<string> filterTags;
private static int filterSelectedIndex;
private static string openedTag;
private static readonly Dictionary<string, List<string>> tagValues;
private static int tagValueSelectedIndex;
private static readonly Dictionary<string, HashSet<string>> removeTagValues;
private const int visibleWindowSize = 15;
private static int filterViewStart;
private static int tagValuesViewStart;
private const float confirmHoldRequiredSeconds = 5f;
private static float confirmHoldProgress;
private static bool confirmInProgress;
private static float confirmHoldStartTime;
private static bool confirmComplete;
private static float confirmCompleteStartTime;
private const float confirmCompleteDuration = 2f;
public static MenuState State { get; private set; }
static UIMainMenuContent()
{
isUsingThisPanel = true;
mainOptions = new List<string> { "Filters", "Recycle" };
mainSelectedIndex = 0;
filterTags = new List<string>();
filterSelectedIndex = 0;
openedTag = null;
tagValues = new Dictionary<string, List<string>>();
tagValueSelectedIndex = 0;
removeTagValues = new Dictionary<string, HashSet<string>>(StringComparer.InvariantCultureIgnoreCase);
State = MenuState.Main;
filterViewStart = 0;
tagValuesViewStart = 0;
confirmHoldProgress = 0f;
confirmInProgress = false;
confirmHoldStartTime = -1f;
confirmComplete = false;
confirmCompleteStartTime = -1f;
OnRecycleSelected = (Action)Delegate.Combine(OnRecycleSelected, (Action)delegate
{
try
{
ConfirmedRecycle.Run();
}
catch
{
}
});
}
public static void RefreshFromInventory()
{
try
{
List<string> list = new List<string>();
HashSet<string> hashSet = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (Inventory.PossibleTags != null)
{
foreach (string possibleTag in Inventory.PossibleTags)
{
if (!string.IsNullOrEmpty(possibleTag) && hashSet.Add(possibleTag))
{
list.Add(possibleTag);
}
}
}
if (Inventory.PossibleTagValues != null)
{
foreach (KeyValuePair<string, string[]> possibleTagValue in Inventory.PossibleTagValues)
{
string key = possibleTagValue.Key;
if (!string.IsNullOrEmpty(key) && hashSet.Add(key))
{
list.Add(key);
}
}
}
if (Inventory.InventoryItemDataList != null)
{
foreach (Inventory.ItemData inventoryItemData in Inventory.InventoryItemDataList)
{
try
{
if (inventoryItemData.Tags == null)
{
continue;
}
Enumerator<string, string> enumerator4 = inventoryItemData.Tags.Keys.GetEnumerator();
while (enumerator4.MoveNext())
{
string current3 = enumerator4.Current;
if (!string.IsNullOrEmpty(current3) && hashSet.Add(current3))
{
list.Add(current3);
}
}
}
catch
{
}
}
}
string text = list.Find((string t) => string.Equals(t, "Name", StringComparison.InvariantCultureIgnoreCase));
string tag;
if (text == null)
{
list.Insert(0, "Name");
tag = "Name";
}
else
{
list.Remove(text);
list.Insert(0, text);
tag = text;
}
SetFilterTags(list);
if (Inventory.PossibleTagValues != null)
{
foreach (KeyValuePair<string, string[]> possibleTagValue2 in Inventory.PossibleTagValues)
{
SetTagValues(possibleTagValue2.Key, possibleTagValue2.Value);
}
}
HashSet<string> hashSet2 = new HashSet<string>();
if (Inventory.InventoryItemDataList != null)
{
foreach (Inventory.ItemData inventoryItemData2 in Inventory.InventoryItemDataList)
{
string text2 = inventoryItemData2.Name;
if (string.IsNullOrEmpty(text2))
{
text2 = "none";
}
hashSet2.Add(text2);
}
}
SetTagValues(tag, hashSet2);
filterViewStart = 0;
tagValuesViewStart = 0;
}
catch (Exception)
{
}
}
public static void NextOption()
{
switch (State)
{
case MenuState.Main:
mainSelectedIndex = (mainSelectedIndex + 1) % mainOptions.Count;
break;
case MenuState.Filters:
filterSelectedIndex = (filterSelectedIndex + 1) % Math.Max(1, filterTags.Count);
EnsureFilterVisible();
break;
case MenuState.TagValues:
{
List<string> currentTagValues = GetCurrentTagValues();
if (currentTagValues.Count > 0)
{
tagValueSelectedIndex = (tagValueSelectedIndex + 1) % currentTagValues.Count;
}
EnsureTagValuesVisible();
break;
}
}
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
public static void PreviousOption()
{
switch (State)
{
case MenuState.Main:
mainSelectedIndex = (mainSelectedIndex - 1 + mainOptions.Count) % mainOptions.Count;
break;
case MenuState.Filters:
if (filterTags.Count > 0)
{
filterSelectedIndex = (filterSelectedIndex - 1 + filterTags.Count) % filterTags.Count;
}
EnsureFilterVisible();
break;
case MenuState.TagValues:
{
List<string> currentTagValues = GetCurrentTagValues();
if (currentTagValues.Count > 0)
{
tagValueSelectedIndex = (tagValueSelectedIndex - 1 + currentTagValues.Count) % currentTagValues.Count;
}
EnsureTagValuesVisible();
break;
}
}
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
public static void MoveUp()
{
PreviousOption();
}
public static void MoveDown()
{
NextOption();
}
public static void EnterSelectedOption()
{
switch (State)
{
case MenuState.Main:
{
string text = mainOptions[mainSelectedIndex];
if (text == "Filters")
{
State = MenuState.Filters;
filterSelectedIndex = Math.Min(filterSelectedIndex, Math.Max(0, filterTags.Count - 1));
filterViewStart = 0;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
else if (text == "Recycle")
{
State = MenuState.ConfirmRecycle;
confirmHoldProgress = 0f;
confirmInProgress = false;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
break;
}
case MenuState.Filters:
if (filterTags.Count != 0)
{
openedTag = filterTags[filterSelectedIndex];
tagValueSelectedIndex = 0;
State = MenuState.TagValues;
tagValuesViewStart = 0;
OnOpenTagValues?.Invoke(openedTag);
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
break;
case MenuState.TagValues:
{
List<string> currentTagValues = GetCurrentTagValues();
if (currentTagValues.Count != 0)
{
string value = currentTagValues[tagValueSelectedIndex];
ToggleTagValueRemoval(openedTag, value);
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
break;
}
case MenuState.ConfirmRecycle:
break;
}
}
public static void Back()
{
switch (State)
{
case MenuState.Main:
break;
case MenuState.Filters:
State = MenuState.Main;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
break;
case MenuState.TagValues:
openedTag = null;
State = MenuState.Filters;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
break;
case MenuState.ConfirmRecycle:
confirmHoldProgress = 0f;
confirmInProgress = false;
State = MenuState.Main;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
break;
}
}
private static void EnsureFilterVisible()
{
if (filterTags.Count <= 15)
{
filterViewStart = 0;
}
else if (filterSelectedIndex < filterViewStart)
{
filterViewStart = filterSelectedIndex;
}
else if (filterSelectedIndex >= filterViewStart + 15)
{
filterViewStart = filterSelectedIndex - 15 + 1;
}
}
private static void EnsureTagValuesVisible()
{
List<string> currentTagValues = GetCurrentTagValues();
if (currentTagValues.Count <= 15)
{
tagValuesViewStart = 0;
}
else if (tagValueSelectedIndex < tagValuesViewStart)
{
tagValuesViewStart = tagValueSelectedIndex;
}
else if (tagValueSelectedIndex >= tagValuesViewStart + 15)
{
tagValuesViewStart = tagValueSelectedIndex - 15 + 1;
}
}
public static void SetFilterTags(IEnumerable<string> tags)
{
filterTags.Clear();
if (tags != null)
{
foreach (string tag in tags)
{
if (!string.IsNullOrEmpty(tag))
{
filterTags.Add(tag);
}
}
}
filterSelectedIndex = 0;
filterViewStart = 0;
OnMenuChanged?.Invoke();
}
public static void SetTagValues(string tag, IEnumerable<string> values)
{
if (string.IsNullOrEmpty(tag))
{
return;
}
tagValues.Remove(tag);
List<string> list = new List<string>();
if (values != null)
{
foreach (string value in values)
{
if (string.IsNullOrEmpty(value))
{
list.Add(MapEmptyValue(tag));
}
else
{
list.Add(value);
}
}
}
if (list.Count == 0)
{
list.Add(MapEmptyValue(tag));
}
tagValues[tag] = list;
if (openedTag == tag)
{
tagValueSelectedIndex = 0;
}
tagValuesViewStart = 0;
OnMenuChanged?.Invoke();
}
public static IReadOnlyList<string> GetCurrentMenuItems()
{
return State switch
{
MenuState.Main => mainOptions,
MenuState.Filters => filterTags.AsReadOnly(),
MenuState.TagValues => GetCurrentTagValues().AsReadOnly(),
_ => Array.Empty<string>(),
};
}
public static int GetCurrentSelectedIndex()
{
MenuState state = State;
if (1 == 0)
{
}
int result = state switch
{
MenuState.Main => mainSelectedIndex,
MenuState.Filters => filterSelectedIndex,
MenuState.TagValues => tagValueSelectedIndex,
_ => 0,
};
if (1 == 0)
{
}
return result;
}
public static string GetCurrentHeader()
{
MenuState state = State;
if (1 == 0)
{
}
string result = state switch
{
MenuState.Main => "Main",
MenuState.Filters => "Filters",
MenuState.TagValues => openedTag ?? "Values",
_ => string.Empty,
};
if (1 == 0)
{
}
return result;
}
private static string MapEmptyValue(string tagName)
{
if (string.Equals(tagName, "shiny", StringComparison.InvariantCultureIgnoreCase))
{
return "0";
}
return "none";
}
private static bool IsMarkedForRemoval(string tag, string value)
{
if (string.IsNullOrEmpty(tag) || value == null)
{
return false;
}
if (removeTagValues.TryGetValue(tag, out var value2))
{
return value2.Contains(value);
}
return false;
}
private static void ToggleTagValueRemoval(string tag, string value)
{
if (string.IsNullOrEmpty(tag) || value == null)
{
return;
}
if (!removeTagValues.TryGetValue(tag, out var value2))
{
value2 = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
removeTagValues[tag] = value2;
}
if (value2.Contains(value))
{
value2.Remove(value);
Inventory.RecycleItemDataList.RemoveAll(delegate(Inventory.ItemData item)
{
string text2 = null;
if (string.Equals(tag, "Name", StringComparison.InvariantCultureIgnoreCase))
{
text2 = item.Name;
if (string.IsNullOrEmpty(text2))
{
text2 = "none";
}
}
else
{
if (item.Tags != null && item.Tags.ContainsKey(tag))
{
text2 = item.Tags[tag];
}
if (string.IsNullOrEmpty(text2))
{
text2 = MapEmptyValue(tag);
}
}
return string.Equals(text2, value, StringComparison.InvariantCultureIgnoreCase);
});
return;
}
value2.Add(value);
foreach (Inventory.ItemData item2 in Inventory.InventoryItemDataList)
{
string text = null;
if (string.Equals(tag, "Name", StringComparison.InvariantCultureIgnoreCase))
{
text = item2.Name;
if (string.IsNullOrEmpty(text))
{
text = "none";
}
}
else
{
if (item2.Tags != null && item2.Tags.ContainsKey(tag))
{
text = item2.Tags[tag];
}
if (string.IsNullOrEmpty(text))
{
text = MapEmptyValue(tag);
}
}
if (string.Equals(text, value, StringComparison.InvariantCultureIgnoreCase) && !Inventory.RecycleItemDataList.Exists((Inventory.ItemData x) => x.UniqueId == item2.UniqueId))
{
Inventory.RecycleItemDataList.Add(item2);
}
}
}
private static (int totalMatches, int inRecycleMatches) GetTagValueCounts(string tag, string value)
{
if (string.IsNullOrEmpty(tag) || value == null)
{
return (0, 0);
}
int num = 0;
int num2 = 0;
foreach (Inventory.ItemData inventoryItemData in Inventory.InventoryItemDataList)
{
string text = null;
if (string.Equals(tag, "Name", StringComparison.InvariantCultureIgnoreCase))
{
text = inventoryItemData.Name;
if (string.IsNullOrEmpty(text))
{
text = "none";
}
}
else
{
if (inventoryItemData.Tags != null && inventoryItemData.Tags.ContainsKey(tag))
{
text = inventoryItemData.Tags[tag];
}
if (string.IsNullOrEmpty(text))
{
text = MapEmptyValue(tag);
}
}
if (string.Equals(text, value, StringComparison.InvariantCultureIgnoreCase))
{
num++;
}
}
foreach (Inventory.ItemData recycleItemData in Inventory.RecycleItemDataList)
{
string text2 = null;
if (string.Equals(tag, "Name", StringComparison.InvariantCultureIgnoreCase))
{
text2 = recycleItemData.Name;
if (string.IsNullOrEmpty(text2))
{
text2 = "none";
}
}
else
{
if (recycleItemData.Tags != null && recycleItemData.Tags.ContainsKey(tag))
{
text2 = recycleItemData.Tags[tag];
}
if (string.IsNullOrEmpty(text2))
{
text2 = MapEmptyValue(tag);
}
}
if (string.Equals(text2, value, StringComparison.InvariantCultureIgnoreCase))
{
num2++;
}
}
return (num, num2);
}
public static void UpdateMenuDisplay()
{
try
{
(string, string) displayContent = GetDisplayContent(isUsingThisPanel);
if ((Object)(object)UIObjects.HeaderObjText != (Object)null)
{
UIObjects.HeaderObjText.text = displayContent.Item1;
}
if ((Object)(object)UIObjects.ContentObjText != (Object)null)
{
UIObjects.ContentObjText.supportRichText = true;
UIObjects.ContentObjText.text = displayContent.Item2;
}
}
catch (Exception)
{
}
}
public static (string header, string body) GetDisplayContent(bool isActivePanel)
{
StringBuilder stringBuilder = new StringBuilder();
if (State == MenuState.ConfirmRecycle)
{
bool flag = false;
try
{
foreach (Inventory.ItemData recycleItemData in Inventory.RecycleItemDataList)
{
if (recycleItemData.Tags != null && recycleItemData.Tags.ContainsKey("shiny") && !string.IsNullOrEmpty(recycleItemData.Tags["shiny"]) && recycleItemData.Tags["shiny"] != "0")
{
flag = true;
break;
}
}
}
catch
{
}
if (flag)
{
stringBuilder.AppendLine("<color=#FFCC00>Warning: Shiny items included in recycle list!</color>");
}
stringBuilder.AppendLine("Hold to confirm recycle");
float num = Math.Clamp(confirmHoldProgress / 5f, 0f, 1f);
int num2 = 20;
int num3 = (int)Math.Round(num * (float)num2);
if (num3 < 0)
{
num3 = 0;
}
if (num3 > num2)
{
num3 = num2;
}
string text = new string('=', num3);
string text2 = new string('=', num2 - num3);
stringBuilder.AppendLine($"<color=#66FF66>{text}</color><color=#555555>{text2}</color> {Math.Round(num * 100f)}% ({confirmHoldProgress:F1}/{5f} s)");
if (confirmComplete)
{
stringBuilder.AppendLine("<color=#66FF66>Recycle completed.</color>");
return ("Confirm Recycle", stringBuilder.ToString());
}
return ("Confirm Recycle", stringBuilder.ToString());
}
if (State == MenuState.TagValues && openedTag != null)
{
List<string> currentTagValues = GetCurrentTagValues();
int num4 = tagValuesViewStart;
int num5 = Math.Min(currentTagValues.Count, num4 + 15);
for (int i = num4; i < num5; i++)
{
string text3 = currentTagValues[i];
var (num6, num7) = GetTagValueCounts(openedTag, text3);
string text4;
string text5;
if (num6 == 0)
{
text4 = "[none]";
text5 = "#AAAAAA";
}
else if (!IsMarkedForRemoval(openedTag, text3))
{
text4 = "[keep]";
text5 = "#66FF66";
}
else
{
text4 = "[remove]";
text5 = "#FF6666";
}
string arg = " <color=" + text5 + ">" + text4 + "</color>";
string value = $"{text3} (#{num6}) {arg}";
if (i == tagValueSelectedIndex)
{
if (isActivePanel)
{
stringBuilder.AppendLine($"<color=#FFFF66>» {text3} (#{num6}) {arg}</color>");
}
else
{
stringBuilder.AppendLine($"<color=#AAAAAA>» {text3} (#{num6}) {arg}</color>");
}
}
else
{
stringBuilder.AppendLine(value);
}
}
return (GetCurrentHeader(), stringBuilder.ToString());
}
if (State == MenuState.Filters)
{
IReadOnlyList<string> currentMenuItems = GetCurrentMenuItems();
int currentSelectedIndex = GetCurrentSelectedIndex();
int num8 = filterViewStart;
int num9 = Math.Min(currentMenuItems.Count, num8 + 15);
for (int j = num8; j < num9; j++)
{
string text6 = currentMenuItems[j];
if (j == currentSelectedIndex)
{
if (isActivePanel)
{
stringBuilder.AppendLine("<color=#FFFF66>» " + text6 + "</color>");
}
else
{
stringBuilder.AppendLine("<color=#AAAAAA>» " + text6 + "</color>");
}
}
else
{
stringBuilder.AppendLine(text6);
}
}
return (GetCurrentHeader(), stringBuilder.ToString());
}
IReadOnlyList<string> currentMenuItems2 = GetCurrentMenuItems();
for (int k = 0; k < currentMenuItems2.Count; k++)
{
string text7 = currentMenuItems2[k];
if (k == mainSelectedIndex)
{
if (isActivePanel)
{
stringBuilder.AppendLine("<color=#FFFF66>» " + text7 + "</color>");
}
else
{
stringBuilder.AppendLine("<color=#AAAAAA>» " + text7 + "</color>");
}
}
else
{
stringBuilder.AppendLine(text7);
}
}
return (GetCurrentHeader(), stringBuilder.ToString());
}
private static List<string> GetCurrentTagValues()
{
if (openedTag != null && tagValues.TryGetValue(openedTag, out var value))
{
return value;
}
return new List<string>();
}
public static void UpdateHold(bool isHolding, float deltaSeconds)
{
if (State != MenuState.ConfirmRecycle)
{
return;
}
if (confirmComplete)
{
if (Time.unscaledTime - confirmCompleteStartTime >= 2f)
{
confirmComplete = false;
confirmCompleteStartTime = -1f;
State = MenuState.Main;
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
else
{
UpdateMenuDisplay();
}
return;
}
if (isHolding)
{
if (confirmHoldStartTime < 0f)
{
confirmHoldStartTime = Time.unscaledTime;
confirmInProgress = true;
}
confirmHoldProgress = Time.unscaledTime - confirmHoldStartTime;
}
else if (confirmInProgress)
{
confirmHoldProgress = 0f;
confirmHoldStartTime = -1f;
confirmInProgress = false;
}
if (confirmHoldProgress >= 5f)
{
try
{
OnRecycleSelected?.Invoke();
}
catch
{
}
confirmHoldProgress = 0f;
confirmInProgress = false;
confirmHoldStartTime = -1f;
confirmComplete = true;
confirmCompleteStartTime = Time.unscaledTime;
}
UpdateMenuDisplay();
}
public static void ResetAndClose()
{
try
{
removeTagValues.Clear();
tagValues.Clear();
filterTags.Clear();
mainSelectedIndex = 0;
filterSelectedIndex = 0;
tagValueSelectedIndex = 0;
filterViewStart = 0;
tagValuesViewStart = 0;
openedTag = null;
State = MenuState.Main;
confirmHoldProgress = 0f;
confirmInProgress = false;
confirmHoldStartTime = -1f;
confirmComplete = false;
confirmCompleteStartTime = -1f;
try
{
UIUpdater.SetMenuOpen(open: false);
}
catch
{
}
OnMenuChanged?.Invoke();
UpdateMenuDisplay();
}
catch
{
}
}
}
internal static class UIObjects
{
public static Font defaultFont;
public static GameObject CanvasObj;
public static Canvas canvas;
public static RectTransform CanvasObjRect;
public static GameObject QuestionsObj;
public static RectTransform QuestionsObjRect;
public static Image QuestionsObjImage;
public static GameObject HeaderObj;
public static RectTransform HeaderObjRect;
public static Text HeaderObjText;
public static GameObject QuestionTextObj;
public static RectTransform QuestionTextObjRect;
public static Text QuestionTextObjText;
public static GameObject ContentObj;
public static RectTransform ContentObjRect;
public static Text ContentObjText;
public static GameObject ItemListObj;
public static RectTransform ItemListObjRect;
public static Image ItemListObjImage;
public static GameObject ItemListHeader;
public static RectTransform ItemListHeaderRect;
public static Text ItemListHeaderText;
public static GameObject ItemListContent;
public static RectTransform ItemListContentRect;
public static Text ItemListContentText;
public static GameObject ControlsTextObj;
public static RectTransform ControlsTextObjRect;
public static Text ControlsTextObjText;
public static MonoBehaviourPublicTeteTritMeMaitMeyiQuUnique MenuItemDisplay;
public static Text InspectDetailsText;
}
internal static class UIUpdater
{
public static bool IsMenuOpen
{
get
{
bool flag = (Object)(object)UIObjects.QuestionsObj != (Object)null && UIObjects.QuestionsObj.activeSelf;
bool flag2 = (Object)(object)UIObjects.ItemListObj != (Object)null && UIObjects.ItemListObj.activeSelf;
return flag || flag2;
}
}
public static void ToggleMenu()
{
SetMenuOpen(!IsMenuOpen);
}
public static void SetMenuOpen(bool open)
{
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Expected O, but got Unknown
//IL_0529: Unknown result type (might be due to invalid IL or missing references)
//IL_0530: Expected O, but got Unknown
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Expected O, but got Unknown
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
bool flag = default(bool);
try
{
if ((Object)(object)UIObjects.QuestionsObj != (Object)null)
{
UIObjects.QuestionsObj.SetActive(open);
}
if ((Object)(object)UIObjects.ItemListObj != (Object)null)
{
UIObjects.ItemListObj.SetActive(open);
}
if ((Object)(object)UIObjects.MenuItemDisplay != (Object)null && (Object)(object)((Component)UIObjects.MenuItemDisplay).gameObject != (Object)null)
{
((Component)UIObjects.MenuItemDisplay).gameObject.SetActive(open);
}
if (!open)
{
return;
}
try
{
Inventory.GetInventory();
Inventory.GetPossibleTags();
Inventory.GetPossibleTagValues();
ManualLogSource logger = CrabQuickRecycle.logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Inventory.InventoryItemDataList.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" inventory items for display.");
}
logger.LogInfo(val);
List<string> list = new List<string>();
HashSet<string> hashSet = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if (Inventory.PossibleTags != null)
{
foreach (string possibleTag in Inventory.PossibleTags)
{
if (!string.IsNullOrEmpty(possibleTag) && hashSet.Add(possibleTag))
{
list.Add(possibleTag);
}
}
}
if (Inventory.PossibleTagValues != null)
{
foreach (KeyValuePair<string, string[]> possibleTagValue in Inventory.PossibleTagValues)
{
string key = possibleTagValue.Key;
if (!string.IsNullOrEmpty(key) && hashSet.Add(key))
{
list.Add(key);
}
}
}
try
{
foreach (Inventory.ItemData inventoryItemData in Inventory.InventoryItemDataList)
{
if (inventoryItemData.Tags == null)
{
continue;
}
KeyCollection<string, string> keys = inventoryItemData.Tags.Keys;
Enumerator<string, string> enumerator4 = keys.GetEnumerator();
while (enumerator4.MoveNext())
{
string current3 = enumerator4.Current;
if (!string.IsNullOrEmpty(current3) && hashSet.Add(current3))
{
list.Add(current3);
}
}
}
}
catch (Exception ex)
{
ManualLogSource logger2 = CrabQuickRecycle.logger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error scanning item tags: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
logger2.LogWarning(val2);
}
try
{
ManualLogSource logger3 = CrabQuickRecycle.logger;
val = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("PossibleTags count=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Inventory.PossibleTags?.Count ?? 0);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", PossibleTagValues count=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Inventory.PossibleTagValues?.Count ?? 0);
}
logger3.LogInfo(val);
ManualLogSource logger4 = CrabQuickRecycle.logger;
val = new BepInExInfoLogInterpolatedStringHandler(17, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("CombinedTags (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(",", list));
}
logger4.LogInfo(val);
}
catch
{
}
string text = list.Find((string t) => string.Equals(t, "Name", StringComparison.InvariantCultureIgnoreCase));
string tag;
if (text == null)
{
list.Insert(0, "Name");
tag = "Name";
}
else
{
list.Remove(text);
list.Insert(0, text);
tag = text;
}
UIMainMenuContent.SetFilterTags(list);
if (Inventory.PossibleTagValues != null)
{
foreach (KeyValuePair<string, string[]> possibleTagValue2 in Inventory.PossibleTagValues)
{
UIMainMenuContent.SetTagValues(possibleTagValue2.Key, possibleTagValue2.Value);
}
}
HashSet<string> hashSet2 = new HashSet<string>();
foreach (Inventory.ItemData inventoryItemData2 in Inventory.InventoryItemDataList)
{
string text2 = inventoryItemData2.Name;
if (string.IsNullOrEmpty(text2))
{
text2 = "none";
}
hashSet2.Add(text2);
}
UIMainMenuContent.SetTagValues(tag, hashSet2);
UIInventoryContent.UpdateList();
while (UIMainMenuContent.State != 0)
{
UIMainMenuContent.Back();
}
UIMainMenuContent.UpdateMenuDisplay();
}
catch (Exception ex2)
{
ManualLogSource logger5 = CrabQuickRecycle.logger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("SetMenuOpen error populating tags: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex2);
}
logger5.LogWarning(val2);
}
}
catch (Exception ex3)
{
ManualLogSource logger6 = CrabQuickRecycle.logger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("SetMenuOpen error: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex3);
}
logger6.LogWarning(val2);
}
}
public static void UpdateControlsText()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)UIObjects.ControlsTextObjText == (Object)null))
{
StringBuilder stringBuilder = new StringBuilder();
if (!IsMenuOpen)
{
stringBuilder.Append("Open Recycle Menu " + ColorKey((KeyCode)Configuration.menuToggle));
}
else
{
stringBuilder.Append("Next " + ColorKey((KeyCode)Configuration.nextKey) + "\n");
stringBuilder.Append("Previous " + ColorKey((KeyCode)Configuration.previousKey) + "\n");
stringBuilder.Append("Move Up " + ColorKey((KeyCode)Configuration.upKey) + "\n");
stringBuilder.Append("Move Down " + ColorKey((KeyCode)Configuration.downKey) + "\n");
stringBuilder.Append("Move Left " + ColorKey((KeyCode)Configuration.leftKey) + "\n");
stringBuilder.Append("Move Right " + ColorKey((KeyCode)Configuration.rightKey) + "\n");
stringBuilder.Append("Close Recycle Menu " + ColorKey((KeyCode)Configuration.menuToggle));
}
if ((Object)(object)UIObjects.ControlsTextObjText != (Object)null)
{
UIObjects.ControlsTextObjText.supportRichText = true;
UIObjects.ControlsTextObjText.text = stringBuilder.ToString();
}
}
}
private static string ColorKey(KeyCode key)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return $"<color=#FFFF99>{key}</color>";
}
}
}