using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TieredBlackForge")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("TieredBlackForge")] [assembly: AssemblyTitle("TieredBlackForge")] [assembly: AssemblyVersion("0.1.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TieredBlackForge { [BepInPlugin("fr.dessouille.tieredblackforge", "Tiered Black Forge", "0.3.0")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "fr.dessouille.tieredblackforge"; public const string PluginName = "Tiered Black Forge"; public const string PluginVersion = "0.3.0"; internal static ManualLogSource Log; internal static ConfigEntry MistlandsTokens; internal static ConfigEntry AshlandsTokens; internal static ConfigEntry DeepNorthTokens; internal static ConfigEntry SwampTokens; internal static ConfigEntry MountainTokens; internal static ConfigEntry PlainsTokens; internal static ConfigEntry MistlandsRecipes; internal static ConfigEntry AshlandsRecipes; internal static ConfigEntry DeepNorthRecipes; internal static ConfigEntry SwampRecipes; internal static ConfigEntry MountainRecipes; internal static ConfigEntry PlainsRecipes; internal static ConfigEntry MeadowsRecipes; internal static ConfigEntry BlackForestRecipes; private Harmony _harmony; private void Awake() { //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; MistlandsTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "MistlandsTokens", "blackcore,blackmarble,bluejute,sap,softtissue,yggdrasil,wisp,sealbreaker,scalehide,jotunpuff,magecap,royaljelly,bilebag,bloodclot,carapace,mandible,seeker", "Fragments de noms internes de matériaux associés aux Mistlands."); AshlandsTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "AshlandsTokens", "flametal,grausten,proustite,sulfur,bonemaw,morgen,volture,fiddlehead,smokepuff,celestialfeather,charred,asksvin,askvin,bloodstone,jade,iolite", "Fragments de noms internes de matériaux associés aux Ashlands."); DeepNorthTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "DeepNorthTokens", "timberwood,liquidfrost,petrifiedtissue,bloodgold,memorialcoal,frostfire,thunderblood,lingonberr,oat,poteitr,kale,moose,sealblubber,sealpel,elaking,longclaw,frozenbranch,leatherstrap,nornathread,deadpulp,frostcore", "Fragments de noms internes de matériaux associés au Deep North."); SwampTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "SwampTokens", "iron,scrapiron,ancientbark,guck,root,chain,ooze,bloodbag,entrails,witheredbone", "Fragments de noms internes de matériaux associés au Swamp."); MountainTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "MountainTokens", "silver,wolf,fenring,fenris,drake,freeze,obsidian,crystal,onion", "Fragments de noms internes de matériaux associés au Mountain."); PlainsTokens = ((BaseUnityPlugin)this).Config.Bind("Classification", "PlainsTokens", "blackmetal,linen,flax,barley,lox,needle,tar,goblin,fuling", "Fragments de noms internes de matériaux associés au Plains."); MistlandsRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "MistlandsRecipes", "", "Noms internes exacts de recettes forcées dans Mist Lands, séparés par des virgules."); AshlandsRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "AshlandsRecipes", "", "Noms internes exacts de recettes forcées dans Ash Lands, séparés par des virgules."); DeepNorthRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "DeepNorthRecipes", "", "Noms internes exacts de recettes forcées dans Deep North, séparés par des virgules."); SwampRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "SwampRecipes", "", "Noms internes exacts de recettes forcées dans Swamp, séparés par des virgules."); MountainRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "MountainRecipes", "", "Noms internes exacts de recettes forcées dans Mountain, séparés par des virgules."); PlainsRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "PlainsRecipes", "", "Noms internes exacts de recettes forcées dans Plains, séparés par des virgules."); MeadowsRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "MeadowsRecipes", "", "Noms internes exacts de recettes forcées dans Meadows, séparés par des virgules."); BlackForestRecipes = ((BaseUnityPlugin)this).Config.Bind("Overrides", "BlackForestRecipes", "", "Noms internes exacts de recettes forcées dans Black Forest, séparés par des virgules."); _harmony = new Harmony("fr.dessouille.tieredblackforge"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Tiered Black Forge 0.3.0 charge."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal enum ForgeTier { Mistlands, Ashlands, DeepNorth, Swamp, Mountain, Plains, Meadows, BlackForest } internal enum ForgeStationKind { None, BlackForge, Forge, Workbench } internal static class TierState { internal static ForgeTier? Selected; internal static ForgeStationKind GetOpenStationKind() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return ForgeStationKind.None; } try { object? obj = AccessTools.Method(typeof(Player), "GetCurrentCraftingStation", (Type[])null, (Type[])null)?.Invoke(localPlayer, null); CraftingStation val = (CraftingStation)((obj is CraftingStation) ? obj : null); if ((Object)(object)val == (Object)null) { return ForgeStationKind.None; } string text = NormalizeStationName(((Object)((Component)val).gameObject).name); if (text.StartsWith("pieceblackforge") || text.StartsWith("blackforge")) { return ForgeStationKind.BlackForge; } if (text.StartsWith("pieceforge") || text == "forge" || text.StartsWith("forgeclone")) { return ForgeStationKind.Forge; } if (text.StartsWith("pieceworkbench") || text == "workbench" || text.StartsWith("workbenchclone")) { return ForgeStationKind.Workbench; } return ForgeStationKind.None; } catch (Exception ex) { Plugin.Log.LogDebug((object)("Detection de la forge impossible: " + ex.Message)); return ForgeStationKind.None; } } internal static bool IsTierForStation(ForgeTier tier, ForgeStationKind station) { switch (station) { case ForgeStationKind.BlackForge: if (tier != ForgeTier.Mistlands && tier != ForgeTier.Ashlands) { return tier == ForgeTier.DeepNorth; } return true; case ForgeStationKind.Forge: if (tier != ForgeTier.Swamp && tier != ForgeTier.Mountain) { return tier == ForgeTier.Plains; } return true; case ForgeStationKind.Workbench: if (tier != ForgeTier.Meadows) { return tier == ForgeTier.BlackForest; } return true; default: return false; } } private static string NormalizeStationName(string value) { return new string((value ?? string.Empty).Where(char.IsLetterOrDigit).Select(char.ToLowerInvariant).ToArray()); } internal static bool Matches(Recipe recipe, ForgeStationKind station) { if ((Object)(object)recipe == (Object)null) { return false; } if (!Selected.HasValue) { return true; } return RecipeClassifier.GetTier(recipe, station) == Selected; } } internal static class RecipeClassifier { private const string MistlandsOutputs = "jotunbane,demolisher,spinesnap,mistwalker,himminafl,krom,skollandhati,arbalest,carapace"; private const string AshlandsOutputs = "ashlands,flametal,niedhogg,slayer,ripper,eldner,berzerkr,splitner,dyrnwyn,askhide,armorashlands,helmetashlands"; private const string DeepNorthOutputs = "deepnorth,gold,nord,frostfire,thunderblood,protector,vanguard,caller"; private const string SwampOutputs = "atgeiriron,axeiron,battleaxe,bowhuntsman,armoriron,helmetiron,maceiron,pickaxeiron,shieldbanded,shieldiron,shieldserpentscale,sledgeiron,spearelderbark,swordiron,ironnails"; private const string EarlierForgeOutputs = "bronze"; private const string MountainOutputs = "armorwolf,helmetdrake,bowdraugrfang,battleaxecrystal,knifesilver,macesilver,frostner,shieldsilver,spearwolf,swordsilver,capewolf"; private const string PlainsOutputs = "atgeirblackmetal,axeblackmetal,knifeblackmetal,swordblackmetal,pickaxeblackmetal,maceneedle,porcupine,shieldblackmetal,armorpadded,helmetpadded"; private const string MeadowsOutputs = "axeflint,bow,club,hammer,hoe,knifeflint,spearflint,shieldwood,shieldwoodtower,armorragschest,armorragslegs,armorleatherchest,armorleatherlegs,helmetleather,capedeerhide,arrowwood,arrowflint,arrowfire,pickaxeantler,torch"; private const string BlackForestOutputs = "armortrollleatherchest,armortrollleatherlegs,helmettrollleather,capetrollhide,bowfinewood,sledgestagbreaker,sledgewood,shieldbonetower,arrowbronze"; private const string MistlandsMaterials = "blackcore,blackmarble,bluejute,sap,softtissue,yggdrasilwood,wisp,scalehide,mushroomjotunpuff,mushroommagecap,royaljelly,bilebag,bloodclot,carapace,mandible,seekermeat,eitr,refinedeitr,upgrader5armor,upgrader5weapon"; private const string AshlandsMaterials = "flametal,flametalnew,flametalorenew,grausten,proustitepowder,sulfurstone,bonemawmeat,morgenheart,volturemeat,smokepuff,celestialfeather,charredbone,charredcogwheel,asksvinhide,gemstoneblue,gemstonegreen,gemstonered,bloodstone,jade,iolite,upgrader6armor,upgrader6weapon"; private const string DeepNorthMaterials = "gold,bloodgold,timberwood,frostcore,ice,nornthread,moosehide,sealhide,sealblubber,leatherstraps,crownjewel,faderember,memorialcoal,orbthunderblood,orbfrostfire,upgrader7armor,upgrader7weapon"; private const string SwampMaterials = "iron,ironscrap,scrapiron,elderbark,root,guck,chain,ooze,bloodbag,entrails,witheredbone,trophydraugrelite,upgrader2armor,upgrader2weapon"; private const string MountainMaterials = "silver,silverore,wolfpelt,wolffang,freezegland,obsidian,crystal,onion,trophyhatchling,upgrader3armor,upgrader3weapon"; private const string PlainsMaterials = "blackmetal,blackmetalscrap,linenthread,flax,barley,loxpelt,needle,tar,upgrader4armor,upgrader4weapon"; private const string WorkbenchLaterMaterials = "iron,ironscrap,scrapiron,elderbark,root,guck,chain,silver,wolfpelt,wolffang,freezegland,obsidian,crystal,blackmetal,blackmetalscrap,linenthread,loxpelt,needle,tar,carapace,eitr,refinedeitr,flametal,flametalnew,flametalorenew,asksvinhide,gold,bloodgold,timberwood,nornthread"; private const string BlackForestMaterials = "trollhide,finewood,roundlog,corewood,bronze,surtlingcore,greydwarfeye,ancientseed,upgrader1armor,upgrader1weapon"; private const string MeadowsMaterials = "wood,stone,flint,leatherscraps,deerhide,bonefragments,resin,feathers,hardantler,deertrophy,boarmeat,boarhide,upgrader0armor,upgrader0weapon"; internal static ForgeTier? GetTier(Recipe recipe, ForgeStationKind station) { string normalizedRecipeName = Normalize(((Object)recipe).name); if (station == ForgeStationKind.BlackForge) { if (ContainsExact(Plugin.DeepNorthRecipes.Value, normalizedRecipeName)) { return ForgeTier.DeepNorth; } if (ContainsExact(Plugin.AshlandsRecipes.Value, normalizedRecipeName)) { return ForgeTier.Ashlands; } if (ContainsExact(Plugin.MistlandsRecipes.Value, normalizedRecipeName)) { return ForgeTier.Mistlands; } if (OutputContainsAny(recipe, "deepnorth,gold,nord,frostfire,thunderblood,protector,vanguard,caller")) { return ForgeTier.DeepNorth; } if (OutputContainsAny(recipe, "ashlands,flametal,niedhogg,slayer,ripper,eldner,berzerkr,splitner,dyrnwyn,askhide,armorashlands,helmetashlands")) { return ForgeTier.Ashlands; } if (OutputContainsAny(recipe, "jotunbane,demolisher,spinesnap,mistwalker,himminafl,krom,skollandhati,arbalest,carapace")) { return ForgeTier.Mistlands; } if (HasAnyResource(recipe, "gold,bloodgold,timberwood,frostcore,ice,nornthread,moosehide,sealhide,sealblubber,leatherstraps,crownjewel,faderember,memorialcoal,orbthunderblood,orbfrostfire,upgrader7armor,upgrader7weapon") || HasAnyResource(recipe, Plugin.DeepNorthTokens.Value)) { return ForgeTier.DeepNorth; } if (HasAnyResource(recipe, "flametal,flametalnew,flametalorenew,grausten,proustitepowder,sulfurstone,bonemawmeat,morgenheart,volturemeat,smokepuff,celestialfeather,charredbone,charredcogwheel,asksvinhide,gemstoneblue,gemstonegreen,gemstonered,bloodstone,jade,iolite,upgrader6armor,upgrader6weapon") || HasAnyResource(recipe, Plugin.AshlandsTokens.Value)) { return ForgeTier.Ashlands; } if (HasAnyResource(recipe, "blackcore,blackmarble,bluejute,sap,softtissue,yggdrasilwood,wisp,scalehide,mushroomjotunpuff,mushroommagecap,royaljelly,bilebag,bloodclot,carapace,mandible,seekermeat,eitr,refinedeitr,upgrader5armor,upgrader5weapon") || HasAnyResource(recipe, Plugin.MistlandsTokens.Value)) { return ForgeTier.Mistlands; } } if (station == ForgeStationKind.Forge) { if (OutputContainsAny(recipe, "bronze")) { return null; } if (ContainsExact(Plugin.PlainsRecipes.Value, normalizedRecipeName)) { return ForgeTier.Plains; } if (ContainsExact(Plugin.MountainRecipes.Value, normalizedRecipeName)) { return ForgeTier.Mountain; } if (ContainsExact(Plugin.SwampRecipes.Value, normalizedRecipeName)) { return ForgeTier.Swamp; } if (OutputContainsAny(recipe, "atgeirblackmetal,axeblackmetal,knifeblackmetal,swordblackmetal,pickaxeblackmetal,maceneedle,porcupine,shieldblackmetal,armorpadded,helmetpadded")) { return ForgeTier.Plains; } if (OutputContainsAny(recipe, "armorwolf,helmetdrake,bowdraugrfang,battleaxecrystal,knifesilver,macesilver,frostner,shieldsilver,spearwolf,swordsilver,capewolf")) { return ForgeTier.Mountain; } if (OutputContainsAny(recipe, "atgeiriron,axeiron,battleaxe,bowhuntsman,armoriron,helmetiron,maceiron,pickaxeiron,shieldbanded,shieldiron,shieldserpentscale,sledgeiron,spearelderbark,swordiron,ironnails")) { return ForgeTier.Swamp; } if (HasAnyResource(recipe, "blackmetal,blackmetalscrap,linenthread,flax,barley,loxpelt,needle,tar,upgrader4armor,upgrader4weapon") || HasAnyResource(recipe, Plugin.PlainsTokens.Value)) { return ForgeTier.Plains; } if (HasAnyResource(recipe, "silver,silverore,wolfpelt,wolffang,freezegland,obsidian,crystal,onion,trophyhatchling,upgrader3armor,upgrader3weapon") || HasAnyResource(recipe, Plugin.MountainTokens.Value)) { return ForgeTier.Mountain; } if (HasAnyResource(recipe, "iron,ironscrap,scrapiron,elderbark,root,guck,chain,ooze,bloodbag,entrails,witheredbone,trophydraugrelite,upgrader2armor,upgrader2weapon") || HasAnyResource(recipe, Plugin.SwampTokens.Value)) { return ForgeTier.Swamp; } } if (station == ForgeStationKind.Workbench) { if (ContainsExact(Plugin.BlackForestRecipes.Value, normalizedRecipeName)) { return ForgeTier.BlackForest; } if (ContainsExact(Plugin.MeadowsRecipes.Value, normalizedRecipeName)) { return ForgeTier.Meadows; } if (OutputEqualsAny(recipe, "armortrollleatherchest,armortrollleatherlegs,helmettrollleather,capetrollhide,bowfinewood,sledgestagbreaker,sledgewood,shieldbonetower,arrowbronze") || OutputStartsWithAny(recipe, "armortroll,helmettroll")) { return ForgeTier.BlackForest; } if (OutputEqualsAny(recipe, "axeflint,bow,club,hammer,hoe,knifeflint,spearflint,shieldwood,shieldwoodtower,armorragschest,armorragslegs,armorleatherchest,armorleatherlegs,helmetleather,capedeerhide,arrowwood,arrowflint,arrowfire,pickaxeantler,torch") || OutputStartsWithAny(recipe, "armortunic,armorharvester")) { return ForgeTier.Meadows; } if (HasAnyResource(recipe, "iron,ironscrap,scrapiron,elderbark,root,guck,chain,silver,wolfpelt,wolffang,freezegland,obsidian,crystal,blackmetal,blackmetalscrap,linenthread,loxpelt,needle,tar,carapace,eitr,refinedeitr,flametal,flametalnew,flametalorenew,asksvinhide,gold,bloodgold,timberwood,nornthread")) { return null; } if (HasAnyResource(recipe, "trollhide,finewood,roundlog,corewood,bronze,surtlingcore,greydwarfeye,ancientseed,upgrader1armor,upgrader1weapon")) { return ForgeTier.BlackForest; } if (HasAnyResource(recipe, "wood,stone,flint,leatherscraps,deerhide,bonefragments,resin,feathers,hardantler,deertrophy,boarmeat,boarhide,upgrader0armor,upgrader0weapon")) { return ForgeTier.Meadows; } } return null; } internal static string GetDebugName(Recipe recipe) { if ((Object)(object)recipe == (Object)null) { return ""; } string text = (((Object)(object)recipe.m_item != (Object)null) ? ((Object)recipe.m_item).name : ""); return ((Object)recipe).name + " -> " + text; } private static bool OutputContainsAny(Recipe recipe, string csv) { object value; if (recipe == null) { value = null; } else { ItemDrop item = recipe.m_item; value = ((item != null) ? ((Object)item).name : null); } string output = Normalize((string)value); if (output.Length > 0) { return Split(csv).Any((string token) => output.Contains(token)); } return false; } private static bool OutputEqualsAny(Recipe recipe, string csv) { object value; if (recipe == null) { value = null; } else { ItemDrop item = recipe.m_item; value = ((item != null) ? ((Object)item).name : null); } string output = Normalize((string)value); if (output.Length > 0) { return Split(csv).Any((string token) => output == token); } return false; } private static bool OutputStartsWithAny(Recipe recipe, string csv) { object value; if (recipe == null) { value = null; } else { ItemDrop item = recipe.m_item; value = ((item != null) ? ((Object)item).name : null); } string output = Normalize((string)value); if (output.Length > 0) { return Split(csv).Any((string token) => output.StartsWith(token)); } return false; } private static bool HasAnyResource(Recipe recipe, string csv) { if (recipe?.m_resources == null) { return false; } HashSet hashSet = new HashSet(Split(csv)); if (hashSet.Count == 0) { return false; } Requirement[] resources = recipe.m_resources; foreach (Requirement obj in resources) { object value; if (obj == null) { value = null; } else { ItemDrop resItem = obj.m_resItem; value = ((resItem != null) ? ((Object)resItem).name : null); } string text = Normalize((string)value); if (text.Length > 0 && hashSet.Contains(text)) { return true; } } return false; } private static bool ContainsExact(string csv, string normalizedRecipeName) { return Split(csv).Any((string value) => value == normalizedRecipeName); } private static IEnumerable Split(string csv) { return from value in (csv ?? string.Empty).Split(new char[4] { ',', ';', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries).Select(Normalize) where value.Length > 0 select value; } private static string Normalize(string value) { return new string((value ?? string.Empty).Where(char.IsLetterOrDigit).Select(char.ToLowerInvariant).ToArray()); } } internal static class ForgeTabs { private static readonly Dictionary Buttons = new Dictionary(); private static readonly MethodInfo OpenCraftTabMethod = AccessTools.Method(typeof(InventoryGui), "OnTabCraftPressed", Type.EmptyTypes, (Type[])null); private static readonly FieldInfo SelectedRecipeField = AccessTools.Field(typeof(InventoryGui), "m_selectedRecipe"); private static readonly FieldInfo AvailableRecipesField = AccessTools.Field(typeof(InventoryGui), "m_availableRecipes"); private static readonly MethodInfo SetRecipeMethod = AccessTools.Method(typeof(InventoryGui), "SetRecipe", new Type[2] { typeof(int), typeof(bool) }, (Type[])null); private static GameObject _root; private static InventoryGui _gui; private static bool _openingTierTab; private static bool _refreshingPanel; private static Scrollbar _savedRecipeScrollbar; private static float _savedRecipeScrollValue; private static bool _hasSavedRecipeScroll; private static Recipe _savedSelectedRecipe; internal static void Attach(InventoryGui gui) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown if ((Object)(object)gui == (Object)null || (Object)(object)gui.m_tabCraft == (Object)null || (Object)(object)gui.m_tabUpgrade == (Object)null || (Object)(object)_root != (Object)null) { return; } _gui = gui; GameObject gameObject = ((Component)gui.m_tabCraft).gameObject; Transform parent = gameObject.transform.parent; _root = new GameObject("TieredBlackForgeTabs", new Type[1] { typeof(RectTransform) }); RectTransform component = _root.GetComponent(); ((Transform)component).SetParent(parent, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = Vector2.zero; ((Transform)component).SetAsLastSibling(); RectTransform component2 = ((Component)gui.m_tabUpgrade).GetComponent(); CreateButton(gameObject, component2, ForgeTier.Mistlands, "Mistlands", 0); CreateButton(gameObject, component2, ForgeTier.Ashlands, "Ashlands", 1); CreateButton(gameObject, component2, ForgeTier.DeepNorth, "Deep North", 2); CreateButton(gameObject, component2, ForgeTier.Swamp, "Swamp", 0); CreateButton(gameObject, component2, ForgeTier.Mountain, "Mountain", 1); CreateButton(gameObject, component2, ForgeTier.Plains, "Plains", 2); CreateButton(gameObject, component2, ForgeTier.Meadows, "Meadows", 0); CreateButton(gameObject, component2, ForgeTier.BlackForest, "Black Forest", 1); ButtonClickedEvent originalCraftClick = gui.m_tabCraft.onClick; gui.m_tabCraft.onClick = new ButtonClickedEvent(); ((UnityEvent)gui.m_tabCraft.onClick).AddListener((UnityAction)delegate { if (!_openingTierTab) { ClearTierFilter(); } ((UnityEvent)originalCraftClick).Invoke(); RefreshSelection(); ResetRecipeScrollToTop(gui); }); ButtonClickedEvent originalUpgradeClick = gui.m_tabUpgrade.onClick; gui.m_tabUpgrade.onClick = new ButtonClickedEvent(); ((UnityEvent)gui.m_tabUpgrade.onClick).AddListener((UnityAction)delegate { ClearTierFilter(); ((UnityEvent)originalUpgradeClick).Invoke(); RefreshSelection(); ResetRecipeScrollToTop(gui); }); _root.SetActive(false); RefreshSelection(); } private static void CreateButton(GameObject template, RectTransform upgradeRect, ForgeTier tier, string label, int index) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d9: 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_00f1: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_0181: 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_019d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(template, _root.transform, false); ((Object)val).name = $"TierTab_{tier}"; val.SetActive(true); Component[] components = val.GetComponents(); foreach (Component val2 in components) { if ((Object)(object)val2 != (Object)null && ((object)val2).GetType().Name.IndexOf("Tab", StringComparison.OrdinalIgnoreCase) >= 0 && !(val2 is Button)) { Object.Destroy((Object)(object)val2); } } RectTransform component = val.GetComponent(); Rect rect = upgradeRect.rect; float num = Mathf.Max(32f, ((Rect)(ref rect)).height); rect = upgradeRect.rect; float num2 = ((Rect)(ref rect)).width + 6f + (float)index * 106f; component.anchorMin = upgradeRect.anchorMin; component.anchorMax = upgradeRect.anchorMax; component.pivot = upgradeRect.pivot; component.sizeDelta = new Vector2(100f, num); component.anchoredPosition = upgradeRect.anchoredPosition + new Vector2(num2, 0f); CreateUnderline(val, template.transform.parent); TMP_Text componentInChildren = val.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { TMP_Text componentInChildren2 = template.GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren.font = componentInChildren2.font; componentInChildren.fontSharedMaterial = componentInChildren2.fontSharedMaterial; componentInChildren.fontStyle = componentInChildren2.fontStyle; componentInChildren.alignment = componentInChildren2.alignment; ((Graphic)componentInChildren).color = ((Graphic)componentInChildren2).color; componentInChildren.characterSpacing = componentInChildren2.characterSpacing; componentInChildren.fontSizeMax = componentInChildren2.fontSize; } componentInChildren.text = label.ToUpperInvariant(); componentInChildren.enableAutoSizing = true; componentInChildren.fontSizeMin = 10f; } Button component2 = val.GetComponent