using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; 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.Logging; using ConditionalConfigSync; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using VSM.Core.Config; using VSM.Core.Harmony; using VSM.Core.Localization; using VSM.Core.Reflection; using VSM.Core.Runtime; using VSM.Core.Ui; using VSM.Slots.Core; using VSM.Slots.Runtime; using VSM.Slots.Transmog; using VSM.Slots.Ui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("VSM.Slots")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.4.0")] [assembly: AssemblyInformationalVersion("0.1.4+ff27bc889ccf218c61c45d3417d48ab708a5ba8f")] [assembly: AssemblyProduct("VSM.Slots")] [assembly: AssemblyTitle("VSM.Slots")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VSM.Slots { [BepInPlugin("vsm.slots", "MEL Slots", "0.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class SlotsPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Game), "Start")] internal static class NetPatch { private static ZRoutedRpc s_registeredFor; [HarmonyPostfix] private static void Postfix() { ZRoutedRpc instance = ZRoutedRpc.instance; if (instance != null && instance != s_registeredFor) { instance.Register("VSM_Slots_RowsTrimmed", (Action)RowCap.RPC_RowsTrimmed); s_registeredFor = instance; SlotState.Reset(); Reconciler.Forget(); } } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] internal static class CommandsPatch { [HarmonyPostfix] private static void Postfix() { RegisterCommands(); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static EventHandler <>9__23_0; public static EventHandler <>9__23_1; public static EventHandler <>9__23_2; public static EventHandler <>9__23_3; public static EventHandler <>9__23_4; public static EventHandler <>9__23_5; public static EventHandler <>9__23_6; public static EventHandler <>9__23_7; public static ConsoleEvent <>9__35_0; public static ConsoleEvent <>9__35_1; internal void b__23_0(object s, EventArgs e) { SlotLayout.SetEnabled(EnabledSlots.Value); RefreshLooks(); } internal void b__23_1(object s, EventArgs e) { EnforceRows("config"); } internal void b__23_2(object s, EventArgs e) { EnforceRows("config"); } internal void b__23_3(object s, EventArgs e) { EnforceRows("config"); } internal void b__23_4(object s, EventArgs e) { EnforceRows("config"); } internal void b__23_5(object s, EventArgs e) { RefreshLooks(); } internal void b__23_6(object s, EventArgs e) { RefreshLooks(); } internal void b__23_7(object s, EventArgs e) { RefreshLooks(); } internal void b__35_0(ConsoleEventArgs args) { //IL_011a: 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_0122: 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_02c1: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("Sin jugador local."); return; } Inventory inventory = ((Humanoid)localPlayer).m_inventory; int num = SlotState.VisibleRows(localPlayer); args.Context.AddString("vsm.slots 0.1.4 | filas visibles=" + num + " (tope " + RowCap.MaxRows(localPlayer) + ", " + RowsCap.Value.ToString() + ") | altura=" + inventory.m_height + " | config lista=" + IsConfigReady + " | seguridad=" + s_safetyOk + " | funciones=" + s_featuresOk); SlotDefinition[] all = SlotLayout.All; foreach (SlotDefinition slotDefinition in all) { Vector2i val = SlotLayout.CellOf(slotDefinition, num); ItemData itemAt = inventory.GetItemAt(val.x, val.y); ItemData val2 = slotDefinition.Equipped((Humanoid)(object)localPlayer); Appearance look; string text = (TransmogRuntime.Get(localPlayer).TryGet(slotDefinition.Id, out look) ? (look.Hidden ? "oculto" : (look.Prefab + ((look.Variant > 0) ? (":" + look.Variant) : string.Empty))) : "-"); args.Context.AddString(" " + slotDefinition.Id + (SlotLayout.IsEnabled(slotDefinition) ? string.Empty : " (desactivada)") + " @" + val.x + "," + val.y + ": " + ((itemAt != null) ? itemAt.m_shared.m_name : "-") + " | puesto: " + ((val2 != null) ? val2.m_shared.m_name : "-") + " | apariencia: " + text + ((itemAt != null && itemAt != val2) ? " <-- en espera / incoherente" : string.Empty)); } int num2 = 0; foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.m_gridPos.y == num && SlotLayout.SlotAt(allItem.m_gridPos, num) == null) { num2++; } } args.Context.AddString("Objetos atascados en celdas reservadas: " + num2); } internal void b__35_1(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { TransmogRuntime.ClearAll(localPlayer); args.Context.AddString("Apariencias quitadas."); } } } internal static ManualLogSource Log; private static ConfigSync s_sync; private Harmony _harmony; private static bool s_safetyOk; private static bool s_featuresOk; private static float s_lastMessage; private static readonly HashSet s_loggedOnce = new HashSet(); public static ConfigEntry EnabledSlots; public static ConfigEntry RowsCap; public static ConfigEntry RowsBase; public static ConfigEntry RowsLegalKeys; public static ConfigEntry RowsFixedMax; public static ConfigEntry TransmogEnabled; public static ConfigEntry TransmogRequireKnown; public static ConfigEntry TransmogAllowHide; public static ConfigEntry ServerLock; public static ConfigEntry ShowSlotLabels; public static ConfigEntry PanelGapX; public static ConfigEntry PanelOffsetY; public static ConfigEntry PanelScale; public static ConfigEntry ShowMessages; private static readonly Dictionary s_spanish = new Dictionary { { "vsm_slots_title", "Equipo" }, { "vsm_slots_helmet", "Casco" }, { "vsm_slots_chest", "Pecho" }, { "vsm_slots_legs", "Piernas" }, { "vsm_slots_shoulder", "Capa" }, { "vsm_slots_utility", "Cinturón" }, { "vsm_slots_trinket", "Trinket" }, { "vsm_slots_close", "Cerrar" }, { "vsm_slots_wrong_type", "Eso no va en la ranura de {0}" }, { "vsm_slots_swap_blocked", "No se puede cambiar: {0} no va en la ranura de {1}" }, { "vsm_slots_inventory_full", "Inventario lleno: no hay sitio para quitártelo" }, { "vsm_slots_stuck", "{0} está esperando sitio en tu inventario para salir de la fila de equipo" }, { "vsm_slots_rows_dropped", "No cabía todo: {0} objetos quedaron en el suelo junto a ti" }, { "vsm_slots_rows_trimmed", "El servidor permite {1} filas de inventario (tenías {0}). Lo que no cupo quedó en el suelo junto a ti." }, { "vsm_slots_transmog_button", "Transfigurar" }, { "vsm_slots_transmog_title", "Transfiguración" }, { "vsm_slots_transmog_wearing", "{0}: llevas {1}. Elige cómo se ve (las estadísticas no cambian)." }, { "vsm_slots_transmog_nothing", "{0}: no llevas nada. La apariencia elegida se verá cuando te pongas una pieza." }, { "vsm_slots_transmog_none_known", "Todavía no has tenido ninguna pieza de {0}. Cuando consigas una, aparecerá aquí." }, { "vsm_slots_transmog_original", "Original" }, { "vsm_slots_transmog_original_tip", "Se ve la pieza que llevas puesta" }, { "vsm_slots_transmog_hide", "Ocultar" }, { "vsm_slots_transmog_hide_tip", "No se ve nada en esta ranura (la pieza sigue protegiendo)" }, { "vsm_slots_transmog_reset_all", "Quitar todas" }, { "vsm_slots_transmog_saved_empty", "Guardado: se verá cuando lleves algo en la ranura de {0}" } }; public static bool IsConfigReady => s_sync != null && (((ConditionalConfigSync)s_sync).IsSourceOfTruth || ((ConditionalConfigSync)s_sync).InitialSyncDone); private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0044: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; s_sync = new ConfigSync("vsm.slots") { DisplayName = "MEL Slots", CurrentVersion = "0.1.4", MinimumRequiredVersion = "0.1.4", ModRequired = true }; BindConfig(); SlotLayout.SetEnabled(EnabledSlots.Value); ((ConditionalConfigSync)s_sync).InitialSyncCompleted += OnServerConfig; Log.LogInfo((object)("vsm.slots 0.1.4 | Valheim " + GameConstants.GameVersionString + " | headless=" + Headless.IsHeadless)); _harmony = new Harmony("vsm.slots"); PatchUtil.PatchClassSafely(Log, _harmony, typeof(NetPatch)); if (Headless.IsHeadless) { Log.LogInfo((object)"vsm.slots: servidor dedicado: configuración y registro de recortes, sin parches de inventario."); return; } VsmLocalization.Register(Log, Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), s_spanish); s_safetyOk = true; Type[] classes = SafetyPatches.Classes; foreach (Type patchClass in classes) { s_safetyOk &= PatchUtil.PatchClassSafely(Log, _harmony, patchClass); } if (!s_safetyOk) { Log.LogError((object)"vsm.slots: faltan parches de seguridad (¿cambió el juego?). Las ranuras quedan en modo protegido: sin panel ni arrastres."); return; } bool flag = PatchUtil.PatchClassSafely(Log, _harmony, typeof(DragResolver)); PatchUtil.PatchClassSafely(Log, _harmony, typeof(TransmogRuntime.ApplyPatch)); PatchUtil.PatchClassSafely(Log, _harmony, typeof(GraveEasyFit)); PatchUtil.PatchClassSafely(Log, _harmony, typeof(CommandsPatch)); if (flag) { Type[] classes2 = UiPatches.Classes; foreach (Type patchClass2 in classes2) { PatchUtil.PatchClassSafely(Log, _harmony, patchClass2); } } else { Log.LogError((object)"vsm.slots: no se pudo enganchar el arrastre; el panel de equipo no se muestra (las ranuras siguen funcionando con clic derecho)."); } s_featuresOk = true; } private void BindConfig() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Expected O, but got Unknown EnabledSlots = ((BaseUnityPlugin)this).Config.Bind("1. Ranuras", "EnabledSlots", "helmet,chest,legs,shoulder,utility,trinket", new ConfigDescription("Ranuras activas (ids separados por coma: helmet, chest, legs, shoulder, utility, trinket). Lo que haya en una ranura desactivada vuelve al inventario.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 100 } })); ((ConditionalConfigSync)s_sync).AddConfigEntry(EnabledSlots, (ConfigSyncMode)0); ServerLock = ((BaseUnityPlugin)this).Config.Bind("1. Ranuras", "ServerLock", true, "Bloquea la configuración sincronizada: solo los administradores del servidor pueden cambiarla."); ((ConditionalConfigSync)s_sync).AddLockingConfigEntry(ServerLock); RowsCap = ((BaseUnityPlugin)this).Config.Bind("2. Filas del inventario", "RowsCap", RowsCapMode.Legal, new ConfigDescription("Tope de filas del inventario. Legal = base + una por cada bolsillo comprado a Haldor (lo que se puede conseguir jugando; quien traiga más filas de un mundo con trucos se recorta al entrar). Fijo = el máximo de RowsFixedMax para todos. Libre = sin tope (hasta 9).", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 90 } })); RowsBase = ((BaseUnityPlugin)this).Config.Bind("2. Filas del inventario", "RowsBase", 4, new ConfigDescription("Filas con las que empieza todo personaje (vanilla: 4). Solo en modo Legal.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 9), new object[1] { new ConfigurationManagerAttributes { Order = 89 } })); RowsLegalKeys = ((BaseUnityPlugin)this).Config.Bind("2. Filas del inventario", "RowsLegalKeys", "invslot1,invslot2", new ConfigDescription("Claves de compra que dan una fila cada una (vanilla: invslot1 = Bolsillos más amplios, invslot2 = Bolsillos más profundos). Solo en modo Legal.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 88 } })); RowsFixedMax = ((BaseUnityPlugin)this).Config.Bind("2. Filas del inventario", "RowsFixedMax", 6, new ConfigDescription("Máximo de filas en modo Fijo.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 9), new object[1] { new ConfigurationManagerAttributes { Order = 87 } })); ((ConditionalConfigSync)s_sync).AddConfigEntry(RowsCap, (ConfigSyncMode)0); ((ConditionalConfigSync)s_sync).AddConfigEntry(RowsBase, (ConfigSyncMode)0); ((ConditionalConfigSync)s_sync).AddConfigEntry(RowsLegalKeys, (ConfigSyncMode)0); ((ConditionalConfigSync)s_sync).AddConfigEntry(RowsFixedMax, (ConfigSyncMode)0); TransmogEnabled = ((BaseUnityPlugin)this).Config.Bind("3. Transfiguración", "Enabled", true, new ConfigDescription("Permite cambiar la apariencia del equipo (las estadísticas siguen siendo las de la pieza real). Apagarlo desde el servidor quita todas las apariencias.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 80 } })); TransmogRequireKnown = ((BaseUnityPlugin)this).Config.Bind("3. Transfiguración", "RequireKnown", true, new ConfigDescription("Solo se pueden elegir apariencias de piezas que el jugador ya haya tenido alguna vez en el inventario.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 79 } })); TransmogAllowHide = ((BaseUnityPlugin)this).Config.Bind("3. Transfiguración", "AllowHide", true, new ConfigDescription("Permite ocultar una pieza (se ve el cuerpo o el pelo, pero la pieza sigue protegiendo).", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = 78 } })); ((ConditionalConfigSync)s_sync).AddConfigEntry(TransmogEnabled, (ConfigSyncMode)0); ((ConditionalConfigSync)s_sync).AddConfigEntry(TransmogRequireKnown, (ConfigSyncMode)0); ((ConditionalConfigSync)s_sync).AddConfigEntry(TransmogAllowHide, (ConfigSyncMode)0); ShowSlotLabels = ((BaseUnityPlugin)this).Config.Bind("4. Interfaz", "ShowSlotLabels", true, "Nombre de cada ranura debajo de la celda."); PanelGapX = ((BaseUnityPlugin)this).Config.Bind("4. Interfaz", "PanelGapX", 8f, "Separación horizontal (píxeles) entre las pestañas de armadura/peso y el panel de equipo."); PanelOffsetY = ((BaseUnityPlugin)this).Config.Bind("4. Interfaz", "PanelOffsetY", 0f, "Desplazamiento vertical del panel de equipo (píxeles)."); PanelScale = ((BaseUnityPlugin)this).Config.Bind("4. Interfaz", "PanelScale", 1f, new ConfigDescription("Escala del panel de equipo (se encoge solo si no cabe).", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 2f), Array.Empty())); ShowMessages = ((BaseUnityPlugin)this).Config.Bind("4. Interfaz", "ShowMessages", true, "Avisos en pantalla (objeto que no va en la ranura, inventario lleno, recortes)."); EnabledSlots.SettingChanged += delegate { SlotLayout.SetEnabled(EnabledSlots.Value); RefreshLooks(); }; RowsCap.SettingChanged += delegate { EnforceRows("config"); }; RowsBase.SettingChanged += delegate { EnforceRows("config"); }; RowsLegalKeys.SettingChanged += delegate { EnforceRows("config"); }; RowsFixedMax.SettingChanged += delegate { EnforceRows("config"); }; TransmogEnabled.SettingChanged += delegate { RefreshLooks(); }; TransmogRequireKnown.SettingChanged += delegate { RefreshLooks(); }; TransmogAllowHide.SettingChanged += delegate { RefreshLooks(); }; } private static void OnServerConfig() { SlotLayout.SetEnabled(EnabledSlots.Value); EnforceRows("config del servidor"); RefreshLooks(); } private static void EnforceRows(string when) { if (!s_safetyOk || (Object)(object)Player.m_localPlayer == (Object)null) { return; } try { RowCap.Enforce(Player.m_localPlayer, when); } catch (Exception ex) { Log.LogError((object)("vsm.slots: tope de filas: " + ex)); } } private static void RefreshLooks() { if (s_featuresOk && (Object)(object)Player.m_localPlayer != (Object)null) { TransmogRuntime.Refresh(Player.m_localPlayer); } } private void LateUpdate() { if (!s_featuresOk) { return; } try { Reconciler.Tick(); } catch (Exception ex) { LogOnce("reconcile", "vsm.slots: reconciliación: " + ex); } try { EquipmentPanel.Tick(); } catch (Exception ex2) { LogOnce("panel", "vsm.slots: panel: " + ex2); } } private void OnDestroy() { TransmogPanel.Destroy(); EquipmentPanel.Destroy(); if (_harmony != null) { _harmony.UnpatchSelf(); } } internal static void Message(Player p, string token, params object[] args) { if ((Object)(object)p == (Object)null || !ShowMessages.Value || Time.unscaledTime - s_lastMessage < 1f) { return; } s_lastMessage = Time.unscaledTime; if (args != null) { for (int i = 0; i < args.Length; i++) { if (args[i] is string { Length: >1 } text && text[0] == '$') { args[i] = VsmLocalization.Localize(text); } } } ((Character)p).Message((MessageType)2, VsmLocalization.Localize(token, args), 0, (Sprite)null, false); } internal static void LogOnce(string key, string message) { if (s_loggedOnce.Add(key)) { Log.LogError((object)message); } } private static void RegisterCommands() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_006d: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown object obj = <>c.<>9__35_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_011a: 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_0122: 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_02c1: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("Sin jugador local."); } else { Inventory inventory = ((Humanoid)localPlayer).m_inventory; int num = SlotState.VisibleRows(localPlayer); args.Context.AddString("vsm.slots 0.1.4 | filas visibles=" + num + " (tope " + RowCap.MaxRows(localPlayer) + ", " + RowsCap.Value.ToString() + ") | altura=" + inventory.m_height + " | config lista=" + IsConfigReady + " | seguridad=" + s_safetyOk + " | funciones=" + s_featuresOk); SlotDefinition[] all = SlotLayout.All; foreach (SlotDefinition slotDefinition in all) { Vector2i val3 = SlotLayout.CellOf(slotDefinition, num); ItemData itemAt = inventory.GetItemAt(val3.x, val3.y); ItemData val4 = slotDefinition.Equipped((Humanoid)(object)localPlayer); Appearance look; string text = (TransmogRuntime.Get(localPlayer).TryGet(slotDefinition.Id, out look) ? (look.Hidden ? "oculto" : (look.Prefab + ((look.Variant > 0) ? (":" + look.Variant) : string.Empty))) : "-"); args.Context.AddString(" " + slotDefinition.Id + (SlotLayout.IsEnabled(slotDefinition) ? string.Empty : " (desactivada)") + " @" + val3.x + "," + val3.y + ": " + ((itemAt != null) ? itemAt.m_shared.m_name : "-") + " | puesto: " + ((val4 != null) ? val4.m_shared.m_name : "-") + " | apariencia: " + text + ((itemAt != null && itemAt != val4) ? " <-- en espera / incoherente" : string.Empty)); } int num2 = 0; foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.m_gridPos.y == num && SlotLayout.SlotAt(allItem.m_gridPos, num) == null) { num2++; } } args.Context.AddString("Objetos atascados en celdas reservadas: " + num2); } }; <>c.<>9__35_0 = val; obj = (object)val; } new ConsoleCommand("vsm_slots_dump", "Estado de las ranuras de equipo (filas, altura, contenido, apariencias)", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__35_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { TransmogRuntime.ClearAll(localPlayer); args.Context.AddString("Apariencias quitadas."); } }; <>c.<>9__35_1 = val2; obj2 = (object)val2; } new ConsoleCommand("vsm_slots_transmog_reset", "Quita todas tus apariencias de transfiguración", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "vsm.slots"; public const string PLUGIN_NAME = "MEL Slots"; public const string PLUGIN_VERSION = "0.1.4"; } } namespace VSM.Slots.Ui { internal static class EquipmentPanel { private const string PanelName = "vsm_slots_panel"; private const float Pad = 12f; private const float TitleHeight = 28f; private const float LabelHeight = 14f; private const float ColumnGap = 10f; private const float ButtonHeight = 32f; private static RectTransform s_panel; private static Button s_transmogButton; private static TMP_Text s_title; private static readonly Dictionary s_labels = new Dictionary(); private static readonly Color LabelColor = new Color(0.85f, 0.8f, 0.7f, 1f); private static readonly Color LabelTransmogColor = new Color(1f, 0.68f, 0.2f, 1f); private static readonly Vector3[] s_corners = (Vector3[])(object)new Vector3[4]; public static bool Built => (Object)(object)s_panel != (Object)null; public static void Destroy() { if ((Object)(object)s_panel != (Object)null) { Object.Destroy((Object)(object)((Component)s_panel).gameObject); } s_panel = null; s_transmogButton = null; s_title = null; s_labels.Clear(); } private static float Space(InventoryGrid grid) { return ((Object)(object)grid != (Object)null && grid.m_elementSpace > 1f) ? grid.m_elementSpace : 70f; } private static RectTransform Ensure(InventoryGui gui) { //IL_0101: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_panel != (Object)null) { return s_panel; } if ((Object)(object)gui == (Object)null || (Object)(object)gui.m_player == (Object)null) { return null; } Transform val = ((Transform)gui.m_player).Find("vsm_slots_panel"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } RectTransform val2 = UiKit.NewRect((Transform)(object)gui.m_player, "vsm_slots_panel"); UiKit.VanillaBackground((Transform)(object)gui.m_player, val2); s_title = (TMP_Text)(object)UiKit.Text((Transform)(object)val2, "vsm_slots_title", VanillaStyle.TitleFont, 22f, (TextAlignmentOptions)514); s_title.text = VsmLocalization.Localize("$vsm_slots_title"); s_title.rectTransform.anchorMin = new Vector2(0f, 1f); s_title.rectTransform.anchorMax = new Vector2(1f, 1f); s_title.rectTransform.pivot = new Vector2(0.5f, 1f); s_title.rectTransform.anchoredPosition = new Vector2(0f, -6f); s_title.rectTransform.sizeDelta = new Vector2(-24f, 28f); s_transmogButton = UiKit.MakeButton((Transform)(object)val2, VsmLocalization.Localize("$vsm_slots_transmog_button"), delegate { TransmogPanel.Toggle(gui); }); s_panel = val2; return val2; } public static void Layout(InventoryGui gui, InventoryGrid grid) { //IL_00c9: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)gui == (Object)null || (Object)(object)grid == (Object)null || (Object)(object)grid != (Object)(object)gui.m_playerGrid || (Object)(object)localPlayer == (Object)null || !SlotState.HiddenRowActive(((Humanoid)localPlayer).m_inventory, out var visibleRows)) { return; } RectTransform val = Ensure(gui); if ((Object)(object)val == (Object)null) { return; } float num = Space(grid); float num2 = num + 14f; float num3 = 40f; float num4 = 3f * num2; float num5 = 24f + num * 2f + 10f; bool active = TransmogRuntime.Active; float num6 = num3 + num4 + (active ? 38f : 0f) + 12f; val.sizeDelta = new Vector2(num5, num6); Place(gui, val, num5); float num7 = 12f; float num8 = 12f + num + 10f; if ((Object)(object)s_transmogButton != (Object)null) { ((Component)s_transmogButton).gameObject.SetActive(active); UiKit.TopLeft(((Component)s_transmogButton).GetComponent(), 12f, 0f - (num3 + num4 + 2f), num5 - 24f, 32f); } TransmogData transmogData = (active ? TransmogRuntime.Get(localPlayer) : null); Vector2 val2 = default(Vector2); for (int i = 0; i < 8; i++) { InventoryElement element = grid.GetElement(i, visibleRows, 8); if ((Object)(object)element == (Object)null) { continue; } SlotDefinition slotDefinition = SlotLayout.SlotAt(new Vector2i(i, visibleRows), visibleRows); RectTransform elementRectTransform = element.GetElementRectTransform(); if (slotDefinition == null) { ((Component)element).gameObject.SetActive(false); HideLabel(i); continue; } ((Component)element).gameObject.SetActive(true); if ((Object)(object)((Transform)elementRectTransform).parent != (Object)(object)val) { ((Transform)elementRectTransform).SetParent((Transform)(object)val, false); } float num9 = ((slotDefinition.Column == 0) ? num7 : num8) + (num - elementRectTransform.sizeDelta.x) * 0.5f; float num10 = 0f - (num3 + (float)slotDefinition.Row * num2); ((Vector2)(ref val2))..ctor(0f, 1f); elementRectTransform.anchorMax = val2; elementRectTransform.anchorMin = val2; elementRectTransform.pivot = new Vector2(0f, 1f); elementRectTransform.anchoredPosition = new Vector2(num9, num10); Appearance look; bool transmog = transmogData?.TryGet(slotDefinition.Id, out look) ?? false; PlaceLabel(element, slotDefinition, val, (slotDefinition.Column == 0) ? num7 : num8, num10 - elementRectTransform.sizeDelta.y - 1f, num, transmog); } grid.m_gridRoot.SetSizeWithCurrentAnchors((Axis)1, (float)visibleRows * num); } public static void Tick() { bool inventoryVisible = (Object)(object)s_panel != (Object)null && InventoryGui.IsVisible() && ((Component)s_panel).gameObject.activeInHierarchy; TransmogPanel.Tick(inventoryVisible); } private static void Place(InventoryGui gui, RectTransform panel, float width) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00ee: 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_0057: Unknown result type (might be due to invalid IL or missing references) RectTransform player = gui.m_player; float num = Mathf.Abs(SlotsPlugin.PanelGapX.Value) + OverhangRight(gui); float num2 = Mathf.Clamp(SlotsPlugin.PanelScale.Value, 0.5f, 2f); float num3 = RightPanelsLeftEdge(gui); if (!float.IsInfinity(num3)) { Rect rect = player.rect; float num4 = num3 - (((Rect)(ref rect)).xMax + num) - 8f; if (num4 > 0f && width * num2 > num4) { num2 = Mathf.Max(0.6f, num4 / width); } } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f, 1f); panel.anchorMax = val; panel.anchorMin = val; panel.pivot = new Vector2(0f, 1f); ((Transform)panel).localScale = new Vector3(num2, num2, 1f); panel.anchoredPosition = new Vector2(num, SlotsPlugin.PanelOffsetY.Value); } private static float RightPanelsLeftEdge(InventoryGui gui) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) float num = float.PositiveInfinity; RectTransform[] array = (RectTransform[])(object)new RectTransform[2] { gui.m_info, gui.m_crafting }; foreach (RectTransform val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { val.GetWorldCorners(s_corners); for (int j = 0; j < 4; j++) { num = Mathf.Min(num, ((Transform)gui.m_player).InverseTransformPoint(s_corners[j]).x); } } } return num; } private static float OverhangRight(InventoryGui gui) { //IL_0009: 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) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) RectTransform player = gui.m_player; Rect rect = player.rect; float xMax = ((Rect)(ref rect)).xMax; float num = 0f; TMP_Text[] array = (TMP_Text[])(object)new TMP_Text[2] { gui.m_armor, gui.m_weight }; foreach (TMP_Text val in array) { if ((Object)(object)val == (Object)null) { continue; } Transform val2 = val.transform; int num2 = 0; while (num2 < 3 && (Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)player) { RectTransform val3 = (RectTransform)(object)((val2 is RectTransform) ? val2 : null); if (!((Object)(object)val3 == (Object)null)) { val3.GetWorldCorners(s_corners); for (int j = 0; j < 4; j++) { num = Mathf.Max(num, ((Transform)player).InverseTransformPoint(s_corners[j]).x - xMax); } } num2++; val2 = val2.parent; } } return Mathf.Clamp(num, 0f, 400f); } private static void PlaceLabel(InventoryElement element, SlotDefinition slot, RectTransform panel, float x, float y, float width, bool transmog) { //IL_00b9: 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) if (!s_labels.TryGetValue(slot.Id, out var value) || (Object)(object)value == (Object)null) { value = (TMP_Text)(object)UiKit.Text((Transform)(object)panel, "vsm_slots_label_" + slot.Id, VanillaStyle.BodyFont, 12f, (TextAlignmentOptions)514); s_labels[slot.Id] = value; } bool value2 = SlotsPlugin.ShowSlotLabels.Value; ((Component)value).gameObject.SetActive(value2); if (value2) { UiKit.TopLeft(value.rectTransform, x, y, width, 14f); value.text = VsmLocalization.Localize(slot.NameToken); ((Graphic)value).color = (transmog ? LabelTransmogColor : LabelColor); } } private static void HideLabel(int order) { SlotDefinition[] all = SlotLayout.All; foreach (SlotDefinition slotDefinition in all) { if (slotDefinition.Order == order && s_labels.TryGetValue(slotDefinition.Id, out var value) && (Object)(object)value != (Object)null) { ((Component)value).gameObject.SetActive(false); } } } } internal static class TransmogPanel { private enum CellKind { Original, Hide, Look } private sealed class CellView { public InventoryElement Element; public CellKind Kind; public LookOption Option; } private const string PanelName = "vsm_slots_transmog"; private const float Pad = 14f; private const float Cell = 64f; private const float CellGap = 6f; private static RectTransform s_panel; private static RectTransform s_content; private static TMP_Text s_info; private static TMP_Text s_empty; private static readonly Dictionary s_tabs = new Dictionary(); private static readonly List s_cells = new List(); private static SlotDefinition s_slot; private static string s_signature; public static bool IsOpen => (Object)(object)s_panel != (Object)null && ((Component)s_panel).gameObject.activeSelf; public static void Toggle(InventoryGui gui) { if (IsOpen) { Close(); } else { Open(gui); } } public static void Close() { if ((Object)(object)s_panel != (Object)null) { ((Component)s_panel).gameObject.SetActive(false); } } public static void Destroy() { if ((Object)(object)s_panel != (Object)null) { Object.Destroy((Object)(object)((Component)s_panel).gameObject); } s_panel = null; s_content = null; s_info = null; s_empty = null; s_tabs.Clear(); s_cells.Clear(); s_signature = null; } private static void Open(InventoryGui gui) { if (TransmogRuntime.Active && !((Object)(object)Player.m_localPlayer == (Object)null) && Ensure(gui)) { if (s_slot == null || !SlotLayout.IsEnabled(s_slot)) { s_slot = FirstEnabled(); } ((Component)s_panel).gameObject.SetActive(true); ((Transform)s_panel).SetAsLastSibling(); s_signature = null; } } public static void Tick(bool inventoryVisible) { if (!IsOpen) { return; } Player localPlayer = Player.m_localPlayer; if (!inventoryVisible || (Object)(object)localPlayer == (Object)null || !TransmogRuntime.Active) { Close(); return; } if (s_slot == null || !SlotLayout.IsEnabled(s_slot)) { s_slot = FirstEnabled(); if (s_slot == null) { Close(); return; } } ItemData val = s_slot.Equipped((Humanoid)(object)localPlayer); localPlayer.m_customData.TryGetValue("vsm.slots.transmog", out var value); string text = s_slot.Id + "|" + ((val != null && (Object)(object)val.m_dropPrefab != (Object)null) ? ((Object)val.m_dropPrefab).name : ((val != null) ? val.m_shared.m_name : "-")) + "|" + localPlayer.m_knownMaterial.Count + "|" + value + "|" + SlotsPlugin.TransmogAllowHide.Value + "|" + SlotsPlugin.TransmogRequireKnown.Value; if (text != s_signature) { s_signature = text; Rebuild(localPlayer, val); } } private static SlotDefinition FirstEnabled() { SlotDefinition[] all = SlotLayout.All; foreach (SlotDefinition slotDefinition in all) { if (SlotLayout.IsEnabled(slotDefinition)) { return slotDefinition; } } return null; } private static bool Ensure(InventoryGui gui) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_panel != (Object)null) { return true; } if ((Object)(object)gui == (Object)null || (Object)(object)gui.m_crafting == (Object)null) { return false; } Transform val = ((Transform)gui.m_crafting).Find("vsm_slots_transmog"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } RectTransform val2 = UiKit.NewRect((Transform)(object)gui.m_crafting, "vsm_slots_transmog"); UiKit.Stretch(val2); UiKit.VanillaBackground((Transform)(object)gui.m_crafting, val2); Rect rect = gui.m_crafting.rect; float width = ((Rect)(ref rect)).width; rect = gui.m_crafting.rect; float height = ((Rect)(ref rect)).height; TMP_Text val3 = (TMP_Text)(object)UiKit.Text((Transform)(object)val2, "title", VanillaStyle.TitleFont, 26f, (TextAlignmentOptions)514); val3.text = VsmLocalization.Localize("$vsm_slots_transmog_title"); UiKit.TopLeft(val3.rectTransform, 14f, -14f, width - 28f, 34f); float num = (width - 28f - 20f) / 6f; float num2 = 14f; SlotDefinition[] all = SlotLayout.All; foreach (SlotDefinition slotDefinition in all) { SlotDefinition captured = slotDefinition; Button val4 = UiKit.MakeButton((Transform)(object)val2, VsmLocalization.Localize(slotDefinition.NameToken), delegate { s_slot = captured; s_signature = null; }); UiKit.TopLeft(((Component)val4).GetComponent(), num2, -54f, num, 34f); s_tabs[slotDefinition.Id] = val4; num2 += num + 4f; } s_info = (TMP_Text)(object)UiKit.Text((Transform)(object)val2, "info", VanillaStyle.BodyFont, 16f, (TextAlignmentOptions)514); s_info.enableWordWrapping = true; UiKit.TopLeft(s_info.rectTransform, 14f, -94f, width - 28f, 44f); float num3 = 144f; float num4 = 50f; RectTransform val5 = UiKit.NewRect((Transform)(object)val2, "viewport"); UiKit.TopLeft(val5, 14f, 0f - num3, width - 28f, height - num3 - num4 - 14f); ((Component)val5).gameObject.AddComponent(); Image val6 = ((Component)val5).gameObject.AddComponent(); ((Graphic)val6).color = new Color(0f, 0f, 0f, 0.25f); s_content = UiKit.NewRect((Transform)(object)val5, "content"); s_content.anchorMin = new Vector2(0f, 1f); s_content.anchorMax = new Vector2(1f, 1f); s_content.pivot = new Vector2(0.5f, 1f); s_content.anchoredPosition = Vector2.zero; s_content.sizeDelta = new Vector2(0f, 0f); GridLayoutGroup val7 = ((Component)s_content).gameObject.AddComponent(); val7.cellSize = new Vector2(64f, 64f); val7.spacing = new Vector2(6f, 6f); ((LayoutGroup)val7).padding = new RectOffset(8, 8, 8, 8); ((LayoutGroup)val7).childAlignment = (TextAnchor)1; val7.constraint = (Constraint)1; val7.constraintCount = Mathf.Max(1, Mathf.FloorToInt((width - 28f - 16f + 6f) / 70f)); ContentSizeFitter val8 = ((Component)s_content).gameObject.AddComponent(); val8.verticalFit = (FitMode)2; ScrollRect val9 = ((Component)val5).gameObject.AddComponent(); val9.content = s_content; val9.viewport = val5; val9.horizontal = false; val9.vertical = true; val9.movementType = (MovementType)2; val9.scrollSensitivity = 40f; s_empty = (TMP_Text)(object)UiKit.Text((Transform)(object)val5, "empty", VanillaStyle.BodyFont, 16f, (TextAlignmentOptions)514); s_empty.enableWordWrapping = true; UiKit.Stretch(s_empty.rectTransform); s_empty.rectTransform.offsetMin = new Vector2(20f, 20f); s_empty.rectTransform.offsetMax = new Vector2(-20f, -20f); float num5 = (width - 28f - 8f) / 2f; Button val10 = UiKit.MakeButton((Transform)(object)val2, VsmLocalization.Localize("$vsm_slots_transmog_reset_all"), delegate { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { TransmogRuntime.ClearAll(localPlayer); } }); UiKit.TopLeft(((Component)val10).GetComponent(), 14f, 0f - (height - num4), num5, 38f); Button val11 = UiKit.MakeButton((Transform)(object)val2, VsmLocalization.Localize("$vsm_slots_close"), Close); UiKit.TopLeft(((Component)val11).GetComponent(), 14f + num5 + 8f, 0f - (height - num4), num5, 38f); s_panel = val2; ((Component)val2).gameObject.SetActive(false); return true; } private static void Rebuild(Player p, ItemData real) { //IL_0166: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair s_tab in s_tabs) { SlotDefinition slotDefinition = SlotLayout.ById(s_tab.Key); ((Component)s_tab.Value).gameObject.SetActive(slotDefinition != null && SlotLayout.IsEnabled(slotDefinition)); ((Selectable)s_tab.Value).interactable = slotDefinition != s_slot; } foreach (CellView s_cell in s_cells) { if ((Object)(object)s_cell.Element != (Object)null) { Object.Destroy((Object)(object)((Component)s_cell.Element).gameObject); } } s_cells.Clear(); string text = VsmLocalization.Localize(s_slot.NameToken); s_info.text = ((real != null) ? VsmLocalization.Localize("$vsm_slots_transmog_wearing", text, VsmLocalization.Localize(real.m_shared.m_name)) : VsmLocalization.Localize("$vsm_slots_transmog_nothing", text)); TransmogData transmogData = TransmogRuntime.Get(p); Appearance look; bool flag = transmogData.TryGet(s_slot.Id, out look); List list = TransmogCatalog.For(s_slot.Type, SlotsPlugin.TransmogRequireKnown.Value ? p : null); ((Component)s_empty).gameObject.SetActive(list.Count == 0); s_empty.text = VsmLocalization.Localize("$vsm_slots_transmog_none_known", text); if (list.Count == 0 && !flag) { return; } AddCell(CellKind.Original, null, (real != null) ? real.GetIcon() : null, !flag, VsmLocalization.Localize("$vsm_slots_transmog_original"), VsmLocalization.Localize("$vsm_slots_transmog_original_tip")); if (SlotsPlugin.TransmogAllowHide.Value) { AddCell(CellKind.Hide, null, null, flag && look.Hidden, VsmLocalization.Localize("$vsm_slots_transmog_hide"), VsmLocalization.Localize("$vsm_slots_transmog_hide_tip")); } foreach (LookOption item in list) { bool selected = flag && !look.Hidden && look.Prefab == item.Prefab && look.Variant == item.Variant; string text2 = VsmLocalization.Localize(item.Shared.m_name); if (item.Shared.m_variants > 1) { text2 = text2 + " (" + (item.Variant + 1) + ")"; } AddCell(CellKind.Look, item, item.Icon, selected, null, text2); } } private static void AddCell(CellKind kind, LookOption option, Sprite icon, bool selected, string caption, string tooltip) { //IL_00e6: 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_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; GameObject val = (((Object)(object)instance != (Object)null && (Object)(object)instance.m_playerGrid != (Object)null) ? instance.m_playerGrid.m_elementPrefab : null); if ((Object)(object)val == (Object)null) { return; } GameObject val2 = Object.Instantiate(val, (Transform)(object)s_content, false); ((Object)val2).name = "vsm_look"; InventoryElement component = val2.GetComponent(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val2); return; } component.Initialize(-1, -1); ((Behaviour)component.m_icon).enabled = (Object)(object)icon != (Object)null; component.m_icon.sprite = icon; ((Graphic)component.m_icon).color = (Color)((kind == CellKind.Original) ? new Color(1f, 1f, 1f, 0.55f) : Color.white); ((Behaviour)component.m_amount).enabled = false; ((Behaviour)component.m_quality).enabled = false; ((Behaviour)component.m_queued).enabled = false; ((Behaviour)component.m_noteleport).enabled = false; ((Behaviour)component.m_food).enabled = false; ((Component)component.m_durability).gameObject.SetActive(false); component.m_selected.SetActive(false); ((Behaviour)component.m_equiped).enabled = selected; Transform val3 = val2.transform.Find("binding"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(false); } if (!string.IsNullOrEmpty(caption)) { TMP_Text val4 = (TMP_Text)(object)UiKit.Text(val2.transform, "caption", VanillaStyle.BodyFont, 13f, (TextAlignmentOptions)514); UiKit.Stretch(val4.rectTransform); val4.enableWordWrapping = true; val4.text = caption; } if ((Object)(object)component.m_tooltip != (Object)null) { component.m_tooltip.Set(tooltip ?? string.Empty, string.Empty, (RectTransform)null, default(Vector2)); } Button component2 = val2.GetComponent