Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ForgeOfEnchantment v1.0.0
ForgeOfEnchantment.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Data; using System.Data.SqlTypes; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Dynamic; using System.Globalization; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Numerics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Xml; using System.Xml.Linq; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ForgeOfEnchantment.Balance; using ForgeOfEnchantment.Commands; using ForgeOfEnchantment.Core; using ForgeOfEnchantment.Core.Catalogs; using ForgeOfEnchantment.Effects; using ForgeOfEnchantment.Effects.Hooks; using ForgeOfEnchantment.Integration; using ForgeOfEnchantment.Style; using ForgeOfEnchantment.UI; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Bson; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq.JsonPath; using Newtonsoft.Json.Schema; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Utilities; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; 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: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ForgeOfEnchantment")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5d03ad902694a04d80c5ffa8a2162938e6e010b9")] [assembly: AssemblyProduct("ForgeOfEnchantment")] [assembly: AssemblyTitle("ForgeOfEnchantment")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 ForgeOfEnchantment { [BepInPlugin("M2Valheim.ForgeOfEnchantment", "ForgeOfEnchantment", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "M2Valheim.ForgeOfEnchantment"; public const string PluginName = "ForgeOfEnchantment"; public const string PluginVersion = "1.0.0"; private static Harmony _harmony; private void Awake() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown ForgeConfig.Bind(((BaseUnityPlugin)this).Config); ForgeRules.Current = new GameForgeRules(); ForgeConfig.EffectsChanged += delegate { SocketEffectService.Refresh(Player.m_localPlayer); }; SocketEffectService.Register(); CatalogLoader.Load(); ForgeLocalization.Register(); Compendium.Register(); ForgeStation.Register(); ForgeLocation.Register(); TrophyPrefabSetup.Register(); TrophyMark.Register(); ThrowingAxe.Register(); MovementPenalty.Register(); GearGlowSync.Register(); SocketRecipeCache.Register(); DebugCommands.Register(); ForgeAdmin.Register(); _harmony = new Harmony("M2Valheim.ForgeOfEnchantment"); _harmony.PatchAll(); AttackSpeed.Register(); Logger.LogInfo((object)"ForgeOfEnchantment 1.0.0 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace ForgeOfEnchantment.UI { public static class ActiveEffectsBlock { private const string SourceIndent = " "; private const string PartSeparator = " · "; private static readonly HashSet<string> PerItemEffects = new HashSet<string> { "durability", "repair_time" }; public static string Build(Player player) { if ((Object)(object)player == (Object)null) { return ""; } ForgeCatalog catalog = ForgeCatalog.Current; List<EffectOverview.Entry> list = EffectOverview.Build(Items(player), catalog.FindEffect, (TrophySocket socket) => SocketEffects.Value(socket, catalog), ForgeRules.IsActive, PerItemEffects); if (list.Count == 0) { return ""; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(TextStyle.Colored("orange", TextStyle.L("$foe_active_heading"))); foreach (EffectOverview.Entry item in list) { stringBuilder.Append('\n').Append(Line(item)); foreach (EffectOverview.Contribution contribution in item.Contributions) { stringBuilder.Append('\n').Append(" ").Append(TextStyle.Colored("#888888", Source(contribution))); } } return stringBuilder.ToString(); } public static string Append(string pageText, string block) { string text = (pageText ?? "").TrimEnd(new char[1] { '\n' }); return (text.Length == 0) ? block : (text + "\n\n" + block); } private static IEnumerable<EffectOverview.Item> Items(Player player) { HashSet<ItemData> seen = new HashSet<ItemData>(); ItemData[] places = (ItemData[])(object)new ItemData[8] { ((Humanoid)player).m_rightItem, ((Humanoid)player).m_leftItem, ((Humanoid)player).m_helmetItem, ((Humanoid)player).m_chestItem, ((Humanoid)player).m_legItem, ((Humanoid)player).m_shoulderItem, ((Humanoid)player).m_utilityItem, ((Humanoid)player).m_trinketItem }; ItemData[] array = places; foreach (ItemData item in array) { if (item != null && seen.Add(item) && SocketRules.IsSocketable(item)) { yield return new EffectOverview.Item(TextStyle.L(item.m_shared.m_name), ItemSockets.Read(item).Filled); } } } private static string Line(EffectOverview.Entry entry) { string text = EffectNames.Label(entry.Pick); List<string> list = (entry.PerItem ? new List<string>() : (from part in entry.Parts where part.Total.HasValue select SocketText.Signed(part.Effect, part.Total.Value)).ToList()); if (entry.Resting) { string text2 = ((list.Count > 0) ? (text + ": " + string.Join(" · ", list)) : text); return TextStyle.Colored("#888888", text2 + " " + TextStyle.L("$foe_ui_resting")); } return (list.Count > 0) ? (text + ": " + TextStyle.Colored("orange", string.Join(" · ", list))) : text; } private static string Source(EffectOverview.Contribution c) { return c.Value.HasValue ? (c.ItemName + " " + SocketText.Signed(c.Effect, c.Value.Value)) : c.ItemName; } } public sealed class ChoicePanel { private const float Inset = 4f; private const float InsertTextHeight = 66f; private readonly RectTransform _listArea; private readonly RectTransform _bottom; private readonly Vector2 _baseOffsetMin; private readonly float _baseFontSize; private readonly ScrollRect _scroll; private float _extra = -1f; private ForgeTab.Mode _mode; public RectTransform Root { get; } public RectTransform ListContent { get; } public TMP_Text Preview { get; } public RollReels Reels { get; } public PoolView Pool { get; } public MergeView Merge { get; } public ChoicePanel(RectTransform root, RectTransform listArea, RectTransform listContent, RectTransform bottom, TMP_Text preview) { //IL_007a: 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) Root = root; _listArea = listArea; ListContent = listContent; _bottom = bottom; Preview = preview; _baseFontSize = preview.fontSize; Reels = new RollReels(bottom, preview); Pool = new PoolView(bottom, preview, _baseFontSize); Merge = new MergeView(bottom, preview); _baseOffsetMin = root.offsetMin; _scroll = ((Component)listContent).GetComponentInParent<ScrollRect>(true); Apply(0f, ForgeTab.Mode.Remove); } public void Apply(float extraDown, ForgeTab.Mode mode) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (!Mathf.Approximately(extraDown, _extra) || mode != _mode) { _extra = extraDown; _mode = mode; float num = 125f + extraDown; Root.offsetMin = _baseOffsetMin - new Vector2(0f, extraDown); _listArea.offsetMin = new Vector2(0f, num); _bottom.sizeDelta = new Vector2(0f, num); float num2 = num - 4f; float num3 = 4f; if (mode == ForgeTab.Mode.Insert) { num3 = num2 - 66f; Reels.Root.offsetMin = new Vector2(0f, 4f); Reels.Root.offsetMax = new Vector2(0f, -74f); Pool.Root.offsetMin = new Vector2(4f, 4f); Pool.Root.offsetMax = new Vector2(-4f, -74f); } RectTransform rectTransform = Preview.rectTransform; rectTransform.offsetMin = new Vector2(4f, num3); rectTransform.offsetMax = new Vector2(-4f, num2); ((Component)Preview).gameObject.SetActive(mode != ForgeTab.Mode.Merge); Canvas.ForceUpdateCanvases(); ScrollKit.FitWheel(_scroll); Pool.FitWheel(); } } public float SpaceDownTo(GameObject[] requirements, RectTransform floor) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (requirements == null || requirements.Length == 0) { return 0f; } Transform parent = ((Transform)Root).parent; Vector3[] array = (Vector3[])(object)new Vector3[4]; float num = float.MaxValue; foreach (GameObject val in requirements) { if (!((Object)(object)val == (Object)null)) { ((RectTransform)val.transform).GetWorldCorners(array); num = Mathf.Min(num, parent.InverseTransformPoint(array[0]).y); } } if (num != float.MaxValue && (Object)(object)floor != (Object)null) { floor.GetWorldCorners(array); num = Mathf.Max(num, parent.InverseTransformPoint(array[0]).y); } Root.GetWorldCorners(array); float num2 = parent.InverseTransformPoint(array[0]).y + _extra; return (num == float.MaxValue) ? 0f : Mathf.Max(0f, num2 - num); } } public static class Compendium { public enum Topic { Trophies, Forge, Effects, HuntGroups, Scars, Stands, Synergies } public sealed class EffectRow { public string Name; public string Value; public string Description; public int MinRarity; public List<GearMark> Gear; public HuntGroup? Home; } public sealed class GearMark { public string Kind; public string IconPrefab; public string Tooltip; } private sealed class GearKind { public string Label; public string IconPrefab; public readonly List<PoolItem> Items = new List<PoolItem>(); } public static readonly Topic[] Order = WithSynergies(Topic.Trophies, Topic.Forge, Topic.Effects, Topic.HuntGroups, Topic.Scars, Topic.Stands); public static readonly Topic[] Hugin = WithSynergies(Topic.Trophies, Topic.Forge, Topic.HuntGroups, Topic.Scars, Topic.Stands); private static readonly KeyValuePair<string, string>[] WeaponKinds = new KeyValuePair<string, string>[12] { new KeyValuePair<string, string>("Swords", "SwordBronze"), new KeyValuePair<string, string>("Knives", "KnifeFlint"), new KeyValuePair<string, string>("Clubs", "MaceBronze"), new KeyValuePair<string, string>("Axes", "AxeBronze"), new KeyValuePair<string, string>("Polearms", "AtgeirBronze"), new KeyValuePair<string, string>("Spears", "SpearBronze"), new KeyValuePair<string, string>("Pickaxes", "PickaxeAntler"), new KeyValuePair<string, string>("Unarmed", "FistFenrirClaw"), new KeyValuePair<string, string>("Bows", "Bow"), new KeyValuePair<string, string>("Crossbows", "CrossbowArbalest"), new KeyValuePair<string, string>("ElementalMagic", "StaffFireball"), new KeyValuePair<string, string>("BloodMagic", "StaffSkeleton") }; private static readonly Dictionary<ItemSlot, string> SlotIcons = new Dictionary<ItemSlot, string> { { ItemSlot.Shield, "ShieldWood" }, { ItemSlot.Cape, "CapeDeerHide" }, { ItemSlot.Helmet, "HelmetIron" }, { ItemSlot.Chest, "ArmorIronChest" }, { ItemSlot.Legs, "ArmorIronLegs" }, { ItemSlot.Utility, "BeltStrength" }, { ItemSlot.Trinket, "TrinketBronzeHealth" }, { ItemSlot.Tool, "Hammer" } }; private static readonly HashSet<string> OnlyTraits = new HashSet<string> { "harpoon", "breaks_away", "repairs", "one_handed_axe", "slows" }; private static Topic[] WithSynergies(params Topic[] topics) { List<Topic> list = new List<Topic>(topics); if (ForgeBalance.SynergiesEnabled) { list.Add(Topic.Synergies); } return list.ToArray(); } public static string TutorialName(Topic topic) { return "foe_tut_" + Key(Unlocker(topic)); } public static string RavenTopic(Topic topic) { return "$foe_tut_" + Key(topic) + "_topic"; } public static string RavenText(Topic topic) { return "$foe_tut_" + Key(topic); } private static Topic Unlocker(Topic topic) { return (topic == Topic.Effects) ? Topic.Forge : topic; } private static string Key(Topic topic) { return topic.ToString().ToLowerInvariant(); } public static void Register() { ForgeStand.FirstLookedAt += delegate { Teach(Topic.Stands); }; } public static void Teach(Topic topic) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && (Object)(object)Tutorial.instance != (Object)null) { localPlayer.ShowTutorial(TutorialName(topic), false); } } public static List<KeyValuePair<string, string>> Pages(Player player, bool showAllCreatures) { List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); if ((Object)(object)player == (Object)null) { return list; } Topic[] order = Order; foreach (Topic topic in order) { if (player.HaveSeenTutorial(TutorialName(topic))) { list.Add(new KeyValuePair<string, string>(TextStyle.L("$foe_codex_" + Key(topic)), Body(topic, player, showAllCreatures))); } } return list; } private static string Body(Topic topic, Player player, bool showAllCreatures) { return topic switch { Topic.Trophies => TrophiesPage(), Topic.Forge => TextStyle.L("$foe_codex_forge_body"), Topic.Effects => EffectsPage(), Topic.HuntGroups => HuntGroupsPage(player, showAllCreatures), Topic.Stands => StandsPage(player), Topic.Synergies => SynergiesPage(player), _ => TextStyle.L("$foe_codex_scars_body"), }; } private static string StandsPage(Player player) { HashSet<string> hashSet = new HashSet<string>(player.GetTrophies()); List<string> list = new List<string>(); foreach (ForgeStandDefinition stand in ForgeCatalog.Current.Stands) { if (hashSet.Contains(stand.Trophy)) { list.Add(TextStyle.Colored("yellow", TextStyle.L(ItemPrefabs.SharedName(stand.Trophy))) + "\n" + TextStyle.L(ForgeStands.LeverText(stand.Lever))); } } StringBuilder stringBuilder = new StringBuilder(TextStyle.L(ForgeConfig.StandsPerPlayer ? "$foe_codex_stands_intro_player" : "$foe_codex_stands_intro")); if (list.Count > 0) { stringBuilder.Append("\n\n").Append(string.Join("\n\n", list)); } return stringBuilder.ToString(); } private static string SynergiesPage(Player player) { HashSet<string> hashSet = new HashSet<string>(player.GetTrophies()); StringBuilder stringBuilder = new StringBuilder(TextStyle.L("$foe_codex_synergies_intro")); stringBuilder.Append("\n\n").Append(TextStyle.Heading("$foe_codex_synergies_counting")).Append(TextStyle.L("$foe_codex_synergies_counting_body")); foreach (SynergyDefinition synergy in ForgeCatalog.Current.Synergies) { if (hashSet.Contains(synergy.BossTrophy)) { stringBuilder.Append("\n\n").Append(SynergyText.Name(synergy)).Append('\n') .Append(TextStyle.L("$foe_codex_synergies_trophy", TextStyle.L(ItemPrefabs.SharedName(synergy.BossTrophy)))) .Append('\n') .Append(SynergyText.Gift(synergy, highlight: true)) .Append('\n') .Append(TextStyle.L("$foe_codex_synergies_needs", SynergyText.Recipe(synergy, null))); } } return stringBuilder.ToString(); } private static string TrophiesPage() { List<string> list = new List<string>(); for (int i = 1; i <= 6; i++) { list.Add(TextStyle.L(RarityStyle.ColoredName(i))); } return TextStyle.L("$foe_codex_trophies_intro") + "\n\n" + TextStyle.Heading("$foe_codex_rarities") + string.Join(" · ", list) + "\n\n" + TextStyle.L("$foe_codex_trophies_body") + (ForgeBalance.SynergiesEnabled ? (" " + TextStyle.L("$foe_codex_trophies_bosses")) : ""); } private static string EffectsPage() { return TextStyle.L("$foe_codex_effects_intro") + "\n\n" + TextStyle.Heading("$foe_codex_effects_values") + TextStyle.L("$foe_codex_effects_values_body", TextStyle.L(RarityStyle.ColoredName(6))) + " " + TextStyle.L("$foe_codex_effects_values_note"); } public static bool IsEffectsPage(string topic) { return topic == TextStyle.L("$foe_codex_effects"); } public static bool IsOwnPage(string topic) { Topic[] order = Order; foreach (Topic topic2 in order) { if (topic == TextStyle.L("$foe_codex_" + Key(topic2))) { return true; } } return false; } public static List<KeyValuePair<int, string>> RaritySpans() { List<KeyValuePair<int, string>> list = new List<KeyValuePair<int, string>>(); for (int i = 1; i <= 6; i++) { list.Add(new KeyValuePair<int, string>(i, ValueMath.Min(100.0, i).ToString("0") + "–" + ValueMath.Top(100.0, i).ToString("0") + " %")); } return list; } private static List<GearKind> GearKinds() { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Invalid comparison between Unknown and I4 Dictionary<string, GearKind> dictionary = new Dictionary<string, GearKind>(); Dictionary<ItemSlot, GearKind> dictionary2 = new Dictionary<ItemSlot, GearKind>(); if ((Object)(object)ObjectDB.instance == (Object)null) { return new List<GearKind>(); } foreach (GameObject item in ObjectDB.instance.m_items) { ItemDrop val = (((Object)(object)item != (Object)null) ? item.GetComponent<ItemDrop>() : null); ItemData val2 = (((Object)(object)val != (Object)null) ? val.m_itemData : null); if (val2 == null || !SocketRules.IsSocketable(val2) || (Object)(object)ObjectDB.instance.GetRecipe(val2) == (Object)null) { continue; } PoolItem poolItem = ItemTraits.ForPool(val2); if (poolItem == null || (ForgeBalance.SynergiesEnabled && poolItem.Slot == ItemSlot.Cape)) { continue; } GearKind value; if (poolItem.Slot == ItemSlot.Weapon) { if ((int)val2.m_shared.m_skillType == 0) { continue; } string text = ((object)Unsafe.As<SkillType, SkillType>(ref val2.m_shared.m_skillType)/*cast due to .constrained prefix*/).ToString(); if (!dictionary.TryGetValue(text, out value)) { GearKind obj = new GearKind { Label = TextStyle.L("$skill_" + text.ToLowerInvariant()), IconPrefab = ((Object)item).name }; value = obj; dictionary[text] = obj; } } else if (!dictionary2.TryGetValue(poolItem.Slot, out value)) { ItemSlot slot = poolItem.Slot; GearKind obj2 = new GearKind { Label = TextStyle.L("$foe_slot_" + poolItem.Slot.ToString().ToLowerInvariant()), IconPrefab = ((Object)item).name }; value = obj2; dictionary2[slot] = obj2; } value.Items.Add(poolItem); } List<GearKind> list = new List<GearKind>(); KeyValuePair<string, string>[] weaponKinds = WeaponKinds; for (int i = 0; i < weaponKinds.Length; i++) { KeyValuePair<string, string> keyValuePair = weaponKinds[i]; if (dictionary.TryGetValue(keyValuePair.Key, out var value2)) { value2.IconPrefab = keyValuePair.Value; list.Add(value2); dictionary.Remove(keyValuePair.Key); } } list.AddRange(dictionary.Values); foreach (ItemSlot value5 in Enum.GetValues(typeof(ItemSlot))) { if (dictionary2.TryGetValue(value5, out var value3)) { if (SlotIcons.TryGetValue(value5, out var value4)) { value3.IconPrefab = value4; } list.Add(value3); } } return list; } public static List<KeyValuePair<string, List<EffectRow>>> EffectTable() { List<List<EffectDefinition>> source = (from effect in ForgeCatalog.Current.Effects.Where(ForgeRules.IsActive) group effect by EffectNames.Label(new EffectPick(effect.Id)) into @group select @group.ToList()).ToList(); List<GearKind> kinds = GearKinds(); List<KeyValuePair<string, List<EffectRow>>> list = new List<KeyValuePair<string, List<EffectRow>>>(); foreach (EffectCategory category in Enum.GetValues(typeof(EffectCategory))) { List<EffectRow> list2 = (from row in source where row[0].Category == category select Row(row, kinds)).ToList(); if (list2.Count > 0) { list.Add(new KeyValuePair<string, List<EffectRow>>(TextStyle.L("$foe_codex_category_" + category.ToString().ToLowerInvariant()), list2)); } } return list; } public static List<GearMark> AllGear() { return (from kind in GearKinds() select new GearMark { Kind = kind.Label, IconPrefab = kind.IconPrefab, Tooltip = kind.Label }).ToList(); } public static string[] TableHeaders() { return new string[3] { TextStyle.L("$foe_codex_col_gear"), TextStyle.L("$foe_codex_col_effect"), TextStyle.L("$foe_codex_col_best") }; } public static string CapeNote() { return ForgeBalance.SynergiesEnabled ? (TextStyle.L("$foe_slot_cape") + ": " + TextStyle.L("$foe_codex_effects_cape")) : null; } private static EffectRow Row(List<EffectDefinition> sameName, List<GearKind> kinds) { EffectDefinition effectDefinition = sameName[0]; List<string> values = (from effect in sameName select SocketText.TopText(new EffectPick(effect.Id)) into value where value.Length > 0 select value).ToList(); List<GearMark> list = new List<GearMark>(); foreach (GearKind kind in kinds) { int num = kind.Items.Count((PoolItem item) => sameName.Any((EffectDefinition effect) => EffectPool.Fits(effect, item, 6))); if (num == 0) { continue; } string text = kind.Label; if (num < kind.Items.Count) { List<string> source = sameName.SelectMany((EffectDefinition effect) => effect.Restrictions.Values.SelectMany((IReadOnlyList<string> t) => t)).Distinct().ToList(); List<string> list2 = (from need in source where need.StartsWith("has_damage:", StringComparison.Ordinal) select TextStyle.L("$foe_codex_needs_" + need.Replace(':', '_'))).ToList(); List<string> list3 = (from need in source where OnlyTraits.Contains(need) select TextStyle.L("$foe_codex_needs_" + need)).ToList(); string text2 = ((list3.Count > 0) ? TextStyle.L("$foe_codex_only", string.Join(", ", list3)) : ((list2.Count > 0) ? TextStyle.L("$foe_codex_with", string.Join(", ", list2)) : TextStyle.L("$foe_codex_some"))); text = text + " (" + text2 + ")"; } list.Add(new GearMark { Kind = kind.Label, IconPrefab = kind.IconPrefab, Tooltip = text }); } return new EffectRow { Name = EffectNames.Label(new EffectPick(effectDefinition.Id)), Value = string.Join(" / ", values), Description = TextStyle.L("$foe_effect_desc_" + effectDefinition.Id), MinRarity = effectDefinition.MinRarity, Gear = list, Home = effectDefinition.Home }; } public static string FromRarity(int rarity) { return TextStyle.L("$foe_codex_from_rarity", TextStyle.L(RarityStyle.ColoredName(rarity))); } private static string HuntGroupsPage(Player player, bool showAllCreatures) { ForgeCatalog current = ForgeCatalog.Current; HashSet<string> known = new HashSet<string>(player.GetTrophies()); StringBuilder stringBuilder = new StringBuilder(TextStyle.L("$foe_codex_huntgroups_intro")); stringBuilder.Append("\n\n").Append(HuntGroupStagesText()); foreach (HuntGroup group in Enum.GetValues(typeof(HuntGroup))) { stringBuilder.Append("\n\n").Append(TextStyle.Colored(HuntGroupStyle.ColorHex(group), TextStyle.L(HuntGroupStyle.NameKey(group)))); List<string> list = (from c in current.Creatures.Values where c.VariantOf == null && c.HuntGroup == @group && (showAllCreatures || known.Contains(c.Trophy)) orderby c.Biome, CreatureName(c) select c).Select(CreatureName).ToList(); if (list.Count > 0) { stringBuilder.Append('\n').Append(TextStyle.L("$foe_codex_creatures", string.Join(", ", list))); } } stringBuilder.Append("\n\n").Append(TextStyle.L("$foe_codex_huntgroups_color")); return stringBuilder.ToString(); } private static string HuntGroupStagesText() { IForgeRules current = ForgeRules.Current; string text = string.Join(" / ", current.HuntGroupStageValues.Select((float value) => "+" + Percent(value))); string text2 = Percent(current.HuntGroupBreadth); return TextStyle.L("$foe_codex_huntgroups_stages", text, text2, Percent(current.TrophyDropFloor)); } private static string Percent(float value) { return Mathf.RoundToInt(value * 100f) + " %"; } private static string CreatureName(CreatureDefinition creature) { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(creature.Prefab) : null); Character val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<Character>() : null); return ((Object)(object)val2 != (Object)null) ? TextStyle.L(val2.m_name) : creature.Name; } } internal static class CompendiumScroll { private static bool s_ownPage; private static int s_shown; private static float s_before; private static int s_shownBefore; private static TextInfo s_activeEffects; public static void TakeOver(TextInfo page) { s_activeEffects = page; } public static void Shown(TextsDialog dialog, TextInfo text) { s_ownPage = text != null && (Compendium.IsOwnPage(text.m_topic) || text == s_activeEffects); s_shown++; ScrollKit.CatchWheel(Area(dialog)); } public static void Before(TextsDialog dialog) { s_shownBefore = s_shown; ScrollRect val = Area(dialog); if ((Object)(object)val != (Object)null) { s_before = val.verticalNormalizedPosition; } } public static void After(TextsDialog dialog) { if (s_ownPage && s_shown == s_shownBefore && ZInput.IsExclusiveGamepadActive()) { ScrollRect val = Area(dialog); if (!((Object)(object)val == (Object)null) && !((Object)(object)dialog.m_rightScrollbar == (Object)null) && ((Component)dialog.m_rightScrollbar).gameObject.activeSelf) { val.verticalNormalizedPosition = s_before; ScrollKit.Stick(val, ZInput.GetJoyRightStickY(), Time.unscaledDeltaTime); } } } private static ScrollRect Area(TextsDialog dialog) { return ((Object)(object)dialog != (Object)null && (Object)(object)dialog.m_textArea != (Object)null) ? ((Component)dialog.m_textArea).GetComponentInParent<ScrollRect>() : null; } } public static class CompendiumTable { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Predicate<Compendium.GearMark> <>9__20_1; public static Predicate<Compendium.EffectRow> <>9__20_0; public static UnityAction <>9__23_0; public static Predicate<Compendium.GearMark> <>9__28_1; internal bool <Build>b__20_0(Compendium.EffectRow row) { return (s_filter == null || row.Gear.Exists((Compendium.GearMark gear) => gear.Kind == s_filter)) && (!s_group.HasValue || row.Home == s_group); } internal bool <Build>b__20_1(Compendium.GearMark gear) { return gear.Kind == s_filter; } internal void <AddGroupFilterKey>b__23_0() { int num = (s_group.HasValue ? Array.IndexOf(Groups, s_group.Value) : (-1)); s_group = ((num + 1 < Groups.Length) ? new HuntGroup?(Groups[num + 1]) : ((HuntGroup?)null)); Rebuild(effectsPage: true); } internal bool <AddFilterKey>b__28_1(Compendium.GearMark kind) { return kind.Kind == s_filter; } } private const string RootName = "foe_codex_table"; private const float IconSize = 28f; private const float IconGap = 3f; private const int IconsPerLine = 6; private const float ValueWidth = 130f; private const float ColumnGap = 14f; private const float ChipHeight = 50f; private const float RowPadding = 7f; private const float StripeAlpha = 0.045f; private const float DividerAlpha = 0.12f; private const float ChipAlpha = 0.14f; private static string s_filter; private static HuntGroup? s_group; private static readonly HuntGroup[] Groups = (HuntGroup[])Enum.GetValues(typeof(HuntGroup)); private const float GroupSymbolSize = 30f; private static TextsDialog s_dialog; private const float FilterSize = 34f; private const float FilterKeySize = 32f; private const float FilterKeyGap = 8f; private static float IconColumnWidth => 183f; public static void Show(TextsDialog dialog, TextInfo text) { s_filter = null; s_group = null; s_dialog = dialog; Rebuild(text != null && Compendium.IsEffectsPage(text.m_topic)); } private static void Rebuild(bool effectsPage) { TextsDialog val = s_dialog; if ((Object)(object)val == (Object)null || (Object)(object)val.m_textArea == (Object)null) { return; } Transform parent = val.m_textArea.transform.parent; RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val2 == (Object)null) { return; } Transform val3 = ((Transform)val2).Find("foe_codex_table"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(false); ((Object)val3).name = "foe_codex_table_old"; Object.Destroy((Object)(object)((Component)val3).gameObject); } if (!effectsPage) { return; } try { Build(val, val2); } catch (Exception arg) { Logger.LogError((object)$"Compendium effect table failed: {arg}"); } } private static void Build(TextsDialog dialog, RectTransform content) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) TMP_Text textArea = dialog.m_textArea; RectTransform val = (RectTransform)textArea.transform; Rect rect = val.rect; float num; if (!(((Rect)(ref rect)).width > 0f)) { num = val.sizeDelta.x; } else { rect = val.rect; num = ((Rect)(ref rect)).width; } float num2 = num; RectTransform val2 = VerticalGroup("foe_codex_table", (Transform)(object)content, 0f); val2.sizeDelta = new Vector2(num2, 0f); ((Transform)val2).SetSiblingIndex(textArea.transform.GetSiblingIndex() + 1); BuildChips(val2, textArea, num2); Spacer(val2, 14f); FilterRow(val2, textArea, num2); Spacer(val2, 6f); GroupFilterRow(val2, textArea); Spacer(val2, 8f); HeaderRow(val2, textArea); foreach (KeyValuePair<string, List<Compendium.EffectRow>> item in Compendium.EffectTable()) { List<Compendium.EffectRow> list = item.Value.FindAll((Compendium.EffectRow row) => (s_filter == null || row.Gear.Exists((Compendium.GearMark gear) => gear.Kind == s_filter)) && (!s_group.HasValue || row.Home == s_group)); if (list.Count == 0) { continue; } Heading(val2, textArea, item.Key); for (int num3 = 0; num3 < list.Count; num3++) { if (num3 > 0) { Divider(val2); } Row(val2, textArea, list[num3], num3 % 2 == 1); } } string text = Compendium.CapeNote(); if (text != null) { Spacer(val2, 14f); Text(val2, textArea, TextStyle.Colored("#9a9a9a", text), textArea.fontSize * 0.9f, (TextAlignmentOptions)257); } LayoutRebuilder.ForceRebuildLayoutImmediate(val2); LayoutRebuilder.ForceRebuildLayoutImmediate(content); } private static void FilterRow(RectTransform root, TMP_Text template, float width) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown List<Compendium.GearMark> list = Compendium.AllGear(); string text = TextStyle.L("$foe_codex_filter") + " " + ((s_filter != null) ? TextStyle.Colored("#ffc84a", s_filter) : TextStyle.Colored("#9a9a9a", TextStyle.L("$foe_codex_filter_all"))); TMP_Text label = Text(root, template, text, template.fontSize * 0.85f, (TextAlignmentOptions)1025); try { AddFilterKey(label, list); } catch (Exception arg) { Logger.LogWarning((object)$"Compendium filter key failed; the filter works with the mouse: {arg}"); } RectTransform component = new GameObject("foe_codex_filter", new Type[3] { typeof(RectTransform), typeof(GridLayoutGroup), typeof(LayoutElement) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)root, false); GridLayoutGroup component2 = ((Component)component).GetComponent<GridLayoutGroup>(); float num = 34f; component2.cellSize = new Vector2(num, num); component2.spacing = new Vector2(6f, 6f); int num2 = Mathf.Max(1, Mathf.FloorToInt((width + component2.spacing.x) / (num + component2.spacing.x))); component2.constraint = (Constraint)1; component2.constraintCount = num2; int num3 = Mathf.Max(1, Mathf.CeilToInt((float)list.Count / (float)num2)); LayoutElement component3 = ((Component)component).GetComponent<LayoutElement>(); float minHeight = (component3.preferredHeight = (float)num3 * num + (float)(num3 - 1) * component2.spacing.y); component3.minHeight = minHeight; foreach (Compendium.GearMark item in list) { bool flag = item.Kind == s_filter; RectTransform val = UiKit.Panel("kind", (Transform)(object)component, new Color(1f, 1f, 1f, flag ? 0.28f : 0.06f)); Image component4 = ((Component)val).GetComponent<Image>(); ((Graphic)component4).raycastTarget = true; RectTransform component5 = new GameObject("icon", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<RectTransform>(); ((Transform)component5).SetParent((Transform)(object)val, false); UiKit.Stretch(component5); component5.offsetMin = new Vector2(3f, 3f); component5.offsetMax = new Vector2(-3f, -3f); Image component6 = ((Component)component5).GetComponent<Image>(); component6.sprite = ItemPrefabs.Icon(item.IconPrefab); component6.preserveAspect = true; ((Graphic)component6).raycastTarget = false; ((Graphic)component6).color = (Color)((s_filter == null || flag) ? Color.white : new Color(1f, 1f, 1f, 0.45f)); string key = item.Kind; Button val2 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val2).targetGraphic = (Graphic)(object)component4; ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { s_filter = ((s_filter == key) ? null : key); Rebuild(effectsPage: true); }); UiKit.SmallTooltip(((Component)val).gameObject, item.Tooltip); } } private static void GroupFilterRow(RectTransform root, TMP_Text template) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown string text = TextStyle.L("$foe_codex_group_filter") + " " + (s_group.HasValue ? TextStyle.Colored(HuntGroupStyle.ColorHex(s_group.Value), TextStyle.L(HuntGroupStyle.NameKey(s_group.Value))) : TextStyle.Colored("#9a9a9a", TextStyle.L("$foe_codex_group_filter_all"))); TMP_Text label = Text(root, template, text, template.fontSize * 0.85f, (TextAlignmentOptions)1025); try { AddGroupFilterKey(label); } catch (Exception arg) { Logger.LogWarning((object)$"Compendium hunt group filter key failed; the filter works with the mouse: {arg}"); } RectTransform component = new GameObject("foe_codex_group_filter", new Type[3] { typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(LayoutElement) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)root, false); HorizontalLayoutGroup component2 = ((Component)component).GetComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).spacing = 6f; ((LayoutGroup)component2).childAlignment = (TextAnchor)3; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = false); ((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = childControlWidth; LayoutElement component3 = ((Component)component).GetComponent<LayoutElement>(); float minHeight = (component3.preferredHeight = 34f); component3.minHeight = minHeight; HuntGroup[] groups = Groups; foreach (HuntGroup huntGroup in groups) { bool flag3 = s_group == huntGroup; RectTransform val = GroupSymbol(component, huntGroup, 34f); InventoryElement componentInChildren = ((Component)val).GetComponentInChildren<InventoryElement>(true); componentInChildren.m_selected.SetActive(flag3); ((Graphic)componentInChildren.m_icon).color = (Color)((!s_group.HasValue || flag3) ? Color.white : new Color(1f, 1f, 1f, 0.45f)); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = Color.clear; ((Graphic)val2).raycastTarget = true; HuntGroup key = huntGroup; Button val3 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val3).targetGraphic = (Graphic)(object)val2; ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { s_group = ((s_group == key) ? ((HuntGroup?)null) : new HuntGroup?(key)); Rebuild(effectsPage: true); }); UiKit.SmallTooltip(((Component)val).gameObject, TextStyle.Colored(HuntGroupStyle.ColorHex(huntGroup), TextStyle.L(HuntGroupStyle.NameKey(huntGroup)))); } } private static void AddGroupFilterKey(TMP_Text label) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("foe_codex_group_filter_key", new Type[2] { typeof(RectTransform), typeof(Button) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(label.transform, false); float preferredWidth = label.preferredWidth; bool flag = preferredWidth > 0f && !float.IsInfinity(preferredWidth); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(flag ? 0f : 1f, 0.5f); component.pivot = val; Vector2 anchorMin = (component.anchorMax = val); component.anchorMin = anchorMin; component.anchoredPosition = new Vector2(flag ? (preferredWidth + 8f) : 0f, 0f); component.sizeDelta = new Vector2(32f, 32f); Button component2 = ((Component)component).GetComponent<Button>(); ((Selectable)component2).transition = (Transition)0; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component2).navigation = navigation; ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__23_0; if (obj == null) { UnityAction val3 = delegate { int num = (s_group.HasValue ? Array.IndexOf(Groups, s_group.Value) : (-1)); s_group = ((num + 1 < Groups.Length) ? new HuntGroup?(Groups[num + 1]) : ((HuntGroup?)null)); Rebuild(effectsPage: true); }; <>c.<>9__23_0 = val3; obj = (object)val3; } ((UnityEvent)onClick).AddListener((UnityAction)obj); UIGamePad val4 = GamepadHints.Bind(component2, "JoyRStick", null, (KeyCode)0); RectTransform val5 = (RectTransform)(((Object)(object)val4 != (Object)null && (Object)(object)val4.m_hint != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val5 == (Object)null)) { ((Vector2)(ref val))..ctor(0.5f, 0.5f); val5.pivot = val; anchorMin = (val5.anchorMax = val); val5.anchorMin = anchorMin; val5.anchoredPosition = Vector2.zero; } } private static RectTransform GroupSymbol(RectTransform parent, HuntGroup group, float size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) string value; Sprite trophyIcon = (ForgeCatalog.Current.HuntGroupIcons.TryGetValue(group, out value) ? ItemPrefabs.Icon(value) : null); RectTransform val = SocketSlotWidget.Create((Transform)(object)parent, size, trophyIcon, 0, HuntGroupStyle.Color(group), null); ((Behaviour)((Component)val).GetComponentInChildren<InventoryElement>(true).m_quality).enabled = false; return val; } private static void AddFilterKey(TMP_Text label, List<Compendium.GearMark> kinds) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) if (kinds.Count == 0) { return; } RectTransform component = new GameObject("foe_codex_filter_key", new Type[2] { typeof(RectTransform), typeof(Button) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(label.transform, false); float preferredWidth = label.preferredWidth; bool flag = preferredWidth > 0f && !float.IsInfinity(preferredWidth); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(flag ? 0f : 1f, 0.5f); component.pivot = val; Vector2 anchorMin = (component.anchorMax = val); component.anchorMin = anchorMin; component.anchoredPosition = new Vector2(flag ? (preferredWidth + 8f) : 0f, 0f); component.sizeDelta = new Vector2(32f, 32f); Button component2 = ((Component)component).GetComponent<Button>(); ((Selectable)component2).transition = (Transition)0; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component2).navigation = navigation; ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { int num = kinds.FindIndex((Compendium.GearMark kind) => kind.Kind == s_filter); s_filter = ((num + 1 < kinds.Count) ? kinds[num + 1].Kind : null); Rebuild(effectsPage: true); }); UIGamePad val3 = GamepadHints.Bind(component2, "JoyButtonX", null, (KeyCode)0); RectTransform val4 = (RectTransform)(((Object)(object)val3 != (Object)null && (Object)(object)val3.m_hint != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val4 == (Object)null)) { ((Vector2)(ref val))..ctor(0.5f, 0.5f); val4.pivot = val; anchorMin = (val4.anchorMax = val); val4.anchorMin = anchorMin; val4.anchoredPosition = Vector2.zero; } } private static void BuildChips(RectTransform root, TMP_Text template, float width) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown RectTransform component = new GameObject("foe_codex_spans", new Type[3] { typeof(RectTransform), typeof(GridLayoutGroup), typeof(LayoutElement) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)root, false); List<KeyValuePair<int, string>> list = Compendium.RaritySpans(); GridLayoutGroup component2 = ((Component)component).GetComponent<GridLayoutGroup>(); component2.spacing = new Vector2(4f, 4f); component2.cellSize = new Vector2((width - 4f * (float)(list.Count - 1)) / (float)list.Count, 50f); component2.constraint = (Constraint)1; component2.constraintCount = list.Count; LayoutElement component3 = ((Component)component).GetComponent<LayoutElement>(); float minHeight = (component3.preferredHeight = 50f); component3.minHeight = minHeight; foreach (KeyValuePair<int, string> item in list) { RectTransform parent = UiKit.Panel("chip", (Transform)(object)component, UiKit.WithAlpha(RarityStyle.Color(item.Key), 0.14f)); TMP_Text val = CloneText(parent, template, TextStyle.L(RarityStyle.ColoredName(item.Key)) + "\n<size=85%>" + item.Value + "</size>", template.fontSize * 0.8f, (TextAlignmentOptions)514); UiKit.Stretch((RectTransform)val.transform); } } private static void HeaderRow(RectTransform root, TMP_Text template) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) string[] array = Compendium.TableHeaders(); RectTransform val = HorizontalRow("foe_codex_header", root, Color.clear); float size = template.fontSize * 0.75f; TMP_Text val2 = Text(val, template, TextStyle.Colored("#8a8a8a", array[0]), size, (TextAlignmentOptions)1025); FixWidth(((Component)val2).GetComponent<LayoutElement>(), IconColumnWidth); TMP_Text val3 = Text(val, template, TextStyle.Colored("#8a8a8a", array[1]), size, (TextAlignmentOptions)1025); ((Component)val3).GetComponent<LayoutElement>().flexibleWidth = 1f; TMP_Text val4 = Text(val, template, TextStyle.Colored("#8a8a8a", array[2]), size, (TextAlignmentOptions)1028); FixWidth(((Component)val4).GetComponent<LayoutElement>(), 130f); GroupColumn(val, null); Divider(root); } private static void Heading(RectTransform root, TMP_Text template, string title) { TMP_Text val = Text(root, template, TextStyle.Colored("orange", title), template.fontSize * 1.1f, (TextAlignmentOptions)1025); ((Component)val).GetComponent<LayoutElement>().minHeight = template.fontSize * 2.2f; } private static void Row(RectTransform root, TMP_Text template, Compendium.EffectRow effect, bool stripe) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) RectTransform val = HorizontalRow("foe_codex_row", root, (Color)(stripe ? new Color(1f, 1f, 1f, 0.045f) : Color.clear)); RectTransform component = new GameObject("icons", new Type[3] { typeof(RectTransform), typeof(GridLayoutGroup), typeof(LayoutElement) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)val, false); GridLayoutGroup component2 = ((Component)component).GetComponent<GridLayoutGroup>(); component2.cellSize = new Vector2(28f, 28f); component2.spacing = new Vector2(3f, 3f); component2.constraint = (Constraint)1; component2.constraintCount = 6; ((LayoutGroup)component2).childAlignment = (TextAnchor)3; int num = Mathf.Max(1, Mathf.CeilToInt((float)effect.Gear.Count / 6f)); LayoutElement component3 = ((Component)component).GetComponent<LayoutElement>(); FixWidth(component3, IconColumnWidth); float minHeight = (component3.preferredHeight = (float)num * 28f + (float)(num - 1) * 3f); component3.minHeight = minHeight; foreach (Compendium.GearMark item in effect.Gear) { Icon(component, item); } RectTransform val2 = VerticalGroup("text", (Transform)(object)val, 1f); ((Component)val2).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f; string text = effect.Name; if (effect.MinRarity > 1) { text = text + " <size=80%>" + Compendium.FromRarity(effect.MinRarity) + "</size>"; } Text(val2, template, text, template.fontSize, (TextAlignmentOptions)257); Text(val2, template, TextStyle.Colored("#9a9a9a", effect.Description), template.fontSize * 0.8f, (TextAlignmentOptions)257); TMP_Text val3 = Text(val, template, TextStyle.Colored("#ffc84a", effect.Value), template.fontSize, (TextAlignmentOptions)516); FixWidth(((Component)val3).GetComponent<LayoutElement>(), 130f); GroupColumn(val, effect.Home); } private static void GroupColumn(RectTransform row, HuntGroup? group) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiKit.Container("group", (Transform)(object)row); LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); FixWidth(val2, 30f); float minHeight = (val2.preferredHeight = 30f); val2.minHeight = minHeight; if (group.HasValue) { RectTransform val3 = GroupSymbol(val, group.Value, 30f); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); val3.pivot = val4; Vector2 anchorMin = (val3.anchorMax = val4); val3.anchorMin = anchorMin; val3.anchoredPosition = Vector2.zero; Image val6 = ((Component)val3).gameObject.AddComponent<Image>(); ((Graphic)val6).color = Color.clear; UiKit.SmallTooltip(((Component)val3).gameObject, TextStyle.Colored(HuntGroupStyle.ColorHex(group.Value), TextStyle.L(HuntGroupStyle.NameKey(group.Value)))); } } private static void Icon(RectTransform parent, Compendium.GearMark gear) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("icon", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)parent, false); Image component2 = ((Component)component).GetComponent<Image>(); component2.sprite = ItemPrefabs.Icon(gear.IconPrefab); component2.preserveAspect = true; ((Behaviour)component2).enabled = (Object)(object)component2.sprite != (Object)null; UiKit.SmallTooltip(((Component)component).gameObject, gear.Tooltip); } private static RectTransform HorizontalRow(string name, RectTransform root, Color background) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown RectTransform val = UiKit.Panel(name, (Transform)(object)root, background); HorizontalLayoutGroup val2 = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val2).spacing = 14f; ((LayoutGroup)val2).padding = new RectOffset(6, 10, 7, 7); ((LayoutGroup)val2).childAlignment = (TextAnchor)3; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = childControlWidth; return val; } private static void Divider(RectTransform root) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) RectTransform val = UiKit.Panel("divider", (Transform)(object)root, new Color(1f, 1f, 1f, 0.12f)); LayoutElement val2 = ((Component)val).gameObject.AddComponent<LayoutElement>(); float minHeight = (val2.preferredHeight = 1f); val2.minHeight = minHeight; } private static void Spacer(RectTransform root, float height) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("space", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)root, false); LayoutElement component2 = ((Component)component).GetComponent<LayoutElement>(); float minHeight = (component2.preferredHeight = height); component2.minHeight = minHeight; } private static void FixWidth(LayoutElement element, float width) { float minWidth = (element.preferredWidth = width); element.minWidth = minWidth; element.flexibleWidth = 0f; } private static TMP_Text Text(RectTransform parent, TMP_Text template, string text, float size, TextAlignmentOptions alignment) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) TMP_Text val = CloneText(parent, template, text, size, alignment); ((Component)val).gameObject.AddComponent<LayoutElement>(); return val; } private static TMP_Text CloneText(RectTransform parent, TMP_Text template, string text, float size, TextAlignmentOptions alignment) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) TMP_Text val = UiKit.CloneText(template, (Transform)(object)parent, "text", size); val.alignment = alignment; val.text = text; return val; } private static RectTransform VerticalGroup(string name, Transform parent, float spacing) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(VerticalLayoutGroup) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); VerticalLayoutGroup component2 = ((Component)component).GetComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)component2).spacing = spacing; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false; return component; } } public static class CraftingSocketRow { public const float SlotSize = 24f; public const float SlotGap = 3f; private const float OffsetBelowName = 14f; public const float Height = 42f; public const string DescriptionClear = "\n"; private static RectTransform _row; private static ItemData _item; private static string _key; public static bool IsShown => (Object)(object)_row != (Object)null && ((Component)_row).gameObject.activeSelf; public static void Show(InventoryGui gui, ItemData item, TrophySocket ghost = null, int removed = -1, int revealing = -1) { //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) if (item == null || !SocketRules.IsSocketable(item)) { Hide(); return; } SocketData socketData = ItemSockets.Read(item); if (socketData.OpenSockets == 0 && ghost == null) { Hide(); } else { if (!EnsureBuilt(gui)) { return; } ((Component)_row).gameObject.SetActive(true); string text = ItemSockets.ReadRaw(item) + "|" + ((ghost != null) ? (ghost.TrophyPrefab + ghost.Rarity) : "") + "|" + removed + "|" + revealing; if (item == _item && text == _key) { return; } _item = item; _key = text; try { ForgeTabView.Clear(_row); for (int i = 0; i < socketData.OpenSockets; i++) { TrophySocket trophySocket = ((i < socketData.Filled.Count) ? socketData.Filled[i] : ((i == socketData.Filled.Count) ? ghost : null)); RectTransform val = SocketSlotWidget.Create((Transform)(object)_row, 24f, (trophySocket != null) ? ItemPrefabs.Icon(trophySocket.TrophyPrefab) : null, trophySocket?.Rarity ?? 0, (trophySocket != null) ? SocketText.GroupColor(trophySocket.TrophyPrefab) : ((Color?)null), null, trophySocket?.Scars ?? 0); Vector2 val2 = (val.pivot = new Vector2(0f, 0.5f)); Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = new Vector2((float)i * 27f, 0f); if ((i >= socketData.Filled.Count && trophySocket != null) || i == revealing || (trophySocket != null && trophySocket.IsPending)) { SocketSlotWidget.MarkPreview(val); } if (i == removed) { SocketSlotWidget.SetGreyedOut(val); } if (trophySocket != null) { SocketSlotWidget.AddTooltip(val, ItemPrefabs.SharedName(trophySocket.TrophyPrefab), ItemTooltip.SetTrophyTooltip(trophySocket)); } } } catch (Exception arg) { Logger.LogError((object)$"Socket row failed: {arg}"); } } } public static void Hide() { if ((Object)(object)_row != (Object)null) { ((Component)_row).gameObject.SetActive(false); } _item = null; _key = null; } private static bool EnsureBuilt(InventoryGui gui) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) if ((Object)(object)_row != (Object)null) { return true; } RectTransform rectTransform = gui.m_recipeName.rectTransform; _row = new GameObject("foe_socket_row", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)_row).SetParent(((Transform)rectTransform).parent, false); _row.anchorMin = rectTransform.anchorMin; _row.anchorMax = rectTransform.anchorMax; _row.pivot = new Vector2(rectTransform.pivot.x, 1f); Rect rect = rectTransform.rect; float num; if (!(((Rect)(ref rect)).height > 0f)) { num = 24f; } else { rect = rectTransform.rect; num = ((Rect)(ref rect)).height; } float num2 = num; _row.anchoredPosition = rectTransform.anchoredPosition + new Vector2(0f, 0f - num2 * (1f - rectTransform.pivot.y) - 14f); _row.sizeDelta = new Vector2(rectTransform.sizeDelta.x, 24f); return true; } } public static class DiscoveryTitle { private const float SmallestShare = 0.6f; public static void FitOneLine(MessageHud hud) { if (!((Object)(object)hud == (Object)null) && !((Object)(object)hud.m_biomeFoundPrefab == (Object)null)) { Transform val = Utils.FindChild(hud.m_biomeFoundPrefab.transform, "Title", (IterativeSearchType)0); TMP_Text val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<TMP_Text>() : null); if (!((Object)(object)val2 == (Object)null) && !val2.enableAutoSizing) { float fontSize = val2.fontSize; val2.textWrappingMode = (TextWrappingModes)0; val2.fontSizeMax = fontSize; val2.fontSizeMin = fontSize * 0.6f; val2.enableAutoSizing = true; } } } } public static class EffectNames { private const string Prefix = "$foe_effect_"; public static string Label(EffectPick pick) { if (pick.Skill != null) { switch (pick.EffectId) { case "skill_level_active": case "skill_level_passive": return Skill(pick.Skill); case "skill_xp": return TextStyle.L("$foe_effect_skill_xp_of", Skill(pick.Skill)); } } return TextStyle.L("$foe_effect_" + (ForgeCatalog.Current.FindEffect(pick.EffectId)?.NameKey ?? pick.EffectId)); } private static string Skill(string skill) { return TextStyle.L("$skill_" + skill.ToLowerInvariant()); } } public static class ForgeMessages { public static void SocketOpened(Player player, ItemData item, SocketOutcome outcome) { string name = item.m_shared.m_name; switch (outcome) { case SocketOutcome.Success: Show(player, "$foe_msg_socket_success", name, ItemSockets.Read(item).OpenSockets.ToString()); break; case SocketOutcome.Failed: Show(player, "$foe_msg_socket_failed", name); break; case SocketOutcome.Broke: Show(player, "$foe_msg_socket_broke", name); break; } } public static void Merged(Player player, ItemData source, ItemData target, SocketOutcome outcome, bool unscarred) { string name = source.m_shared.m_name; string name2 = target.m_shared.m_name; switch (outcome) { case SocketOutcome.Success: Show(player, unscarred ? "$foe_msg_merge_success_unscarred" : "$foe_msg_merge_success", name, name2); break; case SocketOutcome.Failed: Show(player, "$foe_msg_merge_failed", name, name2); break; case SocketOutcome.Broke: Show(player, "$foe_msg_merge_broke", name, name2); break; } } private static void Show(Player player, string key, params string[] words) { ((Character)player).Message((MessageType)2, TextStyle.L(key, words), 0, (Sprite)null, true); } } public static class ForgeRecipeList { public static void Fill(InventoryGui gui, Player player) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) foreach (RecipeDataPair availableRecipe in gui.m_availableRecipes) { RecipeDataPair current = availableRecipe; Object.Destroy((Object)(object)((RecipeDataPair)(ref current)).InterfaceElement); } gui.m_availableRecipes.Clear(); ForgeTabMode openTab = ForgeTab.OpenTab; IEnumerable<ItemData> enumerable = ((Humanoid)player).GetInventory().GetAllItems(); if (openTab != null) { enumerable = openTab.Order(enumerable); } foreach (ItemData item in enumerable.ToList()) { if (openTab?.ListsItem(player, item, out var recipe, out var canPay) ?? UpgradeTab.ListsItem(player, item, out recipe, out canPay)) { gui.AddRecipeToList(player, recipe, item, canPay); } } float num = Mathf.Max(gui.m_recipeListBaseSize, (float)gui.m_availableRecipes.Count * gui.m_recipeListSpace); gui.m_recipeListRoot.SetSizeWithCurrentAnchors((Axis)1, num); } } public static class ForgeSprites { private const string BundleName = "foe_vfx"; private static readonly Dictionary<string, Sprite> s_sprites = new Dictionary<string, Sprite>(); public static Sprite SlotGlow => Get("foe_slot_glow"); public static Sprite SlotGlowCore => Get("foe_slot_glow_core"); public static Sprite SlotSparkle => Get("foe_slot_sparkle"); public static Sprite ReelOutline => Get("foe_reel_outline"); private static Sprite Get(string name) { if (s_sprites.TryGetValue(name, out var value)) { return value; } AssetBundle val = EmbeddedBundles.Get("foe_vfx", "the slots' edge glow and the reels' outline are missing"); value = (((Object)(object)val != (Object)null) ? val.LoadAsset<Sprite>(name) : null); if ((Object)(object)value == (Object)null && (Object)(object)val != (Object)null) { Logger.LogError((object)("Bundle 'foe_vfx' has no sprite '" + name + "'.")); } s_sprites[name] = value; return value; } } public static class ForgeTab { public enum Mode { Insert, Remove, Merge } internal sealed class ChoiceRows { private readonly InventoryGui _gui; public int Count => _rowMarkers.Count; public ChoiceRows(InventoryGui gui) { _gui = gui; } public void Add(ForgeTabView.RowSpec row) { _rowMarkers.Add(ForgeTabView.CreateRow(_gui, _listContent, _rowMarkers.Count, row)); } } private static readonly TrophiesTab Trophies = new TrophiesTab(); private static readonly ForgeTabMode[] Tabs = new ForgeTabMode[3] { Trophies, new RemoveTab(), new MergeTab() }; private static readonly Button[] _tabButtons = (Button[])(object)new Button[Tabs.Length]; private static ForgeTabMode s_tab; private static ChoicePanel _choice; private static RectTransform _panel; private static RectTransform _listContent; private static TMP_Text _preview; private static bool _buildFailed; private static ItemData _listItem; private static string _listRaw; private static ForgeTabMode _listTab; private static bool _listState; private static readonly List<GameObject> _rowMarkers = new List<GameObject>(); private static float _requirementSpace = -1f; private static string _previewKey; private static string _previewText = ""; private static string _huntGroupKey; private const int CraftingGroup = 3; private const int TabCount = 4; private const float MinStepInterval = 0.08f; private const float SidewaysStick = 0.3f; private static readonly List<GameObject> _rowFocus = new List<GameObject>(); private static GameObject _shownFocus; private static GameObject _hintPrevious; private static GameObject _hintNext; private static InventoryGui _hintsFor; private static float _lastStepAt; private static bool _gamepadFailed; public static bool IsActive => s_tab != null; internal static ForgeTabMode OpenTab => s_tab; private static bool TabsBuilt => (Object)(object)_tabButtons[0] != (Object)null; private static int ChosenRow => (s_tab != null) ? s_tab.ChosenRow : (-1); private static bool TabsShown => TabsBuilt && ((Component)_tabButtons[0]).gameObject.activeSelf; private static int CurrentTab => (s_tab != null) ? (Array.IndexOf(Tabs, s_tab) + 1) : 0; private static bool EnsureBuilt(InventoryGui gui) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown if ((Object)(object)_panel != (Object)null) { return true; } if (_buildFailed) { return false; } try { for (int i = 0; i < Tabs.Length; i++) { ForgeTabMode tab = Tabs[i]; _tabButtons[i] = ForgeTabView.CloneTab(gui, tab.LabelKey, i + 1, (UnityAction)delegate { Activate(gui, tab); }); } _choice = ForgeTabView.CreateChoicePanel(gui); _panel = _choice.Root; _listContent = _choice.ListContent; _preview = _choice.Preview; _choice.Reels.Clicked = Trophies.ChooseCandidate; ((Component)_panel).gameObject.SetActive(false); return true; } catch (Exception arg) { _buildFailed = true; Button[] tabButtons = _tabButtons; foreach (Button val in tabButtons) { if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } } Logger.LogError((object)$"Forge tabs could not be built; the forge works without them: {arg}"); return false; } } public static void SetAvailable(InventoryGui gui, bool available) { if (available && !EnsureBuilt(gui)) { return; } if (available) { Compendium.Teach(Compendium.Topic.Forge); } if (TabsBuilt) { Button[] tabButtons = _tabButtons; foreach (Button val in tabButtons) { ((Component)val).gameObject.SetActive(available); } SetVanillaTabKeys(gui, available); if (!available) { Deactivate(gui); HideSocketRow(); } } } private static void Activate(InventoryGui gui, ForgeTabMode tab) { RollShow.Clear(); s_tab = tab; tab.Opened(); ResetChoices(); _requirementSpace = -1f; ((Selectable)gui.m_tabCraft).interactable = true; ((Selectable)gui.m_tabUpgrade).interactable = true; SetTabStates(); gui.m_craftTimer = -1f; gui.UpdateCraftingPanel(false); HuntGroupPanel.SetVisible(gui, visible: true); } public static void Deactivate(InventoryGui gui) { RollShow.Clear(); HuntGroupPanel.SetVisible(gui, visible: false); if (!IsActive) { SetTabStates(); return; } if ((Object)(object)gui != (Object)null) { gui.m_craftTimer = -1f; } s_tab = null; SetTabStates(); HidePanel(gui); ResetChoices(); } public static void SyncTabButtons(InventoryGui gui) { if (TabsBuilt && ((Component)_tabButtons[0]).gameObject.activeSelf) { if (IsActive) { ((Selectable)gui.m_tabUpgrade).interactable = true; } SetTabStates(); } } private static void SetTabStates() { if (TabsBuilt) { for (int i = 0; i < Tabs.Length; i++) { ((Selectable)_tabButtons[i]).interactable = s_tab != Tabs[i]; } } } internal static void ResetChoices() { ForgeTabMode[] tabs = Tabs; foreach (ForgeTabMode forgeTabMode in tabs) { forgeTabMode.ResetChoice(); } } public static void UpdatePanel(InventoryGui gui, Player player) { if ((Object)(object)_panel == (Object)null || s_tab == null) { return; } ItemData itemData = ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData; if (itemData == null) { HidePanel(gui); HideSocketRow(); ShowEmptyHint(gui); return; } RollShow.Update(gui); s_tab.BeforeFrame(gui, itemData); s_tab.SocketRowPreview(player, itemData, out var ghost, out var removed, out var revealing); CraftingSocketRow.Show(gui, itemData, ghost, removed, revealing); ((Behaviour)gui.m_recipeDecription).enabled = false; ((Component)_panel).gameObject.SetActive(true); UpdateLayout(gui); string text = ItemSockets.ReadRaw(itemData) ?? ""; if (itemData != _listItem || text != _listRaw || s_tab != _listTab || s_tab.ListState != _listState) { ResetChoices(); RebuildChoiceList(gui, player, itemData, text); } UpdateTexts(gui, player, itemData); } private static void UpdateLayout(InventoryGui gui) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) float extraDown = 0f; if (!s_tab.HasCost) { if (_requirementSpace < 0f) { ScrollRect val = (((Object)(object)gui.m_recipeListRoot != (Object)null) ? ((Component)gui.m_recipeListRoot).GetComponentInParent<ScrollRect>(true) : null); _requirementSpace = _choice.SpaceDownTo(gui.m_recipeRequirementList, (!((Object)(object)val != (Object)null)) ? ((RectTransform)null) : ((RectTransform)((Component)val).transform)); } extraDown = _requirementSpace; } SetRequirementsVisible(gui, s_tab.HasCost); _choice.Apply(extraDown, s_tab.Mode); } private static void SetRequirementsVisible(InventoryGui gui, bool visible) { if (gui.m_recipeRequirementList == null || gui.m_recipeRequirementList.Length == 0) { return; } GameObject val = gui.m_recipeRequirementList[0]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.transform.parent == (Object)null)) { GameObject gameObject = ((Component)val.transform.parent).gameObject; if (gameObject.activeSelf != visible) { gameObject.SetActive(visible); } } } private static void ShowEmptyHint(InventoryGui gui) { if (gui.m_availableRecipes.Count <= 0) { ((Component)gui.m_itemCraftType).gameObject.SetActive(true); gui.m_itemCraftType.text = TextStyle.L(s_tab.EmptyGearKey); } } public static void HidePanel(InventoryGui gui) { if ((Object)(object)_panel != (Object)null) { ((Component)_panel).gameObject.SetActive(false); } ClearTooltipFocus(); if ((Object)(object)gui != (Object)null) { SetRequirementsVisible(gui, visible: true); } _listItem = null; _listRaw = null; _huntGroupKey = null; HuntGroupPanel.ClearPreview(); } public static void HideSocketRow() { CraftingSocketRow.Hide(); } private static void RebuildChoiceList(InventoryGui gui, Player player, ItemData item, string raw) { _listItem = item; _listRaw = raw; _listTab = s_tab; _listState = s_tab.ListState; try { ForgeTabView.Clear(_listContent); _rowMarkers.Clear(); _rowFocus.Clear(); int num = s_tab.FillChoices(new ChoiceRows(gui), gui, player, item); if (num >= 0) { if (num == 0) { ForgeTabView.CreateRow(gui, _listContent, 0, new ForgeTabView.RowSpec { Name = TextStyle.L(s_tab.EmptyChoicesKey) }); } RefreshHighlights(); AddTooltipFocus(gui); } } catch (Exception arg) { Logger.LogError((object)$"Choice list failed: {arg}"); } } internal static void RefreshHighlights() { int chosenRow = ChosenRow; for (int i = 0; i < _rowMarkers.Count; i++) { ForgeTabView.SetSelected(_rowMarkers[i], i == chosenRow); } } private static void UpdateTexts(InventoryGui gui, Player player, ItemData item) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) SocketData data = ItemSockets.Read(item); TabTexts tabTexts = s_tab.Texts(gui, player, item, data); string text = s_tab.LivePreview ?? Preview(item, data, tabTexts.Enabled); string text2 = ((tabTexts.Hint.Length > 0) ? TextStyle.L(tabTexts.Hint) : ""); if (s_tab.HintInPreview) { ((Component)gui.m_itemCraftType).gameObject.SetActive(false); if (text2.Length > 0) { text = TextStyle.Colored("#" + ColorUtility.ToHtmlStringRGBA(((Graphic)gui.m_itemCraftType).color), text2) + ((text.Length > 0) ? ("\n" + text) : ""); } } else { ((Component)gui.m_itemCraftType).gameObject.SetActive(true); gui.m_itemCraftType.text = text2; } _preview.text = text; UpdateHuntGroupPreview(player, item, data); s_tab.ShowBottom(_choice, gui, item, data); ((Selectable)gui.m_craftButton).interactable = tabTexts.Enabled; ((Component)gui.m_craftButton).GetComponentInChildren<TMP_Text>().text = TextStyle.L(tabTexts.ButtonKey); ((Component)gui.m_craftButton).GetComponent<UITooltip>().m_text = ""; } private static void UpdateHuntGroupPreview(Player player, ItemData item, SocketData data) { string text = s_tab.Mode.ToString() + "|" + ((object)item).GetHashCode() + "|" + _listRaw + "|" + s_tab.ChosenRow + "|" + SocketEffectService.Version; if (!(text == _huntGroupKey)) { _huntGroupKey = text; HuntGroupPanel.SetPreview(s_tab.HuntGroupChange(player, item, data)); } } private static string Preview(ItemData item, SocketData data, bool valid) { string text = (valid ? (s_tab.Mode.ToString() + "|" + ((object)item).GetHashCode() + "|" + _listRaw + "|" + s_tab.ChosenRow + "|" + SocketEffectService.Version) : null); if (text == _previewKey) { return _previewText; } _previewKey = text; _previewText = (valid ? s_tab.Preview(item, data) : ""); return _previewText; } public static void OnCraftStarted(InventoryGui gui, Player player) { s_tab?.CraftStarted(gui, player); } public static void ExecuteAction(InventoryGui gui, Player player) { //IL_007a: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) ItemData val = gui.m_craftUpgradeItem ?? ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData; if (val != null && s_tab != null) { bool flag = s_tab.Execute(gui, player, val); CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation != (Object)null && !s_tab.EffectsWait(val)) { (flag ? currentCraftingStation.m_craftItemDoneEffects : currentCraftingStation.m_craftItemDoneFailEffects).Create(((Component)player).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } if (flag) { ResetChoices(); } gui.UpdateCraftingPanel(false); } } public static void OnItemSelected() { if (!RollShow.IsRunning) { RollShow.Clear(); } } public static void UpdateGamepad(InventoryGui gui) { if (_gamepadFailed || !TabsShown) { return; } try { bool flag = HasController(gui); if (flag && !StepTab(gui) && ChoiceShown(gui)) { StepChoice(); ScrollPool(); } UpdateTabHints(gui, flag); UpdateTooltipFocus(flag); } catch (Exception arg) { _gamepadFailed = true; SetVanillaTabKeys(gui, resting: false); ClearTooltipFocus(); Logger.LogError((object)$"Forge controller input failed and is switched off: {arg}"); } } private static bool HasController(InventoryGui gui) { return ZInput.IsExclusiveGamepadActive() && !ZInput.IsTouchActive() && !Console.IsVisible() && (Object)(object)gui.m_inventoryGroup != (Object)null && gui.m_inventoryGroup.IsActive && gui.m_activeGroup == 3 && gui.m_uiGroups.Length > 3 && gui.m_uiGroups[3].IsActive; } private static bool ChoiceShown(InventoryGui gui) { return IsActive && (Object)(object)_panel != (Object)null && ((Component)_panel).gameObject.activeSelf && _listItem != null && _listItem == ((RecipeDataPair)(ref gui.m_selectedRecipe)).ItemData; } private static void SetVanillaTabKeys(InventoryGui gui, bool resting) { resting &= !_gamepadFailed; RestTabKey(gui.m_tabCraft, resting); RestTabKey(gui.m_tabUpgrade, resting); if (!resting) { SetShown(_hintPrevious, shown: false); SetShown(_hintNext, shown: false); } } private static void RestTabKey(Button tab, bool resting) { UIGamePad val = (((Object)(object)tab != (Object)null) ? ((Component)tab).GetComponent<UIGamePad>() : null); if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled != !resting) { ((Behaviour)val).enabled = !resting; if (resting && (Object)(object)val.m_hint != (Object)null) { val.m_hint.SetActive(false); } } } private static bool StepTab(InventoryGui gui) { int num = (ZInput.GetButtonDown("JoyLTrigger") ? (-1) : (ZInput.GetButtonDown("JoyRTrigger") ? 1 : 0)); if (num == 0) { return false; } int num2 = Mathf.Clamp(CurrentTab + num, 0, 3); if (num2 == CurrentTab) { return true; } Button val = ((num2 == 0) ? gui.m_tabUpgrade : _tabButtons[num2 - 1]); val.OnSubmit((BaseEventData)null); return true; } private static void UpdateTabHints(InventoryGui gui, bool active) { if (active && (Object)(object)_hintsFor != (Object)(object)gui) { _hintsFor = gui; _hintPrevious = TabHint(gui.m_tabUpgrade, "JoyLTrigger", gui.m_tabCraft); _hintNext = TabHint(_tabButtons[_tabButtons.Length - 1], "JoyRTrigger", gui.m_tabUpgrade); } SetShown(_hintPrevious, active && CurrentTab > 0); SetShown(_hintNext, active && CurrentTab < 3); } private static GameObject TabHint(Button tab, string key, Button like) { GameObject val = GamepadHints.CreateHint(((Component)tab).transform, key); UIGamePad val2 = (((Object)(object)like != (Object)null) ? ((Component)like).GetComponent<UIGamePad>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val2.m_hint == (Object)null) { return val; } Transform transform = val2.m_hint.transform; Transform obj = ((transform is RectTransform) ? transform : null); Transform transform2 = val.transform; CopyPlacement((RectTransform)(object)obj, (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null)); TMP_Text componentInChildren = val2.m_hint.GetComponentInChildren<TMP_Text>(true); TMP_Text componentInChildren2 = val.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren2 == (Object)null) { return val; } CopyPlacement(componentInChildren.rectTransform, componentInChildren2.rectTransform); componentInChildren2.enableAutoSizing = componentInChildren.enableAutoSizing; componentInChildren2.fontSize = componentInChildren.fontSize; return val; } private static void CopyPlacement(RectTransform from, RectTransform to) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)from == (Object)null) && !((Object)(object)to == (Object)null)) { to.anchorMin = from.anchorMin; to.anchorMax = from.anchorMax; to.pivot = from.pivot; to.anchoredPosition = from.anchoredPosition; to.sizeDelta = from.sizeDelta; } } private static void SetShown(GameObject go, bool shown) { if ((Object)(object)go != (Object)null && go.activeSelf != shown) { go.SetActive(shown); } } private static void StepChoice() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) bool buttonDown = ZInput.GetButtonDown("JoyRStickUp"); bool buttonDown2 = ZInput.GetButtonDown("JoyRStickDown"); bool buttonDown3 = ZInput.GetButtonDown("JoyRStickLeft"); bool buttonDown4 = ZInput.GetButtonDown("JoyRStickRight"); if (!(buttonDown || buttonDown2 || buttonDown3 || buttonDown4) || _rowMarkers.Count == 0 || Time.unscaledTime - _lastStepAt < 0.08f) { return; } Vector2 joyRightStick = ZInput.GetJoyRightStick(); int num = ((!(Mathf.Abs(joyRightStick.y) >= Mathf.Abs(joyRightStick.x))) ? (s_tab.ListsCandidates ? ((buttonDown4 ? 1 : 0) - (buttonDown3 ? 1 : 0)) : 0) : ((buttonDown2 ? 1 : 0) - (buttonDown ? 1 : 0))); if (num == 0) { return; } int chosenRow = ChosenRow; int num2 = ((chosenRow >= 0 && chosenRow < _rowMarkers.Count) ? Mathf.Clamp(chosenRow + num, 0, _rowMarkers.Count - 1) : 0); if (num2 == chosenRow) { return; } Button val = ForgeTabView.RowButton(_rowMarkers[num2]); if (!((Object)(object)val == (Object)null) && ((Selectable)val).IsInteractable()) { _lastStepAt = Time.unscaledTime; ((UnityEvent)val.onClick).Invoke(); ForgeTabView.EnsureVisible(_rowMarkers[num2]); if ((Object)(object)GamepadRumble.instance != (Object)null) { GamepadRumble.instance.PlayGlobalSelectVibration(); } } } private static void ScrollPool() { //IL_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (_choice.Pool.IsShown) { Vector2 joyRightStick = ZInput.GetJoyRightStick(); float num = 0f; if (Mathf.Abs(joyRightStick.x) > 0.3f && Mathf.Abs(joyRightStick.x) > Mathf.Abs(joyRightStick.y)) { num = joyRightStick.x; } else if (_rowMarkers.Count == 0 && Mathf.Abs(joyRightStick.y) > 0.1f) { num = 0f - joyRightStick.y; } if (num != 0f) { _choice.Pool.Scroll(num, Time.deltaTime); } } } private static void AddTooltipFocus(InventoryGui gui) { RectTransform anchor = (((Object)(object)gui.m_playerGrid != (Object)null) ? gui.m_playerGrid.m_tooltipAnchor : null); foreach (GameObject rowMarker in _rowMarkers) { _rowFocus.Add(ForgeTabView.AddGamepadFocus(rowMarker, anchor)); } } private static void UpdateTooltipFocus(bool active) { GameObject val = null; int chosenRow = ChosenRow; if (active && IsActive && (Object)(object)_panel != (Object)null && ((Component)_panel).gameObject.activeSelf && chosenRow >= 0 && chosenRow < _rowFocus.Count) { val = _rowFocus[chosenRow]; } if (!((Object)(object)val == (Object)(object)_shownFocus)) { if ((Object)(object)_shownFocus != (Object)null) { _shownFocus.SetActive(false); } if ((Object)(object)val != (Object)null) { val.SetActive(true); } _shownFocus = val; } } private static void ClearTooltipFocus() { if ((Object)(object)_shownFocus != (Object)null) { _shownFocus.SetActive(false); } _shownFocus = null; } internal static string ChooseEffectHint() { if (!ZInput.IsExclusiveGamepadActive()) { return "$foe_ui_choose_effect"; } string text = GamepadHints.Glyph("rightStick"); return (text.Length > 0) ? TextStyle.L("$foe_ui_choose_effect_gamepad", text) : "$foe_ui_choose_effect"; } } public static class ForgeTabView { public sealed class RowSpec { public Sprite Icon; public string Name; public int Quality; public bool QualityIsRarity; public int Scars; public Color? GroupColor; public string TooltipTopic; public string TooltipText; public bool Usable = true; public UnityAction OnClick; } public const float PreviewHeight = 125f; public static Image ListFrame { get; private set; } public static Button CloneTab(InventoryGui gui, string labelKey, int slotsRightOfUpgrade, UnityAction onClick) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(((Component)gui.m_tabUpgrade).gameObject, ((Component)gui.m_tabUpgrade).transform.parent); ((Object)val).name = "foe_tab_" + labelKey.TrimStart(new char[1] { '$' }); UIGamePad component = val.GetComponent<UIGamePad>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)component.m_hint != (Object)null && (Object)(object)component.m_hint.transform != (Object)(object)val.transform && component.m_hint.transform.IsChildOf(val.transform)) { Object.DestroyImmediate((Object)(object)component.m_hint); } Object.DestroyImmediate((Object)(object)component); } TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = TextStyle.L(labelKey).ToUpper(CultureInfo.CurrentCulture); } Vector3 val2 = ((Component)gui.m_tabUpgrade).transform.localPosition - ((Component)gui.m_tabCraft).transform.localPosition; val.transform.localPosition = ((Component)gui.m_tabUpgrade).transform.localPosition + val2 * (float)slotsRightOfUpgrade; Button component2 = val.GetComponent<Button>(); ButtonClickedEvent val3 = new ButtonClickedEvent(); ButtonSfx component3 = val.GetComponent<ButtonSfx>(); if ((Object)(object)component3 != (Object)null) { ((UnityEvent)val3).AddListener(new UnityAction(component3.OnClick)); } ((UnityEvent)val3).AddListener(onClick); component2.onClick = val3; return component2; } public static ChoicePanel CreateChoicePanel(InventoryGui gui) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = gui.m_recipeDecription.rectTransform; RectTransform component = new GameObject("foe_trophy_panel", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(((Transform)rectTransform).parent, false); component.anchorMin = rectTransform.anchorMin; component.anchorMax = rectTransform.anchorMax; component.pivot = rectTransform.pivot; component.anchoredPosition = rectTransform.anchoredPosition; component.sizeDelta = rectTransform.sizeDelta; RectTransform val = UiKit.Container("foe_list_area", (Transform)(object)component); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMax = Vector2.zero; RectTransform val2 = UiKit.Container("foe_bottom", (Transform)(object)component); val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(0.5f, 0f); val2.anchoredPosition = Vector2.zero; Vector2 zero = Vector2.zero; Vector2 topInset = default(Vector2); ((Vector2)(ref topInset))..ctor(0f, -42f); RectTransform listContent = CreateList(gui, val, zero, topInset); TMP_Text val3 = UiKit.CloneText(gui.m_recipeDecription, (Transform)(object)val2, "foe_preview"); RectTransform rectTransform2 = val3.rectTransform; rectTransform2.anchorMin = new Vector2(0f, 0f); rectTransform2.anchorMax = new Vector2(1f, 0f); rectTransform2.pivot = new Vector2(0.5f, 0f); ((Behaviour)val3).enabled = true; val3.text = ""; return new ChoicePanel(component, val, listContent, val2, val3); } private static Image FindFrame(Transform list, Scrollbar scrollbar) { Image[] componentsInChildren = ((Component)list).GetComponentsInChildren<Image>(true); foreach (Image val in componentsInChildren) { if (!((Object)(object)val.sprite == (Object)null) && (!((Object)(objec