Decompiled source of Runas de Yggdrasil v0.1.1

plugins/RunasDeYggdrasil.dll

Decompiled 19 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using MagicaCloth2;
using Microsoft.CodeAnalysis;
using RunasDeYggdrasil.Altar;
using RunasDeYggdrasil.Base;
using RunasDeYggdrasil.Commands;
using RunasDeYggdrasil.Equipment;
using RunasDeYggdrasil.Items;
using RunasDeYggdrasil.Runes;
using RunasDeYggdrasil.Sockets;
using RunasDeYggdrasil.Text;
using RunasDeYggdrasil.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.PostProcessing;
using UnityEngine.Rendering;
using UnityEngine.TextCore.LowLevel;
using UnityEngine.UI;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_postprocessing")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("RunasDeYggdrasil")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("RunasDeYggdrasil")]
[assembly: AssemblyTitle("RunasDeYggdrasil")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RunasDeYggdrasil
{
	internal class ModConfig
	{
		private static readonly bool Pt = PlayerPrefs.GetString("language", "English").StartsWith("Portuguese");

		private static readonly Dictionary<int, string[]> Sections = new Dictionary<int, string[]>
		{
			[1] = new string[2] { "Runes", "Runas" },
			[2] = new string[2] { "Repetition", "Repeticao" },
			[3] = new string[2] { "Global cap", "Teto global" },
			[4] = new string[2] { "Development", "Desenvolvimento" },
			[5] = new string[2] { "Sockets", "Espacos" },
			[6] = new string[2] { "Chisel", "Cinzel" },
			[7] = new string[2] { "Rune drops", "Drops de runas" },
			[8] = new string[2] { "Attributes", "Atributos" },
			[9] = new string[2] { "Interface", "Interface" },
			[10] = new string[2] { "Quick login", "Login rapido" },
			[11] = new string[2] { "Belt", "Cinto" },
			[12] = new string[2] { "Double hotbar", "Barra dupla" },
			[13] = new string[2] { "Rings", "Aneis" },
			[14] = new string[2] { "Base", "Base" },
			[15] = new string[2] { "Runes on weapons", "Runas na arma" },
			[16] = new string[2] { "Enhancement", "Aprimoramento" },
			[17] = new string[2] { "Altar", "Altar" }
		};

		private readonly ConfigFile _file;

		private readonly List<KeyValuePair<ConfigEntryBase, ConfigDefinition[]>> _legacy = new List<KeyValuePair<ConfigEntryBase, ConfigDefinition[]>>();

		private int _order = 1000;

		public ConfigEntry<float> ValorMenor { get; }

		public ConfigEntry<float> ValorComum { get; }

		public ConfigEntry<float> ValorSuperior { get; }

		public ConfigEntry<int> RunasComValorCheio { get; }

		public ConfigEntry<float> FatorDeReducao { get; }

		public ConfigEntry<bool> TetoGlobalAtivado { get; }

		public ConfigEntry<float> TetoEmSuperiores { get; }

		public ConfigEntry<string> TetosPorRuna { get; }

		public ConfigEntry<int> AltarRestauracaoEitr { get; }

		public ConfigEntry<int> AltarRestauracaoMaterial { get; }

		public ConfigEntry<int> AltarAplicarEitrPorNivel { get; }

		public ConfigEntry<int> AltarExtracaoChefe { get; }

		public ConfigEntry<int> AltarCombinarQuantidade { get; }

		public ConfigEntry<int> ReforjaVolatilPequeno { get; }

		public ConfigEntry<int> ReforjaVolatilGrande { get; }

		public ConfigEntry<int> ReforjaRefinadoPequeno { get; }

		public ConfigEntry<int> ReforjaRefinadoGrande { get; }

		public ConfigEntry<float> ReforjaBonusRefinado { get; }

		public ConfigEntry<int> ArmazemCapacidade { get; }

		public ConfigEntry<bool> LogsDetalhados { get; }

		public ConfigEntry<int> MaxPequeno { get; }

		public ConfigEntry<int> MaxGrande { get; }

		public ConfigEntry<int> MaxAcessorio { get; }

		public ConfigEntry<string> PesosPequeno { get; }

		public ConfigEntry<string> PesosGrande { get; }

		public ConfigEntry<string> ItensExcluidos { get; }

		public ConfigEntry<string> GruposForcados { get; }

		public ConfigEntry<float> ChanceMonstroDuasEstrelas { get; }

		public ConfigEntry<float> ChanceBauMasmorra { get; }

		public ConfigEntry<int> CinzeisPorChefe { get; }

		public ConfigEntry<float> ChanceDvalinChefe { get; }

		public ConfigEntry<string> BausDeMasmorra { get; }

		public ConfigEntry<string> DropPrado { get; }

		public ConfigEntry<string> DropFlorestaNegra { get; }

		public ConfigEntry<string> DropPantano { get; }

		public ConfigEntry<string> DropMontanha { get; }

		public ConfigEntry<string> DropPlanicies { get; }

		public ConfigEntry<string> DropNevoas { get; }

		public ConfigEntry<string> DropAshlands { get; }

		public ConfigEntry<float> MultUmaEstrela { get; }

		public ConfigEntry<float> MultDuasEstrelas { get; }

		public ConfigEntry<int> RunasPorChefe { get; }

		public ConfigEntry<bool> CuraContinuaDaComida { get; }

		public ConfigEntry<bool> TooltipPropria { get; }

		public ConfigEntry<float> LarguraTooltip { get; }

		public ConfigEntry<float> EscalaTooltip { get; }

		public ConfigEntry<float> EquipamentosX { get; }

		public ConfigEntry<float> EquipamentosY { get; }

		public ConfigEntry<bool> LoginRapido { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoComida1 { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoComida2 { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoComida3 { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoPocao1 { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoPocao2 { get; }

		public ConfigEntry<KeyboardShortcut> AtalhoPocao3 { get; }

		public ConfigEntry<bool> MostrarComidas { get; }

		public ConfigEntry<bool> MostrarPocoes { get; }

		public ConfigEntry<float> BarraCintoX { get; }

		public ConfigEntry<float> BarraCintoY { get; }

		public ConfigEntry<KeyCode> TrocaBarra { get; }

		public ConfigEntry<float> AnelChanceBau { get; }

		public ConfigEntry<float> AprimChanceMonstro { get; }

		public ConfigEntry<float> AprimChanceBau { get; }

		public ConfigEntry<int> AprimChefeMin { get; }

		public ConfigEntry<int> AprimChefeMax { get; }

		public ConfigEntry<float> AnelChancePorEstrela { get; }

		public ConfigEntry<float> AnelChanceUmStatus { get; }

		public ConfigEntry<float> AnelChanceDoisStatus { get; }

		public ConfigEntry<string> AnelValoresTiers { get; }

		public ConfigEntry<KeyCode> TeclaGuardarBase { get; }

		public ConfigEntry<KeyCode> TeclaAutomatico { get; }

		public ConfigEntry<bool> RunasNaArma { get; }

		public ConfigEntry<float> RaioProducao { get; }

		public ConfigEntry<float> RaioColeta { get; }

		public ConfigEntry<string> LoginRapidoEndereco { get; }

		public ConfigEntry<string> LoginRapidoSenha { get; }

		public ConfigEntry<string> LoginRapidoNome { get; }

		public bool RecebidaDoServidor { get; private set; }

		private ConfigEntry<T> Opt<T>(int section, string key, string oldKey, string ptName, T value, bool server, string en, string pt, AcceptableValueBase range = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			string[] array = Sections[section];
			ConfigurationManagerAttributes val = new ConfigurationManagerAttributes
			{
				IsAdminOnly = server,
				Order = _order--,
				Category = (Pt ? $"{section:00} - {array[1]}" : null),
				DispName = (Pt ? ptName : null)
			};
			string text = ((!server) ? (Pt ? " [Local, de cada jogador]" : " [Local, per player]") : (Pt ? " [Definido pelo servidor]" : " [Set by the server]"));
			ConfigEntry<T> val2 = _file.Bind<T>($"{section:00} - {array[0]}", key, value, new ConfigDescription((Pt ? pt : en) + text, range, new object[1] { val }));
			_legacy.Add(new KeyValuePair<ConfigEntryBase, ConfigDefinition[]>((ConfigEntryBase)(object)val2, (ConfigDefinition[])(object)new ConfigDefinition[2]
			{
				new ConfigDefinition($"{section:00} - {array[1]}", oldKey),
				new ConfigDefinition($"{section} - {array[1]}", oldKey)
			}));
			return val2;
		}

		public ModConfig(ConfigFile file)
		{
			_file = file;
			ValorMenor = Opt(1, "MinorValue", "ValorMenor", "Valor da runa Menor", 5f, server: true, "Bonus, in %, given by a Lesser rune. Runes with their own scale (Ulf, resistances, Odd and others) ignore this value.", "Bônus, em %, que uma runa Menor dá. Runas com escala própria (Ulf, resistências, Odd e outras) não usam este valor.");
			ValorComum = Opt(1, "CommonValue", "ValorComum", "Valor da runa Comum", 10f, server: true, "Bonus, in %, given by a Common rune.", "Bônus, em %, que uma runa Comum dá.");
			ValorSuperior = Opt(1, "SuperiorValue", "ValorSuperior", "Valor da runa Superior", 25f, server: true, "Bonus, in %, given by a Greater rune.", "Bônus, em %, que uma runa Superior dá.");
			RunasComValorCheio = Opt(2, "FullValueRunes", "RunasComValorCheio", "Runas com valor cheio", 3, server: true, "How many equal runes on the same item give their full bonus. The next ones get the reduction below.", "Quantas runas iguais no mesmo item valem o bônus inteiro. As seguintes recebem a redução abaixo.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6));
			FatorDeReducao = Opt(2, "ReductionFactor", "FatorDeReducao", "Fator de redução", 0.5f, server: true, "Each equal rune past the full-value ones is worth this fraction of the previous one. 0.5 = half; 1 = no reduction.", "Cada runa igual além das de bônus inteiro vale esta fração da anterior. 0,5 = metade; 1 = sem redução.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			TetoGlobalAtivado = Opt(3, "Enabled", "Ativado", "Ativado", value: false, server: true, "Caps the total of each rune, adding up all equipped gear.", "Limita o total de cada runa somando todo o equipamento equipado.");
			TetoEmSuperiores = Opt(3, "CapInSuperiors", "TetoEmSuperiores", "Teto em runas Superiores", 4f, server: true, "Cap of each rune, measured in Greater runes of that rune. With 4: Bál up to 100%, Sur up to 20%, Ulf up to 10%.", "Teto de cada runa, em quantidade de runas Superiores dela. Com 4: Bál até 100%, Sur até 20%, Ulf até 10%.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f));
			TetosPorRuna = Opt(3, "CapsPerRune", "TetosPorRuna", "Tetos por runa", "", server: true, "Own cap, in %, for specific runes, replacing the one above. Format Id:value, comma-separated. Example: Odd:10,Sur:15. The Ids are in runas.yaml.", "Teto próprio, em %, para runas específicas, no lugar do de cima. Formato Id:valor, separados por vírgula. Exemplo: Odd:10,Sur:15. Os Ids estão no runas.yaml.");
			LogsDetalhados = Opt(4, "DetailedLogs", "LogsDetalhados", "Logs detalhados", value: false, server: false, "Writes extra details to the log, to investigate problems.", "Escreve detalhes extras no log, para investigar problemas.");
			MaxPequeno = Opt(5, "MaxSmall", "MaxPequeno", "Máximo em itens pequenos", 4, server: true, "Maximum rune sockets on small items: one-handed weapons, shields, helmets, legs, gloves, pickaxes and axes. The item's biome may limit it further.", "Máximo de espaços de runa em itens pequenos: armas de uma mão, escudos, capacetes, calças, luvas, picaretas e machados. O bioma do item pode limitar a menos.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6));
			MaxGrande = Opt(5, "MaxLarge", "MaxGrande", "Máximo em itens grandes", 6, server: true, "Maximum rune sockets on large items: two-handed weapons, bows, crossbows and chest armor. The item's biome may limit it further.", "Máximo de espaços de runa em itens grandes: armas de duas mãos, arcos, bestas e peitorais. O bioma do item pode limitar a menos.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6));
			MaxAcessorio = Opt(5, "MaxAccessory", "MaxAcessorio", "Máximo em acessórios", 1, server: true, "Maximum rune sockets on accessories: capes, utility items and trinkets.", "Máximo de espaços de runa em acessórios: capas, itens de utilidade e Trinkets.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 6));
			PesosPequeno = Opt(5, "SmallWeights", "PesosPequeno", "Pesos dos itens pequenos", "40,30,20,10", server: true, "Relative chance of getting 1, 2, 3 and 4 sockets on small items, with the chisel and the Reforge.", "Chance relativa de sair 1, 2, 3 e 4 espaços em itens pequenos, no cinzel e na Reforja.");
			PesosGrande = Opt(5, "LargeWeights", "PesosGrande", "Pesos dos itens grandes", "30,25,20,12,8,5", server: true, "Relative chance of getting 1 to 6 sockets on large items, with the chisel and the Reforge.", "Chance relativa de sair de 1 a 6 espaços em itens grandes, no cinzel e na Reforja.");
			ItensExcluidos = Opt(5, "ExcludedItems", "ItensExcluidos", "Itens excluídos", "Wishbone,Demister", server: true, "Items that never get rune sockets. Prefab names, comma-separated.", "Itens que nunca recebem espaços de runa. Nomes de prefab separados por vírgula.");
			GruposForcados = Opt(5, "ForcedGroups", "GruposForcados", "Grupos forçados", "", server: true, "Changes the group of specific items. Format Prefab:Group, comma-separated. Groups: Pequeno (small), Grande (large), Acessorio (accessory), Excluido (excluded). Example: BackpackMeadows:Pequeno", "Muda o grupo de itens específicos. Formato Prefab:Grupo, separados por vírgula. Grupos: Pequeno, Grande, Acessorio, Excluido. Exemplo: BackpackMeadows:Pequeno");
			ChanceMonstroDuasEstrelas = Opt(6, "TwoStarMonsterChance", "ChanceMonstroDuasEstrelas", "Chance em monstros de 2 estrelas", 5f, server: true, "Chance, in %, of a monster with 2 or more stars dropping a Carver's Chisel.", "Chance, em %, de um monstro com 2 ou mais estrelas soltar um Cinzel do Entalhador.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			ChanceBauMasmorra = Opt(6, "DungeonChestChance", "ChanceBauMasmorra", "Chance em baús de masmorra", 10f, server: true, "Chance, in %, of a dungeon chest holding a Carver's Chisel.", "Chance, em %, de um baú de masmorra conter um Cinzel do Entalhador.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			CinzeisPorChefe = Opt(6, "ChiselsPerBoss", "CinzeisPorChefe", "Cinzéis por chefe", 1, server: true, "Chisels every boss always drops.", "Cinzéis que cada chefe sempre solta.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10));
			ChanceDvalinChefe = Opt(6, "BossDvalinChance", "ChanceDvalinChefe", "Chance de Cinzel de Dvalin", 25f, server: true, "Chance, in %, of each boss chisel being a Dvalin's Chisel (opens at least half of the maximum sockets).", "Chance, em %, de cada cinzel de chefe ser um Cinzel de Dvalin (abre no mínimo metade do máximo de espaços).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
			BausDeMasmorra = Opt(6, "DungeonChests", "BausDeMasmorra", "Baús de masmorra", "TreasureChest_forestcrypt,TreasureChest_sunkencrypt,TreasureChest_mountaincave,TreasureChest_dvergrtower,TreasureChest_dvergrtown,TreasureChest_charredfortress", server: true, "Chests outside dungeons that can also hold chisels, like dungeon chests. Prefab names, comma-separated.", "Baús fora de masmorras que também podem conter cinzéis, como os de masmorra. Nomes de prefab separados por vírgula.");
			DropPrado = Opt(7, "Meadows", "Prado", "Prado", "1.5;100,0,0", server: true, "Runes dropped by Meadows monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros do Prado soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropFlorestaNegra = Opt(7, "BlackForest", "FlorestaNegra", "Floresta Negra", "2;90,10,0", server: true, "Runes dropped by Black Forest monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros da Floresta Negra soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropPantano = Opt(7, "Swamp", "Pantano", "Pântano", "2.5;70,30,0", server: true, "Runes dropped by Swamp and ocean monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros do Pântano e do oceano soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropMontanha = Opt(7, "Mountain", "Montanha", "Montanha", "3;50,45,5", server: true, "Runes dropped by Mountain monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros da Montanha soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropPlanicies = Opt(7, "Plains", "Planicies", "Planícies", "3;30,55,15", server: true, "Runes dropped by Plains monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros das Planícies soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropNevoas = Opt(7, "Mistlands", "Nevoas", "Névoas", "3.5;15,55,30", server: true, "Runes dropped by Mistlands monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros das Névoas soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			DropAshlands = Opt(7, "Ashlands", "Ashlands", "Ashlands", "4;5,45,50", server: true, "Runes dropped by Ashlands and Deep North monsters. Format: chance%;weights Lesser,Common,Greater. Example: 2;90,10,0 = 2% per monster, 90% Lesser and 10% Common.", "Runas que os monstros de Ashlands e do Deep North soltam. Formato: chance%;pesos Menor,Comum,Superior. Exemplo: 2;90,10,0 = 2% por monstro, 90% Menor e 10% Comum.");
			MultUmaEstrela = Opt(7, "OneStarMultiplier", "MultUmaEstrela", "Multiplicador de 1 estrela", 1.5f, server: true, "Multiplies the rune chance of 1-star monsters.", "Multiplica a chance de runa de monstros com 1 estrela.");
			MultDuasEstrelas = Opt(7, "TwoStarMultiplier", "MultDuasEstrelas", "Multiplicador de 2 estrelas", 2.5f, server: true, "Multiplies the rune chance of monsters with 2 or more stars.", "Multiplica a chance de runa de monstros com 2 ou mais estrelas.");
			RunasPorChefe = Opt(7, "RunesPerBoss", "RunasPorChefe", "Runas por chefe", 2, server: true, "Runes every boss always drops, with strengths rolled as in the biome after the boss's.", "Runas que cada chefe sempre solta, com as forças sorteadas como no bioma seguinte ao dele.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10));
			CuraContinuaDaComida = Opt(8, "ContinuousFoodHealing", "CuraContinuaDaComida", "Cura contínua da comida", value: true, server: true, "Food healing comes little by little (every 250 ms) instead of all at once every 10 s, with the same total. Pauses for 6 s after any damage.", "A cura da comida vem aos poucos (a cada 250 ms) em vez de toda a cada 10 s, com o mesmo total. Pausa por 6 s depois de qualquer dano.");
			TooltipPropria = Opt(9, "CustomTooltip", "TooltipPropria", "Descrição própria", value: true, server: false, "Uses the mod's item description. Off, the game's description comes back.", "Usa a descrição de itens do mod. Desligada, volta a do jogo.");
			LarguraTooltip = Opt(9, "TooltipWidth", "LarguraTooltip", "Largura da descrição", 420f, server: false, "Width of the mod's item description, in pixels.", "Largura da descrição de itens do mod, em pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(300f, 700f));
			EscalaTooltip = Opt(9, "TooltipScale", "EscalaTooltip", "Tamanho da descrição", 0.8f, server: false, "Size of the mod's item description. 1 = full size.", "Tamanho da descrição de itens do mod. 1 = tamanho cheio.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1.5f));
			EquipamentosX = Opt(9, "EquipmentX", "EquipamentosX", "Equipamentos X", 0f, server: false, "Moves the equipment window horizontally, in pixels. Negative = to the left.", "Move a janela de equipamentos na horizontal, em pixels. Negativo = para a esquerda.");
			EquipamentosY = Opt(9, "EquipmentY", "EquipamentosY", "Equipamentos Y", 0f, server: false, "Moves the equipment window vertically, in pixels. Negative = down.", "Move a janela de equipamentos na vertical, em pixels. Negativo = para baixo.");
			LoginRapido = Opt(10, "Enabled", "Ativado", "Ativado", value: true, server: false, "Shows the Quick Login button in the main menu, which joins the server below directly.", "Mostra o botão Login Rápido no menu principal, que entra direto no servidor abaixo.");
			LoginRapidoEndereco = Opt(10, "Address", "Endereco", "Endereço", "", server: false, "Quick Login server address, as IP:port.", "Endereço do servidor do Login Rápido, no formato IP:porta.");
			LoginRapidoSenha = Opt(10, "Password", "Senha", "Senha", "", server: false, "Quick Login server password. Empty, the game asks for it when joining.", "Senha do servidor do Login Rápido. Vazia, o jogo pede ao entrar.");
			LoginRapidoNome = Opt(10, "Name", "Nome", "Nome", "", server: false, "Name shown on the button when the server doesn't report its own name.", "Nome mostrado no botão quando o servidor não informa o próprio nome.");
			AtalhoComida1 = Key("FoodKey1", "AtalhoComida1", "Atalho da comida 1", (KeyCode)49, "Eats the food in the 1st belt slot.", "Come a comida do 1º espaço do cinto.");
			AtalhoComida2 = Key("FoodKey2", "AtalhoComida2", "Atalho da comida 2", (KeyCode)50, "Eats the food in the 2nd belt slot.", "Come a comida do 2º espaço do cinto.");
			AtalhoComida3 = Key("FoodKey3", "AtalhoComida3", "Atalho da comida 3", (KeyCode)51, "Eats the food in the 3rd belt slot.", "Come a comida do 3º espaço do cinto.");
			AtalhoPocao1 = Key("PotionKey1", "AtalhoPocao1", "Atalho da poção 1", (KeyCode)52, "Drinks the potion in the 1st belt slot.", "Bebe a poção do 1º espaço do cinto.");
			AtalhoPocao2 = Key("PotionKey2", "AtalhoPocao2", "Atalho da poção 2", (KeyCode)53, "Drinks the potion in the 2nd belt slot.", "Bebe a poção do 2º espaço do cinto.");
			AtalhoPocao3 = Key("PotionKey3", "AtalhoPocao3", "Atalho da poção 3", (KeyCode)54, "Drinks the potion in the 3rd belt slot.", "Bebe a poção do 3º espaço do cinto.");
			MostrarComidas = Opt(11, "ShowFood", "MostrarComidas", "Mostrar comidas", value: true, server: false, "Shows the belt's food slots in the equipment window. Also toggled by the button next to the belt.", "Mostra os espaços de comida do cinto na janela de equipamentos. Também muda pelo botão ao lado do cinto.");
			MostrarPocoes = Opt(11, "ShowPotions", "MostrarPocoes", "Mostrar poções", value: true, server: false, "Shows the belt's potion slots in the equipment window. Also toggled by the button next to the belt.", "Mostra os espaços de poção do cinto na janela de equipamentos. Também muda pelo botão ao lado do cinto.");
			BarraCintoX = Opt(11, "BeltBarX", "BarraCintoX", "Barra do cinto X", 0f, server: false, "Moves the belt's food and potion bar on the game screen horizontally, in pixels.", "Move na horizontal, em pixels, a barra de comida e poções do cinto na tela de jogo.");
			BarraCintoY = Opt(11, "BeltBarY", "BarraCintoY", "Barra do cinto Y", 0f, server: false, "Moves the belt's food and potion bar on the game screen vertically, in pixels.", "Move na vertical, em pixels, a barra de comida e poções do cinto na tela de jogo.");
			TrocaBarra = Opt<KeyCode>(12, "SwapKey", "TeclaDeTroca", "Tecla de troca", (KeyCode)304, server: false, "While holding this key, keys 1 to 8 swap the hotbar slot's item with its reserve item instead of using it.", "Segurando esta tecla, as teclas 1 a 8 trocam o item do espaço da barra pelo item reserva dele, em vez de usá-lo.");
			AnelChanceBau = Opt(13, "ChestChance", "ChancePorBau", "Chance por baú", 2f, server: true, "Chance, in %, of each of the biome's 3 rings being in a dungeon or ruin chest, the first time it is opened.", "Chance, em %, de cada um dos 3 anéis do bioma estar num baú de masmorra ou ruína, na primeira vez que ele é aberto.");
			AnelChancePorEstrela = Opt(13, "ChancePerStar", "ChancePorEstrela", "Chance por estrela", 0.5f, server: true, "Chance, in %, per star, of a monster dropping a ring of the biome. With 0.5: 1 star = 0.5%, 2 stars = 1%. Animals don't count.", "Chance, em %, por estrela, de um monstro soltar um anel do bioma. Com 0,5: 1 estrela = 0,5%, 2 estrelas = 1%. Animais não contam.");
			AnelChanceUmStatus = Opt(13, "OneStatChance", "ChanceUmStatus", "Chance de 1 status", 40f, server: true, "Chance, in %, of a ring coming with 1 rune stat.", "Chance, em %, de um anel vir com 1 status de runa.");
			AnelChanceDoisStatus = Opt(13, "TwoStatChance", "ChanceDoisStatus", "Chance de 2 status", 15f, server: true, "Chance, in %, of a ring coming with 2 rune stats. The rest come with none.", "Chance, em %, de um anel vir com 2 status de runa. O resto vem sem status.");
			AnelValoresTiers = Opt(13, "TierReference", "ReferenciaTiers", "Referência dos tiers", "", server: true, "Reference damage of each ring stat tier, from 0 to 9, comma-separated. The stat rolls between 1/4 and 1/3 of the reference. Empty = calculated from the game's axe damage.", "Dano de referência de cada tier dos status dos anéis, do 0 ao 9, separados por vírgula. O status sai entre 1/4 e 1/3 da referência. Vazio = calculado pelo dano dos machados do jogo.");
			TeclaAutomatico = Opt<KeyCode>(14, "AutoProductionKey", "TeclaAutomatico", "Tecla da produção automática", (KeyCode)117, server: false, "Shift + this key turns automatic production on or off for the building you are looking at (smelter, kiln, windmill and others).", "Shift + esta tecla liga ou desliga a produção automática da construção que você está olhando (fornalha, carvoaria, moinho e outras).");
			RaioProducao = Opt(14, "ProductionRadius", "RaioProducao", "Raio da produção", 15f, server: true, "Distance, in meters, within which automatic production takes ore and fuel from chests.", "Distância, em metros, em que a produção automática busca minério e combustível nos baús.");
			RaioColeta = Opt(14, "PickupRadius", "RaioColeta", "Raio de coleta", 20f, server: true, "Distance, in meters, within which chests pick up from the ground the items they already store. 0 turns it off.", "Distância, em metros, em que os baús recolhem do chão os itens que já guardam. 0 desliga.");
			TeclaGuardarBase = Opt<KeyCode>(14, "StoreKey", "TeclaGuardar", "Tecla de guardar", (KeyCode)121, server: false, "Stores inventory and bag items in the base chests that already hold the same items.", "Guarda os itens do inventário e da bolsa nos baús da base que já têm itens iguais.");
			RunasNaArma = Opt(15, "Show", "Mostrar", "Mostrar", value: true, server: false, "Shows the engraved runes on the model of equipped items. Changes immediately.", "Mostra as runas gravadas no modelo dos itens equipados. Muda na hora.");
			file.SettingChanged += delegate(object sender, SettingChangedEventArgs args)
			{
				if ((object)args.ChangedSetting == RunasNaArma)
				{
					WeaponGlyphs.Invalidate();
				}
			};
			AprimChanceMonstro = Opt(16, "MonsterChance", "ChanceMonstro", "Chance em monstros", 1f, server: true, "Chance, in %, of a monster dropping a worn enhancement item of a random type. Animals don't count.", "Chance, em %, de um monstro soltar um item de aprimoramento desgastado, de tipo sorteado. Animais não contam.");
			AprimChanceBau = Opt(16, "ChestChance", "ChanceBau", "Chance em baús", 5f, server: true, "Chance, in %, of a dungeon or ruin chest holding a worn enhancement item, the first time it is opened.", "Chance, em %, de um baú de masmorra ou ruína ter um item de aprimoramento desgastado, na primeira vez que ele é aberto.");
			AprimChefeMin = Opt(16, "BossMin", "ChefeMinimo", "Mínimo por chefe", 1, server: true, "Minimum worn enhancement items every boss drops.", "Mínimo de itens de aprimoramento desgastados que cada chefe solta.");
			AprimChefeMax = Opt(16, "BossMax", "ChefeMaximo", "Máximo por chefe", 3, server: true, "Maximum worn enhancement items every boss drops.", "Máximo de itens de aprimoramento desgastados que cada chefe solta.");
			AltarRestauracaoEitr = Opt(17, "RestoreEitr", "RestauracaoEitr", "Eitr da restauração", 5, server: true, "Volatile Eitr spent to restore a worn enhancement item.", "Eitr Volátil gasto para restaurar um item de aprimoramento desgastado.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100));
			AltarRestauracaoMaterial = Opt(17, "RestoreMaterial", "RestauracaoMaterial", "Material da restauração", 5, server: true, "Amount of the biome material spent to restore a worn item.", "Quantidade do material de bioma gasta para restaurar um item desgastado.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100));
			AltarAplicarEitrPorNivel = Opt(17, "ApplyEitrPerLevel", "AplicarEitrPorNivel", "Eitr por nível ao aplicar", 5, server: true, "Volatile Eitr per level when applying an enhancement. With 5: taking the item to +3 costs 15.", "Eitr Volátil por nível ao aplicar um aprimoramento. Com 5: levar o item a +3 custa 15.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100));
			AltarExtracaoChefe = Opt(17, "BossExtraction", "ExtracaoChefe", "Extração de troféu de chefe", 10, server: true, "Volatile Eitr extracted from each boss trophy. Other trophies give 1 in the Meadows and +1 per biome.", "Eitr Volátil extraído de cada troféu de chefe. Os outros troféus rendem 1 no Prado e +1 por bioma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100));
			AltarCombinarQuantidade = Opt(17, "CombineAmount", "CombinarQuantidade", "Quantidade para combinar", 3, server: true, "How many equal enhancement items or runes become 1 of the next version or strength.", "Quantos itens de aprimoramento ou runas iguais viram 1 da versão ou força seguinte.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10));
			ReforjaVolatilPequeno = Opt(17, "ReforgeVolatileSmall", "ReforjaVolatilPequeno", "Reforja: Volátil (até 4 espaços)", 10, server: true, "Volatile Eitr spent per reforge on items of up to 4 sockets.", "Eitr Volátil gasto por reforja em itens de até 4 espaços.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200));
			ReforjaVolatilGrande = Opt(17, "ReforgeVolatileLarge", "ReforjaVolatilGrande", "Reforja: Volátil (até 6 espaços)", 15, server: true, "Volatile Eitr spent per reforge on items of up to 6 sockets.", "Eitr Volátil gasto por reforja em itens de até 6 espaços.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200));
			ReforjaRefinadoPequeno = Opt(17, "ReforgeRefinedSmall", "ReforjaRefinadoPequeno", "Reforja: Refinado (até 4 espaços)", 2, server: true, "Refined Eitr spent per reforge on items of up to 4 sockets, when used instead of Volatile.", "Eitr Refinado gasto por reforja em itens de até 4 espaços, quando usado no lugar do Volátil.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50));
			ReforjaRefinadoGrande = Opt(17, "ReforgeRefinedLarge", "ReforjaRefinadoGrande", "Reforja: Refinado (até 6 espaços)", 3, server: true, "Refined Eitr spent per reforge on items of up to 6 sockets, when used instead of Volatile.", "Eitr Refinado gasto por reforja em itens de até 6 espaços, quando usado no lugar do Volátil.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50));
			ReforjaBonusRefinado = Opt(17, "ReforgeRefinedBonus", "ReforjaBonusRefinado", "Reforja: bônus do Refinado", 20f, server: true, "Increase, in %, of the chances of gaining sockets when reforging with Refined Eitr. With 20: 10% becomes 12%.", "Aumento, em %, das chances de ganhar espaços ao reforjar com Eitr Refinado. Com 20: 10% vira 12%.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f));
			ArmazemCapacidade = Opt(17, "StorageCapacity", "ArmazemCapacidade", "Capacidade do Armazém", 10000, server: true, "How many of each item fit in the Runic Vault's Storage.", "Quantos de cada item cabem no Armazém do Cofre Rúnico.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(100, 1000000));
			MigrateOldNames();
			SynchronizationManager.OnConfigurationSynchronized += delegate(object _, ConfigurationSynchronizationEventArgs args)
			{
				RecebidaDoServidor = true;
				Logger.LogInfo((object)(args.InitialSynchronization ? "Configuração recebida do servidor." : "Configuração atualizada pelo servidor."));
			};
		}

		public HashSet<string> ParseExcludedItems()
		{
			return ItemClassifier.SplitList(ItensExcluidos.Value);
		}

		public Dictionary<string, SocketGroup> ParseForcedGroups()
		{
			Dictionary<string, SocketGroup> dictionary = new Dictionary<string, SocketGroup>(StringComparer.OrdinalIgnoreCase);
			foreach (string item in ItemClassifier.SplitList(GruposForcados.Value))
			{
				int num = item.IndexOf(':');
				if (num > 0 && ItemClassifier.TryParseGroup(item.Substring(num + 1), out var group))
				{
					dictionary[item.Substring(0, num).Trim()] = group;
				}
			}
			return dictionary;
		}

		private ConfigEntry<KeyboardShortcut> Key(string key, string oldKey, string ptName, KeyCode code, string en, string pt)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return Opt<KeyboardShortcut>(11, key, oldKey, ptName, new KeyboardShortcut(code, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), server: false, en, pt);
		}

		private void MigrateOldNames()
		{
			try
			{
				if (!(typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(_file, null) is Dictionary<ConfigDefinition, string> { Count: not 0 } dictionary))
				{
					return;
				}
				bool flag = false;
				foreach (KeyValuePair<ConfigEntryBase, ConfigDefinition[]> item in _legacy)
				{
					ConfigDefinition[] value = item.Value;
					foreach (ConfigDefinition key in value)
					{
						if (dictionary.TryGetValue(key, out var value2))
						{
							item.Key.SetSerializedValue(value2);
							dictionary.Remove(key);
							flag = true;
						}
					}
				}
				if (dictionary.Count > 0)
				{
					Logger.LogInfo((object)$"Configuração: {dictionary.Count} opções que não existem mais foram tiradas do arquivo.");
					dictionary.Clear();
					flag = true;
				}
				if (flag)
				{
					_file.Save();
					Logger.LogInfo((object)"Configuração: opções renomeadas para os nomes em inglês; valores antigos mantidos.");
				}
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Configuração: não foi possível copiar os valores dos nomes antigos. " + ex.Message));
			}
		}
	}
	[BepInPlugin("thercio.runasdeyggdrasil", "Runas de Yggdrasil", "0.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		public const string ModGuid = "thercio.runasdeyggdrasil";

		public const string ModName = "Runas de Yggdrasil";

		public const string ModVersion = "0.1.1";

		private const string EpicLootGuid = "randyknapp.mods.epicloot";

		internal static ModConfig Settings { get; private set; }

		private void Awake()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			Settings = new ModConfig(((BaseUnityPlugin)this).Config);
			Texts.Register();
			ModItems.Register();
			Belts.Register();
			Bags.Register();
			Rings.Register();
			Enhancements.Register();
			RuneYaml.LoadLocal();
			RunewordYaml.LoadLocal();
			((Component)this).gameObject.AddComponent<RunewordTicker>();
			RuneItems.Register();
			RuneSync.Register();
			BlindEffect.Register();
			SE_RdYSlow.Register();
			SE_RdYHold.Register();
			SE_RdYWound.Register();
			EitrOrb.Register();
			Summons.Register();
			AltarPiece.Register();
			AltarExtensions.Register();
			SealedVault.Register();
			VanillaMaterials.Register();
			CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new BagPointsCommand());
			new Harmony("thercio.runasdeyggdrasil").PatchAll(typeof(Plugin).Assembly);
			if (Chainloader.PluginInfos.ContainsKey("randyknapp.mods.epicloot"))
			{
				Logger.LogWarning((object)"Epic Loot detectado. O Runas de Yggdrasil não é compatível com ele: os dois alteram os dados e a descrição dos itens.");
			}
			Logger.LogInfo((object)"Runas de Yggdrasil 0.1.1 carregado.");
		}
	}
	internal class RunasCommand : ConsoleCommand
	{
		public override string Name => "runas";

		public override string Help => "Mostra a versão do Runas de Yggdrasil e a configuração em uso.";

		public override void Run(string[] args)
		{
			ModConfig settings = Plugin.Settings;
			string text = (settings.RecebidaDoServidor ? "servidor" : "local");
			string text2 = (SynchronizationManager.Instance.PlayerIsAdmin ? "sim" : "não");
			Console.instance.Print("Runas de Yggdrasil 0.1.1 | configuração: " + text + " | admin: " + text2);
			Console.instance.Print($"Forças: Menor +{settings.ValorMenor.Value}% | Comum +{settings.ValorComum.Value}% | Superior +{settings.ValorSuperior.Value}%");
			Console.instance.Print($"Repetição: {settings.RunasComValorCheio.Value} com valor cheio, depois ×{settings.FatorDeReducao.Value} a cada runa");
			Console.instance.Print(string.Format("Teto global: {0} ({1} Superiores por runa{2})", settings.TetoGlobalAtivado.Value ? "ligado" : "desligado", settings.TetoEmSuperiores.Value, string.IsNullOrWhiteSpace(settings.TetosPorRuna.Value) ? "" : (", próprios: " + settings.TetosPorRuna.Value)));
		}
	}
}
namespace RunasDeYggdrasil.UI
{
	internal static class BuildMenuRestyle
	{
		[HarmonyPatch(typeof(BuildUi), "OpenBuildMenu")]
		private static class OpenPatch
		{
			private static void Postfix(BuildUi __instance)
			{
				Apply(__instance);
			}
		}

		[HarmonyPatch(typeof(BuildUi), "SelectPieceList")]
		private static class TabPatch
		{
			private static void Postfix(BuildUi __instance)
			{
				Apply(__instance);
			}
		}

		private sealed class FontMark : MonoBehaviour
		{
		}

		private static bool _styled;

		private static readonly Color Gold = new Color(0.85f, 0.66f, 0.36f);

		private static void Apply(BuildUi ui)
		{
			try
			{
				if (!_styled)
				{
					_styled = true;
					RestyleBackground(ui);
					RestyleTabs(ui);
					RestyleScrollbars(ui);
					RestyleSearch(ui);
				}
				Fonts(ui);
				RestyleButtons(ui);
			}
			catch (Exception ex)
			{
				Logger.LogWarning((object)("Menu de construção: " + ex.Message));
			}
		}

		private static void RestyleBackground(BuildUi ui)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			_ = (RectTransform)((Component)ui).transform;
			Image val = null;
			float num = 0f;
			Image[] componentsInChildren = ((Component)ui).GetComponentsInChildren<Image>(true);
			foreach (Image val2 in componentsInChildren)
			{
				if (!((Object)(object)val2.sprite == (Object)null) && ((Object)val2.sprite).name.ToLowerInvariant().Contains("woodpanel"))
				{
					Rect rect = ((Graphic)val2).rectTransform.rect;
					float width = ((Rect)(ref rect)).width;
					rect = ((Graphic)val2).rectTransform.rect;
					float num2 = Mathf.Abs(width * ((Rect)(ref rect)).height);
					if (num2 > num)
					{
						val = val2;
						num = num2;
					}
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				val.sprite = EquipmentPanel.RoundedSprite();
				val.type = (Type)1;
				((Graphic)val).color = ItemTooltip.Background;
				((Graphic)val).material = null;
				ItemTooltip.AddCorners(((Graphic)val).rectTransform);
				Logger.LogInfo((object)("Menu de construção: fundo '" + ((Object)val).name + "' trocado."));
			}
		}

		private static void Fonts(BuildUi ui)
		{
			TMP_Text[] componentsInChildren = ((Component)ui).GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val in componentsInChildren)
			{
				if ((Object)(object)((Component)val).GetComponent<FontMark>() != (Object)null)
				{
					continue;
				}
				((Component)val).gameObject.AddComponent<FontMark>();
				if (!((Object)(object)((Component)val).GetComponentInParent<CraftTabs>() != (Object)null))
				{
					if ((Object)(object)ui.m_tabContainer != (Object)null && val.transform.IsChildOf((Transform)(object)ui.m_tabContainer))
					{
						InventoryRestyle.TitleFont(val);
					}
					else
					{
						val.font = ModFonts.Get("Roboto.ttf", val.font);
					}
				}
			}
		}

		private static void RestyleTabs(BuildUi ui)
		{
			if ((Object)(object)ui.m_tabContainer == (Object)null)
			{
				return;
			}
			Button[] componentsInChildren = ((Component)ui.m_tabContainer).GetComponentsInChildren<Button>(true);
			foreach (Button val in componentsInChildren)
			{
				if ((Object)(object)((Component)val).GetComponent<Image>() != (Object)null && (Object)(object)((Component)val).GetComponent<Image>().sprite != (Object)null && ((Object)((Component)val).GetComponent<Image>().sprite).name == "button_tab")
				{
					CraftTabs.Style(val);
				}
			}
			Image[] componentsInChildren2 = ((Component)ui).GetComponentsInChildren<Image>(true);
			foreach (Image val2 in componentsInChildren2)
			{
				if (((Object)val2).name == "TabBorder")
				{
					CraftTabs.ReplaceBorder(val2);
				}
			}
		}

		private static void RestyleSearch(BuildUi ui)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00b3: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			TMP_InputField componentInChildren = ((Component)ui).GetComponentInChildren<TMP_InputField>(true);
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				Image component = ((Component)componentInChildren).GetComponent<Image>();
				if (!((Object)(object)component == (Object)null))
				{
					component.sprite = EquipmentPanel.RoundedSprite();
					component.type = (Type)1;
					component.pixelsPerUnitMultiplier = 2.5f;
					((Graphic)component).color = new Color(0.086f, 0.086f, 0.106f, 1f);
					((Graphic)component).material = null;
					GameObject val = new GameObject("RdY_Linha", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					RectTransform val2 = (RectTransform)val.transform;
					((Transform)val2).SetParent((Transform)(object)((Graphic)component).rectTransform, false);
					val2.anchorMin = new Vector2(0f, 0f);
					val2.anchorMax = new Vector2(1f, 0f);
					val2.offsetMin = new Vector2(6f, 0f);
					val2.offsetMax = new Vector2(-6f, 2f);
					Image component2 = val.GetComponent<Image>();
					((Graphic)component2).color = Gold;
					((Graphic)component2).raycastTarget = false;
				}
			}
		}

		private static void RestyleScrollbars(BuildUi ui)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			Scrollbar[] componentsInChildren = ((Component)ui).GetComponentsInChildren<Scrollbar>(true);
			foreach (Scrollbar val in componentsInChildren)
			{
				Image component = ((Component)val).GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					((Graphic)component).color = new Color(0f, 0f, 0f, 0.35f);
				}
				if ((Object)(object)val.handleRect != (Object)null)
				{
					Image component2 = ((Component)val.handleRect).GetComponent<Image>();
					if (component2 != null)
					{
						component2.sprite = EquipmentPanel.RoundedSprite();
						component2.type = (Type)1;
						component2.pixelsPerUnitMultiplier = 4f;
						((Graphic)component2).color = new Color(Gold.r, Gold.g, Gold.b, 0.55f);
					}
				}
				ColorBlock colors = ((Selectable)val).colors;
				((ColorBlock)(ref colors)).normalColor = Color.white;
				((ColorBlock)(ref colors)).highlightedColor = new Color(1.2f, 1.2f, 1.2f, 1f);
				((Selectable)val).colors = colors;
			}
		}

		private static void RestyleButtons(BuildUi ui)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			BuildUiPieceButton[] componentsInChildren = ((Component)ui).GetComponentsInChildren<BuildUiPieceButton>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				EquipmentPanel.AddSlotBorder((RectTransform)((Component)componentsInChildren[i]).transform);
			}
			BuildUiTagButton[] componentsInChildren2 = ((Component)ui).GetComponentsInChildren<BuildUiTagButton>(true);
			foreach (BuildUiTagButton val in componentsInChildren2)
			{
				Image val2 = (((Object)(object)val.m_toggledOnObject != (Object)null) ? val.m_toggledOnObject.GetComponent<Image>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					((Graphic)val2).color = new Color(0.32f, 0.24f, 0.11f, 1f);
				}
			}
		}
	}
	internal static class CraftingDescription
	{
		[HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")]
		private static class UpdatePatch
		{
			private static void Postfix(InventoryGui __instance)
			{
				try
				{
					Update(__instance);
				}
				catch (Exception arg)
				{
					Logger.LogWarning((object)$"Descrição da fabricação: {arg}");
					if ((Object)(object)_viewport != (Object)null)
					{
						((Component)_viewport).gameObject.SetActive(false);
					}
					TMP_Text recipeName = __instance.m_recipeName;
					TMP_Text recipeDecription = __instance.m_recipeDecription;
					bool flag = (((Behaviour)__instance.m_recipeIcon).enabled = true);
					bool enabled = (((Behaviour)recipeDecription).enabled = flag);
					((Behaviour)recipeName).enabled = enabled;
				}
			}
		}

		private static RectTransform _viewport;

		private static RectTransform _content;

		private static RectTransform _footer;

		private const float FooterHeight = 16f;

		private const float FooterGap = 8f;

		private static object _shownRecipe;

		private static object _shownItem;

		private static int _shownQuality = -1;

		private static int _shownAmount = -1;

		private static int _shownVariant = -1;

		private static bool _shownCurrent;

		private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4];

		private static bool Enabled => Plugin.Settings?.TooltipPropria?.Value ?? true;

		private static void Update(InventoryGui gui)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			RecipeDataPair selectedRecipe = gui.m_selectedRecipe;
			if (!Enabled || (Object)(object)((RecipeDataPair)(ref selectedRecipe)).Recipe == (Object)null)
			{
				if ((Object)(object)_viewport != (Object)null)
				{
					((Component)_viewport).gameObject.SetActive(false);
				}
				if ((Object)(object)_footer != (Object)null)
				{
					((Component)_footer).gameObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)_viewport == (Object)null)
			{
				Create(gui);
			}
			((Component)_viewport).gameObject.SetActive(true);
			((Component)_footer).gameObject.SetActive(true);
			((Behaviour)gui.m_recipeName).enabled = false;
			((Behaviour)gui.m_recipeDecription).enabled = false;
			((Behaviour)gui.m_recipeIcon).enabled = false;
			FitBottom(gui);
			Recipe recipe = ((RecipeDataPair)(ref selectedRecipe)).Recipe;
			ItemData itemData = ((RecipeDataPair)(ref selectedRecipe)).ItemData;
			int num = ((itemData == null) ? 1 : (itemData.m_quality + 1));
			bool flag = itemData == null && (ZInput.GetButton("AltPlace") || ZInput.GetButton("JoyLStick") || gui.m_touchMultiCrafting);
			int num2 = recipe.m_amount * ((!flag) ? 1 : gui.m_multiCraftAmount);
			int num3 = itemData?.m_variant ?? gui.m_selectedVariant;
			bool flag2 = itemData != null && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303));
			if (recipe == _shownRecipe && itemData == _shownItem && num == _shownQuality && num2 == _shownAmount && num3 == _shownVariant && flag2 == _shownCurrent)
			{
				return;
			}
			_shownCurrent = flag2;
			_shownRecipe = recipe;
			_shownItem = itemData;
			_shownQuality = num;
			_shownAmount = num2;
			_shownVariant = num3;
			ItemData val = ((itemData != null) ? itemData.Clone() : recipe.m_item.m_itemData.Clone());
			val.m_quality = Mathf.Min(num, Mathf.Max(1, val.m_shared.m_maxQuality));
			val.m_variant = num3;
			ItemData compare = null;
			string hint = null;
			if (itemData != null)
			{
				val.m_durability = val.GetMaxDurability();
				if (flag2)
				{
					val = itemData.Clone();
					hint = Texts.T("runas_tt_upgrade_release");
				}
				else
				{
					compare = itemData;
					hint = Texts.T("runas_tt_upgrade_hold");
				}
			}
			if (itemData == null)
			{
				val.m_dropPrefab = ((Component)recipe.m_item).gameObject;
				val.m_worldLevel = Game.m_worldLevel;
				val.m_stack = num2;
				val.m_durability = val.GetMaxDurability();
			}
			string titleSuffix = ((num2 > 1) ? $" ×{num2}" : null);
			string note = (recipe.m_requireOnlyOneIngredient ? Localization.instance.Localize("$inventory_onlyoneingredient") : null);
			ItemTooltip.ShowIn(_content, val, titleSuffix, note, gui.m_recipeDecription.font, compare, hint);
			_content.anchoredPosition = Vector2.zero;
		}

		private static void Create(InventoryGui gui)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0090: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Expected O, but got Unknown
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Expected O, but got Unknown
			RectTransform val = (RectTransform)gui.m_recipeDecription.transform.parent;
			GameObject val2 = new GameObject("RdY_Descricao", new Type[4]
			{
				typeof(RectTransform),
				typeof(RectMask2D),
				typeof(Image),
				typeof(ScrollRect)
			});
			_viewport = (RectTransform)val2.transform;
			((Transform)_viewport).SetParent((Transform)(object)val, false);
			((Transform)_viewport).SetAsFirstSibling();
			_viewport.anchorMin = new Vector2(0f, 0f);
			_viewport.anchorMax = new Vector2(1f, 1f);
			_viewport.pivot = new Vector2(0.5f, 1f);
			_viewport.offsetMin = new Vector2(4f, 0f);
			_viewport.offsetMax = new Vector2(-4f, -4f);
			((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
			GameObject val3 = new GameObject("Conteudo", new Type[3]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			_content = (RectTransform)val3.transform;
			((Transform)_content).SetParent((Transform)(object)_viewport, false);
			RectTransform content = _content;
			RectTransform content2 = _content;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(0.5f, 1f);
			content2.anchorMax = val4;
			content.anchorMin = val4;
			_content.pivot = new Vector2(0.5f, 1f);
			float num = Mathf.Clamp(Plugin.Settings?.EscalaTooltip?.Value ?? 0.8f, 0.5f, 1.5f);
			((Transform)_content).localScale = Vector3.one * num;
			RectTransform content3 = _content;
			Rect rect = val.rect;
			content3.sizeDelta = new Vector2((((Rect)(ref rect)).width - 8f) / num, 0f);
			VerticalLayoutGroup component = val3.GetComponent<VerticalLayoutGroup>();
			((LayoutGroup)component).padding = new RectOffset(18, 18, 10, 14);
			((HorizontalOrVerticalLayoutGroup)component).spacing = 6f;
			((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			val3.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			GameObject val5 = new GameObject("RdY_Rodape", new Type[2]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup)
			});
			_footer = (RectTransform)val5.transform;
			((Transform)_footer).SetParent((Transform)(object)val, false);
			RectTransform footer = _footer;
			RectTransform footer2 = _footer;
			((Vector2)(ref val4))..ctor(0.5f, 0f);
			footer2.anchorMax = val4;
			footer.anchorMin = val4;
			_footer.pivot = new Vector2(0.5f, 0f);
			((Transform)_footer).localScale = Vector3.one * num;
			RectTransform footer3 = _footer;
			rect = val.rect;
			footer3.sizeDelta = new Vector2((((Rect)(ref rect)).width - 8f) / num, 16f);
			VerticalLayoutGroup component2 = val5.GetComponent<VerticalLayoutGroup>();
			((LayoutGroup)component2).padding = new RectOffset(18, 18, 0, 0);
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = childControlWidth;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false;
			ItemTooltip.Footer(_footer);
			ScrollRect component3 = val2.GetComponent<ScrollRect>();
			component3.content = _content;
			component3.viewport = _viewport;
			component3.horizontal = false;
			component3.vertical = true;
			component3.movementType = (MovementType)2;
			component3.scrollSensitivity = 30f;
			component3.inertia = false;
			SmoothScroll.Attach(component3);
		}

		private static void FitBottom(InventoryGui gui)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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)
			RectTransform val = (RectTransform)((Transform)_viewport).parent;
			Rect rect = val.rect;
			float bottom = ((Rect)(ref rect)).yMin;
			if (gui.m_recipeRequirementList != null && gui.m_recipeRequirementList.Length != 0 && (Object)(object)gui.m_recipeRequirementList[0] != (Object)null)
			{
				Transform parent = gui.m_recipeRequirementList[0].transform.parent;
				Consider(val, (RectTransform)(object)((parent is RectTransform) ? parent : null), ref bottom);
			}
			Consider(val, ((Object)(object)gui.m_itemCraftType != (Object)null) ? gui.m_itemCraftType.rectTransform : null, ref bottom);
			Consider(val, (RectTransform)(((Object)(object)gui.m_upgradeItemName != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null), ref bottom);
			float num = bottom;
			rect = val.rect;
			float num2 = num - ((Rect)(ref rect)).yMin + 8f;
			_footer.anchoredPosition = new Vector2(0f, num2);
			float num3 = num2 + 16f * ((Transform)_footer).localScale.y + 8f;
			if (Mathf.Abs(_viewport.offsetMin.y - num3) > 0.5f)
			{
				_viewport.offsetMin = new Vector2(4f, num3);
			}
		}

		private static void Consider(RectTransform host, RectTransform rt, ref float bottom)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)rt == (Object)null) && ((Component)rt).gameObject.activeInHierarchy)
			{
				rt.GetWorldCorners(Corners);
				float y = ((Transform)host).InverseTransformPoint(Corners[1]).y;
				if (y > bottom)
				{
					bottom = y;
				}
			}
		}
	}
	internal static class CraftingList
	{
		internal enum Category
		{
			All,
			Tools,
			Weapons,
			Armor,
			Accessories,
			Consumables,
			Materials,
			Health,
			Stamina,
			Eitr,
			Balanced
		}

		[HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")]
		private static class ListPatch
		{
			private static void Prefix(List<Recipe> recipes)
			{
				CategoriesInList.Clear();
				BiomesInList.Clear();
				foreach (Category item in from c in recipes.Select(CategoryOf).Distinct()
					orderby (int)c
					select c)
				{
					CategoriesInList.Add(item);
				}
				Category selected = Selected;
				if (selected != Category.All && !CategoriesInList.Contains(selected))
				{
					Selected = (selected = Category.All);
				}
				if (selected != Category.All)
				{
					recipes.RemoveAll((Recipe r) => CategoryOf(r) != selected);
				}
				foreach (int item2 in from b in recipes.Select(ItemBiome.Of).Distinct()
					orderby b
					select b)
				{
					BiomesInList.Add(item2);
				}
				recipes.RemoveAll((Recipe r) => Collapsed.Contains(ItemBiome.Of(r)));
			}

			private static void Postfix(InventoryGui __instance)
			{
				try
				{
					Layout(__instance);
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("Lista de fabricação: " + ex.Message));
				}
			}
		}

		private sealed class Header
		{
			public RectTransform Root;

			public RectTransform Arrow;

			public TMP_Text Name;

			public RectTransform Line;

			public int Biome;

			public void Set(int biome, bool open)
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				Biome = biome;
				((Component)Root).gameObject.SetActive(true);
				Name.text = Texts.T("runas_biome_" + biome);
				((Transform)Arrow).localEulerAngles = new Vector3(0f, 0f, open ? 0f : 90f);
			}
		}

		private sealed class HeaderLine : MonoBehaviour
		{
			public TMP_Text Name;

			public RectTransform Line;

			private void LateUpdate()
			{
				//IL_003b: 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_005f: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)Name == (Object)null) && !((Object)(object)Line == (Object)null))
				{
					float num = 28f + Name.preferredWidth + 8f;
					if (Mathf.Abs(Line.offsetMin.x - num) > 0.5f)
					{
						Line.offsetMin = new Vector2(num, -1f);
					}
					Line.offsetMax = new Vector2(-10f, 1f);
				}
			}
		}

		private sealed class CategoryFollower : MonoBehaviour
		{
			public InventoryGui Gui;

			public CanvasGroup Group;

			public bool Wanted;

			private void LateUpdate()
			{
				if (!((Object)(object)Gui == (Object)null))
				{
					bool flag = Wanted && (Object)(object)Gui.m_crafting != (Object)null && ((Component)Gui.m_crafting).gameObject.activeInHierarchy;
					Group.alpha = (flag ? 1f : 0f);
					CanvasGroup obj = Group;
					bool blocksRaycasts = (Group.interactable = flag);
					obj.blocksRaycasts = blocksRaycasts;
					if (flag)
					{
						PlaceCategoryRoot(Gui);
					}
				}
			}
		}

		private static readonly Color Gold = new Color(0.85f, 0.66f, 0.36f);

		private static readonly Color Inactive = new Color(0.8f, 0.8f, 0.8f);

		private static readonly Dictionary<string, Category> SelectedByStation = new Dictionary<string, Category>();

		private static readonly HashSet<int> Collapsed = new HashSet<int>();

		private static readonly List<int> BiomesInList = new List<int>();

		private static readonly List<Category> CategoriesInList = new List<Category>();

		private static RectTransform _categoryRoot;

		private static readonly List<Header> Headers = new List<Header>();

		private const float NameX = 28f;

		private static Sprite _triangle;

		private static readonly List<InventoryButtons.SquareButton> Squares = new List<InventoryButtons.SquareButton>();

		private static readonly List<Category> Shown = new List<Category>();

		private static CategoryFollower _follower;

		private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4];

		private static Category Selected
		{
			get
			{
				if (!SelectedByStation.TryGetValue(StationKey(), out var value))
				{
					return Category.All;
				}
				return value;
			}
			set
			{
				SelectedByStation[StationKey()] = value;
			}
		}

		internal static Category CategoryOf(Recipe recipe)
		{
			//IL_008e: 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_0095: 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_00fa: Expected I4, but got Unknown
			SharedData val = recipe?.m_item?.m_itemData?.m_shared;
			if (val == null)
			{
				return Category.Materials;
			}
			float food = val.m_food;
			float foodStamina = val.m_foodStamina;
			float foodEitr = val.m_foodEitr;
			if (food > 0f || foodStamina > 0f || foodEitr > 0f)
			{
				if (foodEitr > 0f && foodEitr >= 0.5f * Mathf.Max(food, foodStamina))
				{
					return Category.Eitr;
				}
				if (food >= 1.5f * foodStamina)
				{
					return Category.Health;
				}
				if (foodStamina >= 1.5f * food)
				{
					return Category.Stamina;
				}
				return Category.Balanced;
			}
			ItemType itemType = val.m_itemType;
			switch (itemType - 2)
			{
			case 13:
			case 17:
				return Category.Tools;
			case 1:
			case 2:
			case 7:
			case 12:
			case 20:
			case 21:
				return Category.Weapons;
			case 3:
			case 4:
			case 5:
			case 9:
			case 15:
				return Category.Armor;
			case 16:
			case 22:
				return Category.Accessories;
			case 0:
				return Category.Consumables;
			default:
				return Category.Materials;
			}
		}

		private static string StationKey()
		{
			Player localPlayer = Player.m_localPlayer;
			CraftingStation val = ((localPlayer != null) ? localPlayer.GetCurrentCraftingStation() : null);
			if (!((Object)(object)val != (Object)null))
			{
				return "";
			}
			return val.m_name;
		}

		private static void Layout(InventoryGui gui)
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			List<RecipeDataPair> availableRecipes = gui.m_availableRecipes;
			List<RecipeDataPair> collection = (from x in availableRecipes.Select((RecipeDataPair pair, int i) => (pair: pair, i: i))
				orderby ItemBiome.Of(((RecipeDataPair)(ref x.pair)).Recipe), x.i
				select x.pair).ToList();
			availableRecipes.Clear();
			availableRecipes.AddRange(collection);
			float recipeListSpace = gui.m_recipeListSpace;
			float num = 0f;
			int num2 = 0;
			foreach (int biomesIn in BiomesInList)
			{
				Header header = GetHeader(gui, num2++);
				header.Set(biomesIn, !Collapsed.Contains(biomesIn));
				header.Root.anchoredPosition = new Vector2(0f, 0f - num);
				num += recipeListSpace;
				if (Collapsed.Contains(biomesIn))
				{
					continue;
				}
				foreach (RecipeDataPair item in availableRecipes)
				{
					RecipeDataPair current2 = item;
					if (ItemBiome.Of(((RecipeDataPair)(ref current2)).Recipe) == biomesIn)
					{
						((RectTransform)((RecipeDataPair)(ref current2)).InterfaceElement.transform).anchoredPosition = new Vector2(0f, 0f - num);
						num += recipeListSpace;
					}
				}
			}
			for (int num3 = num2; num3 < Headers.Count; num3++)
			{
				((Component)Headers[num3].Root).gameObject.SetActive(false);
			}
			gui.m_recipeListRoot.SetSizeWithCurrentAnchors((Axis)1, Mathf.Max(gui.m_recipeListBaseSize, num));
			UpdateCategories(gui);
		}

		private static void Refresh()
		{
			InventoryGui instance = InventoryGui.instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.UpdateCraftingPanel(false);
			}
		}

		private static Header GetHeader(InventoryGui gui, int index)
		{
			while (Headers.Count <= index)
			{
				Headers.Add(CreateHeader(gui));
			}
			if ((Object)(object)Headers[index].Root == (Object)null)
			{
				Headers[index] = CreateHeader(gui);
			}
			return Headers[index];
		}

		private static Header CreateHeader(InventoryGui gui)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)gui.m_recipeElementPrefab.transform;
			GameObject val2 = new GameObject("RdY_Bioma", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			RectTransform val3 = (RectTransform)val2.transform;
			((Transform)val3).SetParent((Transform)(object)gui.m_recipeListRoot, false);
			val3.anchorMin = val.anchorMin;
			val3.anchorMax = val.anchorMax;
			val3.pivot = val.pivot;
			val3.sizeDelta = val.sizeDelta;
			((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
			Header header = new Header
			{
				Root = val3
			};
			((Selectable)val2.GetComponent<Button>()).transition = (Transition)0;
			((UnityEvent)val2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				if (!Collapsed.Remove(header.Biome))
				{
					Collapsed.Add(header.Biome);
				}
				Refresh();
			});
			GameObject val4 = new GameObject("Seta", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			header.Arrow = (RectTransform)val4.transform;
			((Transform)header.Arrow).SetParent((Transform)(object)val3, false);
			RectTransform arrow = header.Arrow;
			RectTransform arrow2 = header.Arrow;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 0.5f);
			arrow2.anchorMax = val5;
			arrow.anchorMin = val5;
			header.Arrow.pivot = new Vector2(0.5f, 0.5f);
			header.Arrow.sizeDelta = new Vector2(12f, 12f);
			header.Arrow.anchoredPosition = new Vector2(14f, 0f);
			Image component = val4.GetComponent<Image>();
			component.sprite = TriangleSprite();
			((Graphic)component).color = Gold;
			((Graphic)component).raycastTarget = false;
			header.Name = EquipmentPanel.NewText(val3, "", 18f, Color.white, (TextAlignmentOptions)4097, "Alegreya.ttf");
			RectTransform rectTransform = header.Name.rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.offsetMin = new Vector2(28f, 0f);
			rectTransform.offsetMax = Vector2.zero;
			header.Name.textWrappingMode = (TextWrappingModes)0;
			GameObject val6 = new GameObject("Linha", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			header.Line = (RectTransform)val6.transform;
			((Transform)header.Line).SetParent((Transform)(object)val3, false);
			header.Line.anchorMin = new Vector2(0f, 0.5f);
			header.Line.anchorMax = new Vector2(1f, 0.5f);
			Image component2 = val6.GetComponent<Image>();
			((Graphic)component2).color = Gold;
			((Graphic)component2).raycastTarget = false;
			header.Line.offsetMin = new Vector2(10000f, -1f);
			header.Line.offsetMax = new Vector2(-10f, 1f);
			HeaderLine headerLine = val2.AddComponent<HeaderLine>();
			headerLine.Name = header.Name;
			headerLine.Line = header.Line;
			return header;
		}

		internal static Sprite TriangleSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_00fa: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_triangle != (Object)null)
			{
				return _triangle;
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = ((float)i + 0.5f) / 32f;
					float num2 = num * 0.5f;
					float num3 = Mathf.Abs(((float)j + 0.5f) / 32f - 0.5f);
					float num4 = Mathf.Clamp01((num2 - num3) * 32f + 0.5f) * ((num < 0.92f) ? 1f : Mathf.Clamp01((1f - num) * 32f * 0.5f + 0.5f));
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num4));
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			_triangle = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f);
			return _triangle;
		}

		private static Sprite IconOf(Category category)
		{
			return (Sprite)(category switch
			{
				Category.Tools => IconPainter.Hammer(), 
				Category.Weapons => IconPainter.Sword(), 
				Category.Armor => IconPainter.Shield(), 
				Category.Accessories => IconPainter.Ring(), 
				Category.Consumables => IconPainter.Flask(), 
				Category.Materials => IconPainter.Ingots(), 
				Category.Health => IconPainter.Heart(), 
				Category.Stamina => IconPainter.Bolt(), 
				Category.Eitr => IconPainter.Drop(), 
				Category.Balanced => IconPainter.Scales(), 
				_ => IconPainter.All(), 
			});
		}

		private static string NameOf(Category category)
		{
			return Texts.T("runas_cat_" + category.ToString().ToLowerInvariant());
		}

		private static void UpdateCategories(InventoryGui gui)
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_categoryRoot == (Object)null)
			{
				CreateCategoryRoot(gui);
			}
			if ((Object)(object)_categoryRoot == (Object)null)
			{
				return;
			}
			Shown.Clear();
			Shown.Add(Category.All);
			Shown.AddRange(CategoriesInList.Where((Category c) => c != Category.All));
			_follower.Wanted = Shown.Count > 2;
			if (!_follower.Wanted)
			{
				return;
			}
			while (Squares.Count < Shown.Count)
			{
				int index = Squares.Count;
				InventoryButtons.SquareButton squareButton = InventoryButtons.CreateButton((Transform)(object)_categoryRoot, IconOf(Category.All), () => (index >= Shown.Count) ? "" : NameOf(Shown[index]), delegate
				{
					if (index < Shown.Count)
					{
						Selected = Shown[index];
						Refresh();
					}
				}, () => index < Shown.Count && Shown[index] == Selected);
				squareButton.TipLeft = true;
				Squares.Add(squareButton);
			}
			float num = InventoryButtons.ButtonSize + InventoryButtons.Spacing;
			for (int num2 = 0; num2 < Squares.Count; num2++)
			{
				InventoryButtons.SquareButton squareButton2 = Squares[num2];
				bool flag = num2 < Shown.Count;
				((Component)squareButton2.Rect).gameObject.SetActive(flag);
				if (flag)
				{
					squareButton2.Icon.sprite = IconOf(Shown[num2]);
					squareButton2.Rect.anchoredPosition = new Vector2(0f, (float)(-num2) * num);
				}
			}
		}

		private static void CreateCategoryRoot(InventoryGui gui)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00a5: 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_00c0: 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)
			if (!((Object)(object)gui.m_repairButton == (Object)null) && !((Object)(object)((Transform)gui.m_crafting).parent == (Object)null))
			{
				GameObject val = new GameObject("RdY_Categorias", new Type[2]
				{
					typeof(RectTransform),
					typeof(CanvasGroup)
				});
				_categoryRoot = (RectTransform)val.transform;
				((Transform)_categoryRoot).SetParent(((Transform)gui.m_crafting).parent, false);
				((Transform)_categoryRoot).SetSiblingIndex(((Transform)gui.m_crafting).GetSiblingIndex() + 1);
				RectTransform categoryRoot = _categoryRoot;
				RectTransform categoryRoot2 = _categoryRoot;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(0.5f, 0.5f);
				categoryRoot2.anchorMax = val2;
				categoryRoot.anchorMin = val2;
				_categoryRoot.pivot = new Vector2(0f, 1f);
				_categoryRoot.sizeDelta = new Vector2(InventoryButtons.ButtonSize, 0f);
				_follower = val.AddComponent<CategoryFollower>();
				_follower.Gui = gui;
				_follower.Group = val.GetComponent<CanvasGroup>();
				Squares.Clear();
			}
		}

		private static void PlaceCategoryRoot(InventoryGui gui)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_0091: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)((Transform)_categoryRoot).parent;
			((RectTransform)((Component)gui.m_repairButton).transform).GetWorldCorners(Corners);
			Vector3 val2 = ((Transform)val).InverseTransformPoint(Corners[0]);
			Vector3 val3 = ((Transform)val).InverseTransformPoint(Corners[3]);
			float num = (val2.x + val3.x) * 0.5f - InventoryButtons.ButtonSize * 0.5f + 2f;
			RectTransform categoryRoot = _categoryRoot;
			Vector2 val4 = new Vector2(num, val2.y - 10f);
			Rect rect = val.rect;
			categoryRoot.anchoredPosition = val4 - ((Rect)(ref rect)).center;
		}
	}
	internal sealed class CraftTabs : MonoBehaviour
	{
		private static readonly Color Gold = new Color(0.85f, 0.66f, 0.36f);

		private static Sprite _sprite;

		private Button _button;

		private TMP_Text _text;

		private static Sprite _faded;

		public static void Style(Button tab)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tab == (Object)null) && !((Object)(object)((Component)tab).GetComponent<CraftTabs>() != (Object)null))
			{
				Image component = ((Component)tab).GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = TabSprite();
					component.type = (Type)1;
					component.pixelsPerUnitMultiplier = 2f;
					((Graphic)component).color = Color.white;
					((Graphic)component).material = null;
				}
				((Selectable)tab).transition = (Transition)0;
				Transform val = ((Component)tab).transform.Find("Selected");
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
				CraftTabs craftTabs = ((Component)tab).gameObject.AddComponent<CraftTabs>();
				craftTabs._button = tab;
				craftTabs._text = ((Component)tab).GetComponentInChildren<TMP_Text>(true);
				if ((Object)(object)craftTabs._text != (Object)null)
				{
					InventoryRestyle.TitleFont(craftTabs._text);
					TMP_Text text = craftTabs._text;
					text.fontStyle = (FontStyles)(text.fontStyle | 0x10);
				}
			}
		}

		public static void ReplaceBorder(Image border)
		{
			//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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)border == (Object)null) && !((Object)(object)((Component)border).transform.Find("RdY_Linha") != (Object)null))
			{
				((Behaviour)border).enabled = false;
				GameObject val = new GameObject("RdY_Linha", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				RectTransform val2 = (RectTransform)val.transform;
				((Transform)val2).SetParent((Transform)(object)((Graphic)border).rectTransform, false);
				val2.anchorMin = new Vector2(0f, 0.5f);
				val2.anchorMax = new Vector2(1f, 0.5f);
				val2.offsetMin = new Vector2(-4f, -2f);
				val2.offsetMax = new Vector2(4f, 0f);
				Image component = val.GetComponent<Image>();
				component.sprite = FadedLine();
				component.type = (Type)1;
				((Graphic)component).color = Gold;
				((Graphic)component).raycastTarget = false;
			}
		}

		private static Sprite FadedLine()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_00a9: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_faded != (Object)null)
			{
				return _faded;
			}
			Texture2D val = new Texture2D(32, 4, (TextureFormat)4, false);
			for (int i = 0; i < 32; i++)
			{
				float num = ((i < 15) ? (((float)i + 0.5f) / 15f) : ((i >= 17) ? (((float)(32 - i) - 0.5f) / 15f) : 1f));
				for (int j = 0; j < 4; j++)
				{
					val.SetPixel(i, j, new Color(1f, 1f, 1f, num));
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			_faded = Sprite.Create(val, new Rect(0f, 0f, 32f, 4f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(15f, 0f, 15f, 0f));
			return _faded;
		}

		private void LateUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_text == (Object)null) && !((Object)(object)_button == (Object)null))
			{
				((Graphic)_text).color = (((Selectable)_button).interactable ? Color.white : Gold);
				Transform val = ((Component)this).transform.Find("Selected");
				if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
				{
					((Component)val).gameObject.SetActive(false);
				}
			}
		}

		private static Sprite TabSprite()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00f9: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			if ((Object)(object)_sprite != (Object)null)
			{
				return _sprite;
			}
			Color val = default(Color);
			((Color)(ref val))..ctor(0.086f, 0.086f, 0.106f, 1f);
			Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float px = (float)j + 0.5f;
					float py = (float)i + 0.5f;
					float num = TopRounded(px, py, 32, 10f, 0f);
					float num2 = TopRounded(px, py, 32, 10f, 4f, openBottom: true);
					float num3 = Mathf.Clamp01(num - num2);
					Color val3 = Color.Lerp(val, Gold, num3 / Mathf.Max(num, 0.0001f));
					val3.a = num;
					val2.SetPixel(j, i, val3);
				}
			}
			((Texture)val2).wrapMode = (TextureWrapMode)1;
			val2.Apply();
			_sprite = Sprite.Create(val2, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(11f, 2f, 11f, 11f));
			return _sprite;
		}

		private static float TopRounded(float px, float py, int size, float r, float inset, bool openBottom = false)
		{
			//IL_0055: 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)
			float num = (float)size - inset;
			float num2 = (openBottom ? (-1f) : 0f);
			if (px < inset || px > num || py < num2 || py > num)
			{
				return 0f;
			}
			float num3 = Mathf.Max(0.5f, r - inset);
			if (py > num - num3)
			{
				float num4 = Mathf.Clamp(px, inset + num3, num - num3);
				float num5 = Vector2.Distance(new Vector2(px, py), new Vector2(num4, num - num3));
				return Mathf.Clamp01(num3 - num5 + 0.5f);
			}
			return Mathf.Clamp01(Mathf.Min(px - inset, num - px) + 0.5f);
		}
	}
	internal static class HudRestyle
	{
		[HarmonyPatch(typeof(Hud), "Awake")]
		private static class AwakePatch
		{
			private static void Postfix(Hud __instance)
			{
				try
				{
					InventoryRestyle.TitleFont(__instance.m_buildSelection);
					Body(__instance.m_pieceDescription);
					Shrink(__instance.m_pieceDescription, 0.85f);
					GameObject[] requirementItems = __instance.m_requirementItems;
					foreach (GameObject val in requirementItems)
					{
						if ((Object)(object)val == (Object)null)
						{
							continue;
						}
						Transform obj = val.transform.Find("res_name");
						TMP_Text val2 = ((obj != null) ? ((Component)obj).GetComponent<TMP_Text>() : null);
						Body(val2);
						Transform obj2 = val.transform.Find("res_amount");
						Body((obj2 != null) ? ((Component)obj2).GetComponent<TMP_Text>() : null);
						if (!((Object)(object)val2 == (Object)null))
						{
							if (!val2.enableAutoSizing)
							{
								val2.fontSizeMin = Mathf.Min(8f, val2.fontSize);
								val2.enableAutoSizing = true;
							}
							val2.fontSizeMax = 10.5f;
						}
					}
				}
				catch (Exception ex)
				{
					Logger.LogWarning((object)("Fontes do painel de construção: " + ex.Message));
				}
			}
		}

		private const float NameSize = 10.5f;

		private static void Shrink(TMP_Text text, float factor)
		{
			if (!((Object)(object)text == (Object)null))
			{
				if (text.enableAutoSizing)
				{
					text.fontSizeMax *= factor;
				}
				else
				{
					text.fontSize *= factor;
				}
			}
		}

		private static void Body(TMP_Text text)
		{
			if (!((Object)(object)text == (Object)null))
			{
				text.font = ModFonts.Get("Roboto.ttf", text.font);
			}
		}
	}
	internal static class IconPainter
	{
		private const int Size = 64;

		private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>();

		private static Func<Vector2, float> Segment(float ax, float ay, float bx, float by, float r)
		{
			return delegate(Vector2 p)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(ax, ay);
				Vector2 val2 = new Vector2(bx, by) - val;
				float num = Mathf.Clamp01(Vector2.Dot(p - val, val2) / ((Vector2)(ref val2)).sqrMagnitude);
				return Vector2.Distance(p, val + val2 * num) - r;
			};
		}

		private static Func<Vector2, float> Box(float cx, float cy, float hx, float hy)
		{
			return delegate(Vector2 p)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: 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_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(Mathf.Abs(p.x - cx) - hx, Mathf.Abs(p.y - cy) - hy);
				Vector2 val2 = Vector2.Max(val, Vector2.zero);
				return ((Vector2)(ref val2)).magnitude + Mathf.Min(Mathf.Max(val.x, val.y), 0f);
			};
		}

		private static Func<Vector2, float> Ring(float cx, float cy, float r, float w)
		{
			return (Vector2 p) => Mathf.Abs(Vector2.Distance(p, new Vector2(cx, cy)) - r) - w;
		}

		private static Func<Vector2, float> Polygon(params float[] xy)
		{
			return delegate(Vector2 p)
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: 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_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: 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_00ec: 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)
				int num = xy.Length / 2;
				float num2 = float.MaxValue;
				bool flag = false;
				int num3 = 0;
				int num4 = num - 1;
				Vector2 val = default(Vector2);
				Vector2 val2 = default(Vector2);
				while (num3 < num)
				{
					((Vector2)(ref val))..ctor(xy[2 * num3], xy[2 * num3 + 1]);
					((Vector2)(ref val2))..ctor(xy[2 * num4], xy[2 * num4 + 1]);
					Vector2 val3 = val2 - val;
					float num5 = Mathf.Clamp01(Vector2.Dot(p - val, val3) / ((Vector2)(ref val3)).sqrMagnitude);
					num2 = Mathf.Min(num2, Vector2.Distance(p, val + val3 * num5));
					if (val.y > p.y != val2.y > p.y && p.x < (val2.x - val.x) * (p.y - val.y) / (val2.y - val.y) + val.x)
					{
						flag = !flag;
					}
					num4 = num3++;
				}
				return (!flag) ? num2 : (0f - num2);
			};
		}

		private static Func<Vector2, float> Union(params Func<Vector2, float>[] shapes)
		{
			return delegate(Vector2 p)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				float num = float.MaxValue;
				Func<Vector2, float>[] array = shapes;
				foreach (Func<Vector2, float> func in array)
				{
					num = Mathf.Min(num, func(p));
				}
				return num;
			};
		}

		private static Func<Vector2, float> Cut(Func<Vector2, float> shape, params Func<Vector2, float>[] holes)
		{
			return delegate(Vector2 p)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				float num = shape(p);
				Func<Vector2, float>[] array = holes;
				foreach (Func<Vector2, float> func in array)
				{
					num = Mathf.Max(num, 0f - func(p));
				}
				return num;
			};
		}

		private static Sprite Paint(string key, params Func<Vector2, float>[] shapes)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (Cache.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
			Vector2 arg = default(Vector2);
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					((Vector2)(ref arg))..ctor((float)j + 0.5f, (float)i + 0.5f);
					float num = float.MaxValue;
					foreach (Func<Vector2, float> func in shapes)
					{
						num = Mathf.Min(num, func(arg));
					}
					val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(0.5f - num)));
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f);
			Cache[key] = val2;
			return val2;
		}

		public static Sprite Star()
		{