Decompiled source of Shared Map and Auto Discover v1.4.0

plugins/SharedMapAndAutoDiscover.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Cartografo
{
	internal static class Agrupamento
	{
		internal enum Nivel
		{
			Perto,
			Medio,
			Longe
		}

		internal sealed class Item
		{
			internal PinData Pino;

			internal Tipo Tipo;

			internal Vector3 Pos;

			internal Marcadores.Ponto Ponto;

			internal string Nome;

			internal bool SemPar;

			internal int Ordem;
		}

		internal sealed class Aglomerado
		{
			internal Tipo Tipo;

			internal List<Item> Itens;

			internal Vector3 Centro;

			internal Vector2 Desvio;

			internal bool NaTela;

			internal readonly List<Item> NaoCouberam = new List<Item>();

			internal Item Exibido;

			internal int MenorOrdem;
		}

		[HarmonyPatch(typeof(Minimap), "UpdatePins")]
		private static class Desenho
		{
			[HarmonyPriority(0)]
			private static void Postfix(Minimap __instance)
			{
				try
				{
					Aplicar(__instance);
				}
				catch (Exception arg)
				{
					if (!erroAvisado)
					{
						erroAvisado = true;
						Plugin.Log.LogError((object)$"Erro no agrupamento do mapa: {arg}");
					}
				}
			}
		}

		private sealed class Arvore
		{
			private readonly List<Item> itens;

			private readonly int[] juntaA;

			private readonly int[] juntaB;

			private readonly float[] distancia;

			internal Arvore(List<Item> itens)
			{
				this.itens = itens;
				int count = itens.Count;
				List<int> list = new List<int>();
				List<int> list2 = new List<int>();
				List<float> list3 = new List<float>();
				if (count > 1)
				{
					double[] array = new double[count];
					double[] array2 = new double[count];
					int[] array3 = new int[count];
					int[] array4 = new int[count];
					bool[] array5 = new bool[count];
					for (int i = 0; i < count; i++)
					{
						array[i] = itens[i].Pos.x;
						array2[i] = itens[i].Pos.z;
						array3[i] = 1;
						array5[i] = true;
					}
					Fila fila = new Fila();
					for (int j = 0; j < count; j++)
					{
						for (int k = j + 1; k < count; k++)
						{
							fila.Por(Distancia(array, array2, j, k), j, k, 0, 0);
						}
					}
					int num = count;
					Par par;
					while (num > 1 && fila.Tirar(out par))
					{
						int a = par.A;
						int b = par.B;
						if (!array5[a] || !array5[b] || array4[a] != par.MarcaA || array4[b] != par.MarcaB)
						{
							continue;
						}
						int num2 = array3[a] + array3[b];
						array[a] = (array[a] * (double)array3[a] + array[b] * (double)array3[b]) / (double)num2;
						array2[a] = (array2[a] * (double)array3[a] + array2[b] * (double)array3[b]) / (double)num2;
						array3[a] = num2;
						array5[b] = false;
						array4[a]++;
						list.Add(a);
						list2.Add(b);
						list3.Add((float)par.Distancia);
						num--;
						for (int l = 0; l < count; l++)
						{
							if (array5[l] && l != a)
							{
								fila.Por(Distancia(array, array2, a, l), a, l, array4[a], array4[l]);
							}
						}
					}
				}
				juntaA = list.ToArray();
				juntaB = list2.ToArray();
				distancia = list3.ToArray();
			}

			private static double Distancia(double[] x, double[] z, int i, int j)
			{
				double num = x[i] - x[j];
				double num2 = z[i] - z[j];
				return Math.Sqrt(num * num + num2 * num2);
			}

			internal List<List<Item>> Cortar(float limite)
			{
				int count = itens.Count;
				int[] array = new int[count];
				for (int i = 0; i < count; i++)
				{
					array[i] = i;
				}
				for (int j = 0; j < distancia.Length && distancia[j] < limite; j++)
				{
					int num = Raiz(array, juntaA[j]);
					int num2 = Raiz(array, juntaB[j]);
					if (num != num2)
					{
						array[num2] = num;
					}
				}
				Dictionary<int, List<Item>> dictionary = new Dictionary<int, List<Item>>();
				for (int k = 0; k < count; k++)
				{
					int key = Raiz(array, k);
					if (!dictionary.TryGetValue(key, out var value))
					{
						value = (dictionary[key] = new List<Item>());
					}
					value.Add(itens[k]);
				}
				return dictionary.Values.ToList();
			}

			private static int Raiz(int[] pai, int i)
			{
				while (pai[i] != i)
				{
					pai[i] = pai[pai[i]];
					i = pai[i];
				}
				return i;
			}
		}

		private struct Par
		{
			internal double Distancia;

			internal int A;

			internal int B;

			internal int MarcaA;

			internal int MarcaB;
		}

		private sealed class Fila
		{
			private readonly List<Par> pares = new List<Par>();

			internal void Por(double distancia, int a, int b, int marcaA, int marcaB)
			{
				pares.Add(new Par
				{
					Distancia = distancia,
					A = a,
					B = b,
					MarcaA = marcaA,
					MarcaB = marcaB
				});
				int num = pares.Count - 1;
				while (num > 0)
				{
					int num2 = (num - 1) / 2;
					if (!(pares[num2].Distancia <= pares[num].Distancia))
					{
						List<Par> list = pares;
						int index = num2;
						List<Par> list2 = pares;
						int index2 = num;
						Par value = pares[num];
						Par value2 = pares[num2];
						list[index] = value;
						list2[index2] = value2;
						num = num2;
						continue;
					}
					break;
				}
			}

			internal bool Tirar(out Par par)
			{
				if (pares.Count == 0)
				{
					par = default(Par);
					return false;
				}
				par = pares[0];
				int index = pares.Count - 1;
				pares[0] = pares[index];
				pares.RemoveAt(index);
				int num = 0;
				while (true)
				{
					int num2 = 2 * num + 1;
					int num3 = num2 + 1;
					int num4 = num;
					if (num2 < pares.Count && pares[num2].Distancia < pares[num4].Distancia)
					{
						num4 = num2;
					}
					if (num3 < pares.Count && pares[num3].Distancia < pares[num4].Distancia)
					{
						num4 = num3;
					}
					if (num4 == num)
					{
						break;
					}
					List<Par> list = pares;
					int index2 = num4;
					List<Par> list2 = pares;
					int index3 = num;
					Par value = pares[num];
					Par value2 = pares[num4];
					list[index2] = value;
					list2[index3] = value2;
					num = num4;
				}
				return true;
			}
		}

		private sealed class Ocupacao
		{
			private readonly List<(Rect caixa, Aglomerado dono)> caixas = new List<(Rect, Aglomerado)>();

			private readonly Dictionary<long, List<int>> grade = new Dictionary<long, List<int>>();

			internal void Por(Rect caixa, Aglomerado dono)
			{
				//IL_0012: 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)
				int count = caixas.Count;
				caixas.Add((caixa, dono));
				foreach (long item in Celulas(caixa))
				{
					if (!grade.TryGetValue(item, out var value))
					{
						value = new List<int>();
						grade[item] = value;
					}
					value.Add(count);
				}
			}

			internal Aglomerado Dono(List<Rect> novas, out bool colide)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				foreach (Rect nova in novas)
				{
					Rect current = nova;
					foreach (long item2 in Celulas(current))
					{
						if (!grade.TryGetValue(item2, out var value))
						{
							continue;
						}
						foreach (int item3 in value)
						{
							Rect item = caixas[item3].caixa;
							if (((Rect)(ref current)).xMin < ((Rect)(ref item)).xMax - 3f && ((Rect)(ref current)).xMax > ((Rect)(ref item)).xMin + 3f && ((Rect)(ref current)).yMin < ((Rect)(ref item)).yMax - 3f && ((Rect)(ref current)).yMax > ((Rect)(ref item)).yMin + 3f)
							{
								colide = true;
								return caixas[item3].dono;
							}
						}
					}
				}
				colide = false;
				return null;
			}

			private static IEnumerable<long> Celulas(Rect caixa)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				int num = Mathf.FloorToInt(((Rect)(ref caixa)).xMin / 64f);
				int x1 = Mathf.FloorToInt(((Rect)(ref caixa)).xMax / 64f);
				int y0 = Mathf.FloorToInt(((Rect)(ref caixa)).yMin / 64f);
				int y1 = Mathf.FloorToInt(((Rect)(ref caixa)).yMax / 64f);
				for (int i = num; i <= x1; i++)
				{
					for (int j = y0; j <= y1; j++)
					{
						yield return ((long)i << 32) ^ (uint)j;
					}
				}
			}
		}

		private const float RaioDeLonge = 200f;

		private const float RaioNoMedio = 150f;

		private const float RaioDeEncostar = 32.399998f;

		private const float Folga = 3f;

		private const float MargemDasPequenas = 108f;

		private const float CelulaDaGrade = 64f;

		private const float TopoDoNome = 19f;

		private const float AlturaDoNome = 20f;

		private const float LarguraPorLetra = 9f;

		private const float AproximarNoClique = 0.45f;

		private const float FolgaDoCursor = 6f;

		private const string NomeDoNumero = "SharedMap_Numero";

		private const float AlturaDoNumero = 17f;

		private static readonly Color CorDoNumero = new Color(1f, 0.7f, 0.24f, 1f);

		private static readonly Color FundoDoNumero = new Color(0.055f, 0.04f, 0.024f, 0.88f);

		private static readonly Vector2[] Tentativas = MontarTentativas();

		private static int versao = 1;

		private static int versaoDasArvores;

		private static Minimap mapaDasArvores;

		private static readonly Dictionary<Tipo, Arvore> Arvores = new Dictionary<Tipo, Arvore>();

		private static readonly Dictionary<Tipo, int> Quantos = new Dictionary<Tipo, int>();

		private static readonly List<Item> Itens = new List<Item>();

		private static readonly HashSet<PinData> DoMod = new HashSet<PinData>();

		private static List<Aglomerado> aglomerados = new List<Aglomerado>();

		private static float zoomDaConta = -1f;

		private static int versaoDaConta = -1;

		private static int pinosDaConta = -1;

		private static float alturaDaConta = -1f;

		private static readonly Dictionary<PinData, Aglomerado> PorPino = new Dictionary<PinData, Aglomerado>();

		private static bool mexeuNosPinos;

		private static bool erroAvisado;

		private static readonly Dictionary<Tipo, int> OrdemNoCatalogo = new Dictionary<Tipo, int>();

		internal static void Ligar()
		{
			Plugin.DetalhePeloZoom.SettingChanged += delegate
			{
				Sujo();
			};
			Plugin.VistaDeLonge.SettingChanged += delegate
			{
				Sujo();
			};
			Plugin.VistaDePerto.SettingChanged += delegate
			{
				Sujo();
			};
		}

		internal static void Sujo()
		{
			versao++;
			if ((Object)(object)Minimap.instance != (Object)null)
			{
				Minimap.instance.m_pinUpdateRequired = true;
			}
		}

		internal static float Altura(Minimap mapa)
		{
			return mapa.LargeZoom * (float)mapa.m_textureSize * mapa.m_pixelSize;
		}

		internal static Nivel NivelDa(float altura)
		{
			float value = Plugin.VistaDePerto.Value;
			float num = Mathf.Max(Plugin.VistaDeLonge.Value, value);
			if (!(altura > num))
			{
				if (!(altura > value))
				{
					return Nivel.Perto;
				}
				return Nivel.Medio;
			}
			return Nivel.Longe;
		}

		internal static bool Ativo(Minimap mapa)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if ((Object)(object)mapa != (Object)null && (int)mapa.m_mode == 2 && Plugin.DetalhePeloZoom.Value)
			{
				return NivelDa(Altura(mapa)) != Nivel.Perto;
			}
			return false;
		}

		internal static Aglomerado SobOCursor(Minimap mapa)
		{
			//IL_0016: 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_0020: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if (!Ativo(mapa) || PorPino.Count == 0)
			{
				return null;
			}
			Vector2 val = Vector2.op_Implicit(ZInput.pointerPosition);
			float num = 24f * ((Transform)mapa.m_pinRootLarge).lossyScale.x;
			Aglomerado result = null;
			foreach (KeyValuePair<PinData, Aglomerado> item in PorPino)
			{
				RectTransform uiElement = item.Key.m_uiElement;
				if (!((Object)(object)uiElement == (Object)null) && ((Component)uiElement).gameObject.activeInHierarchy)
				{
					float num2 = Vector2.Distance(RectTransformUtility.WorldToScreenPoint((Camera)null, ((Transform)uiElement).position), val);
					if (num2 < num)
					{
						num = num2;
						result = item.Value;
					}
				}
			}
			return result;
		}

		internal static bool AproximarSobOCursor(Minimap mapa)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Aglomerado aglomerado = SobOCursor(mapa);
			if (aglomerado == null || aglomerado.Itens.Count < 2 || (Object)(object)Player.m_localPlayer == (Object)null)
			{
				return false;
			}
			mapa.m_mapOffset = aglomerado.Centro - ((Component)Player.m_localPlayer).transform.position;
			mapa.LargeZoom *= 0.45f;
			mapa.m_pinUpdateRequired = true;
			return true;
		}

		internal static string Resumo()
		{
			Minimap instance = Minimap.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return "Detail by zoom: no map yet.";
			}
			float num = Altura(instance);
			int num2 = aglomerados.Count((Aglomerado a) => a.NaTela);
			int num3 = aglomerados.Count((Aglomerado a) => a.NaTela && a.Itens.Count > 1);
			int num4 = aglomerados.Count((Aglomerado a) => !a.NaTela);
			return string.Format("Detail by zoom: {0}. Large map view: {1:0} m ({2}). ", Plugin.DetalhePeloZoom.Value ? "on" : "off", num, NivelDa(num)) + $"Last zoomed-out layout: {aglomerados.Count} icons, {num2} placed ({num3} with a count), {num4} waiting for zoom.";
		}

		private static void Aplicar(Minimap mapa)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0042: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			if ((int)mapa.m_mode != 2)
			{
				return;
			}
			if (!Ativo(mapa))
			{
				Restaurar();
				return;
			}
			if ((Object)(object)mapaDasArvores != (Object)(object)mapa || versaoDasArvores != versao)
			{
				MontarArvores(mapa);
			}
			Rect rect = ((Graphic)mapa.m_mapImageLarge).rectTransform.rect;
			if (zoomDaConta != mapa.LargeZoom || versaoDaConta != versaoDasArvores || pinosDaConta != mapa.m_pins.Count || alturaDaConta != ((Rect)(ref rect)).height)
			{
				float num = Altura(mapa);
				Calcular(mapa, NivelDa(num), ((Rect)(ref rect)).height / num);
				zoomDaConta = mapa.LargeZoom;
				versaoDaConta = versaoDasArvores;
				pinosDaConta = mapa.m_pins.Count;
				alturaDaConta = ((Rect)(ref rect)).height;
			}
			PorPino.Clear();
			float num2 = default(float);
			float num3 = default(float);
			foreach (Aglomerado aglomerado in aglomerados)
			{
				aglomerado.Exibido = null;
				Vector2 val = Vector2.zero;
				if (aglomerado.NaTela)
				{
					mapa.WorldToMapPoint(aglomerado.Centro, ref num2, ref num3);
					val = mapa.MapPointToLocalGuiPos(num2, num3, mapa.m_mapImageLarge) + aglomerado.Desvio;
				}
				if (aglomerado.NaTela && val.x >= 0f && val.x <= ((Rect)(ref rect)).width && val.y >= 0f && val.y <= ((Rect)(ref rect)).height)
				{
					float num4 = float.MaxValue;
					foreach (Item iten in aglomerado.Itens)
					{
						if (!((Object)(object)iten.Pino.m_uiElement == (Object)null))
						{
							Vector3 val2 = iten.Pos - aglomerado.Centro;
							float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
							if (sqrMagnitude < num4)
							{
								num4 = sqrMagnitude;
								aglomerado.Exibido = iten;
							}
						}
					}
				}
				foreach (Item iten2 in aglomerado.Itens)
				{
					if ((Object)(object)iten2.Pino.m_uiElement != (Object)null)
					{
						bool flag = iten2 == aglomerado.Exibido;
						Mostrar(iten2.Pino, flag, flag && iten2.Tipo == Catalogo.Portal);
					}
				}
				if (aglomerado.Exibido != null)
				{
					Desenhar(aglomerado, val);
					PorPino[aglomerado.Exibido.Pino] = aglomerado;
				}
			}
			mexeuNosPinos = true;
		}

		private static void Restaurar()
		{
			PorPino.Clear();
			if (!mexeuNosPinos)
			{
				return;
			}
			mexeuNosPinos = false;
			foreach (Item iten in Itens)
			{
				if ((Object)(object)iten.Pino.m_uiElement != (Object)null)
				{
					Mostrar(iten.Pino, icone: true, nome: true);
					Numero(iten.Pino, 1);
				}
			}
		}

		private static void MontarArvores(Minimap mapa)
		{
			//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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			Restaurar();
			Itens.Clear();
			DoMod.Clear();
			foreach (Marcadores.Ponto value in Marcadores.Pontos.Values)
			{
				if (value.Pino != null)
				{
					Itens.Add(new Item
					{
						Pino = value.Pino,
						Tipo = value.Tipo,
						Pos = value.Pos,
						Ponto = value,
						Ordem = value.Id
					});
				}
			}
			int num = 1073741823;
			foreach (var (val, nome, semPar) in PinosDePortal.Pinos())
			{
				if (val != null)
				{
					Itens.Add(new Item
					{
						Pino = val,
						Tipo = Catalogo.Portal,
						Pos = val.m_pos,
						Nome = nome,
						SemPar = semPar,
						Ordem = num++
					});
				}
			}
			Arvores.Clear();
			Quantos.Clear();
			foreach (IGrouping<Tipo, Item> item in from item in Itens
				group item by item.Tipo)
			{
				List<Item> list = item.ToList();
				Arvores[item.Key] = new Arvore(list);
				Quantos[item.Key] = list.Count;
			}
			foreach (Item iten in Itens)
			{
				DoMod.Add(iten.Pino);
			}
			mapaDasArvores = mapa;
			versaoDasArvores = versao;
		}

		private static void Calcular(Minimap mapa, Nivel nivel, float k)
		{
			//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)
			//IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: 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)
			float num = ((nivel == Nivel.Longe) ? 200f : 150f);
			List<Aglomerado> list = new List<Aglomerado>();
			foreach (KeyValuePair<Tipo, Arvore> arvore in Arvores)
			{
				float limite = (GruposDaBarra.Fixo(arvore.Key) ? 32.399998f : num) / k;
				foreach (List<Item> item in arvore.Value.Cortar(limite))
				{
					Vector3 val = Vector3.zero;
					int num2 = int.MaxValue;
					foreach (Item item2 in item)
					{
						val += item2.Pos;
						num2 = Mathf.Min(num2, item2.Ordem);
					}
					list.Add(new Aglomerado
					{
						Tipo = arvore.Key,
						Itens = item,
						Centro = val / (float)item.Count,
						MenorOrdem = num2
					});
				}
			}
			list.Sort(Comparar);
			Ocupacao ocupacao = new Ocupacao();
			foreach (PinData pin in mapa.m_pins)
			{
				if (Obstaculo(mapa, pin))
				{
					float lado = mapa.m_pinSizeLarge * (pin.m_doubleSize ? 2f : 1f);
					ocupacao.Por(Caixa(new Vector2(pin.m_pos.x * k, pin.m_pos.z * k), lado), null);
				}
			}
			Vector2 val2 = default(Vector2);
			foreach (Aglomerado item3 in list)
			{
				((Vector2)(ref val2))..ctor(item3.Centro.x * k, item3.Centro.z * k);
				bool flag = GruposDaBarra.Fixo(item3.Tipo);
				bool flag2 = GruposDaBarra.Pequena(item3.Tipo) && !Marcadores.Destacado(item3.Tipo);
				float lado2 = 36f + (flag2 ? 108f : 0f);
				bool colide;
				Aglomerado aglomerado = ocupacao.Dono(Caixas(item3, val2, lado2), out colide);
				Vector2? val3 = null;
				if (!colide || flag)
				{
					val3 = Vector2.zero;
				}
				else
				{
					for (int i = 1; i < Tentativas.Length; i++)
					{
						if (val3.HasValue)
						{
							break;
						}
						ocupacao.Dono(Caixas(item3, val2 + Tentativas[i], lado2), out var colide2);
						if (!colide2)
						{
							val3 = Tentativas[i];
						}
					}
				}
				if (!val3.HasValue)
				{
					item3.NaTela = false;
					aglomerado?.NaoCouberam.AddRange(item3.Itens);
					continue;
				}
				item3.NaTela = true;
				item3.Desvio = val3.Value;
				foreach (Rect item4 in Caixas(item3, val2 + val3.Value, lado2))
				{
					ocupacao.Por(item4, item3);
				}
			}
			aglomerados = list;
		}

		private static int Comparar(Aglomerado a, Aglomerado b)
		{
			int num = Faixa(a.Tipo);
			int num2 = Faixa(b.Tipo);
			if (num != num2)
			{
				return num.CompareTo(num2);
			}
			int num3 = ((num == 0) ? OrdemDoTipo(a.Tipo).CompareTo(OrdemDoTipo(b.Tipo)) : Quantos[a.Tipo].CompareTo(Quantos[b.Tipo]));
			if (num3 != 0)
			{
				return num3;
			}
			num3 = OrdemDoTipo(a.Tipo).CompareTo(OrdemDoTipo(b.Tipo));
			if (num3 != 0)
			{
				return num3;
			}
			num3 = b.Itens.Count.CompareTo(a.Itens.Count);
			if (num3 == 0)
			{
				return a.MenorOrdem.CompareTo(b.MenorOrdem);
			}
			return num3;
		}

		private static int OrdemDoTipo(Tipo tipo)
		{
			if (OrdemNoCatalogo.Count == 0)
			{
				for (int i = 0; i < Catalogo.Lista.Count; i++)
				{
					OrdemNoCatalogo[Catalogo.Lista[i]] = i;
				}
			}
			if (!OrdemNoCatalogo.TryGetValue(tipo, out var value))
			{
				return int.MaxValue;
			}
			return value;
		}

		private static int Faixa(Tipo tipo)
		{
			if (!GruposDaBarra.Fixo(tipo))
			{
				if (!Marcadores.Destacado(tipo))
				{
					if (!GruposDaBarra.Pequena(tipo))
					{
						return 2;
					}
					return 3;
				}
				return 1;
			}
			return 0;
		}

		private static bool Obstaculo(Minimap mapa, PinData pino)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0027: 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_002c: Invalid comparison between Unknown and I4
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0047: 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_0070: Invalid comparison between Unknown and I4
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Invalid comparison between Unknown and I4
			if (DoMod.Contains(pino) || pino.m_worldSize > 0f)
			{
				return false;
			}
			PinType type = pino.m_type;
			if ((int)type == 7 || type - 10 <= 3)
			{
				return false;
			}
			if ((int)pino.m_type < mapa.m_visibleIconTypes.Length && !mapa.m_visibleIconTypes[pino.m_type])
			{
				return false;
			}
			if (pino.m_ownerID != 0L && mapa.m_sharedMapDataFade <= 0f)
			{
				return false;
			}
			if ((int)pino.m_type >= 14 && (int)pino.m_type <= 16)
			{
				return !Marcadores.Escondido(Catalogo.PinosDeMissao);
			}
			return true;
		}

		private static Rect Caixa(Vector2 meio, float lado)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(meio.x - lado / 2f, meio.y - lado / 2f, lado, lado);
		}

		private static List<Rect> Caixas(Aglomerado aglomerado, Vector2 meio, float lado)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			List<Rect> list = new List<Rect> { Caixa(meio, lado) };
			if (aglomerado.Tipo == Catalogo.Portal)
			{
				string text = aglomerado.Itens[0].Nome ?? "";
				float num = 9f * (float)Mathf.Max(text.Length, 6) + 12f;
				list.Add(new Rect(meio.x - num / 2f, meio.y - 19f - 20f, num, 20f));
			}
			return list;
		}

		private static void Mostrar(PinData pino, bool icone, bool nome)
		{
			GameObject gameObject = ((Component)pino.m_uiElement).gameObject;
			if (gameObject.activeSelf != icone)
			{
				gameObject.SetActive(icone);
			}
			PinNameData namePinData = pino.m_NamePinData;
			if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null && ((Behaviour)namePinData.PinNameText).enabled != nome)
			{
				((Behaviour)namePinData.PinNameText).enabled = nome;
			}
			if ((Object)(object)((namePinData != null) ? namePinData.PinNameGameObject : null) != (Object)null && !nome && namePinData.PinNameGameObject.activeSelf)
			{
				namePinData.PinNameGameObject.SetActive(false);
			}
		}

		private static void Desenhar(Aglomerado aglomerado, Vector2 lugar)
		{
			//IL_0012: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			PinData pino = aglomerado.Exibido.Pino;
			pino.m_uiElement.anchoredPosition = lugar;
			PinNameData namePinData = pino.m_NamePinData;
			if ((Object)(object)((namePinData != null) ? namePinData.PinNameRectTransform : null) != (Object)null)
			{
				namePinData.PinNameRectTransform.anchoredPosition = lugar;
			}
			Numero(pino, aglomerado.Itens.Count);
			if (aglomerado.Tipo == Catalogo.Portal)
			{
				Color color = (Color)(aglomerado.Itens.All((Item item) => item.SemPar) ? new Color(1f, 1f, 1f, 0.5f) : Color.white);
				((Graphic)pino.m_iconElement).color = color;
				if ((Object)(object)((namePinData != null) ? namePinData.PinNameText : null) != (Object)null)
				{
					((Graphic)namePinData.PinNameText).color = color;
				}
				return;
			}
			bool flag = aglomerado.Itens.All((Item item) => item.Ponto != null && item.Ponto.ComX);
			float num = (aglomerado.Itens.All((Item item) => item.Ponto != null && item.Ponto.Excluido) ? 0.1f : 1f);
			((Graphic)pino.m_iconElement).color = new Color(1f, 1f, 1f, num);
			if ((Object)(object)pino.m_checkedElement != (Object)null)
			{
				if (pino.m_checkedElement.activeSelf != flag)
				{
					pino.m_checkedElement.SetActive(flag);
				}
				Image component = pino.m_checkedElement.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					Color color2 = ((Graphic)component).color;
					color2.a = num;
					((Graphic)component).color = color2;
				}
			}
		}

		private static void Numero(PinData pino, int quantos)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0068: 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_007a: 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_008f: 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)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00c4: 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_00e5: 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)
			//IL_010c: Expected O, but got Unknown
			//IL_0122: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Transform)pino.m_uiElement).Find("SharedMap_Numero");
			if (quantos < 2)
			{
				if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
				{
					((Component)val).gameObject.SetActive(false);
				}
				return;
			}
			Text val4;
			if ((Object)(object)val == (Object)null)
			{
				GameObject val2 = new GameObject("SharedMap_Numero", new Type[1] { typeof(RectTransform) });
				RectTransform val3 = (RectTransform)val2.transform;
				((Transform)val3).SetParent((Transform)(object)pino.m_uiElement, false);
				val3.anchorMin = new Vector2(0.5f, 0.5f);
				val3.anchorMax = new Vector2(0.5f, 0.5f);
				val3.pivot = new Vector2(0f, 1f);
				val3.anchoredPosition = new Vector2(9f, -6f);
				Image obj = val2.AddComponent<Image>();
				((Graphic)obj).color = FundoDoNumero;
				((Graphic)obj).raycastTarget = false;
				val4 = Interface.Texto((Transform)val3, "", 0f, 0f, 0f, 17f, 13, CorDoNumero, negrito: true);
				val4.resizeTextForBestFit = false;
				val4.alignment = (TextAnchor)4;
				RectTransform rectTransform = ((Graphic)val4).rectTransform;
				rectTransform.anchorMin = Vector2.zero;
				rectTransform.anchorMax = Vector2.one;
				rectTransform.pivot = new Vector2(0.5f, 0.5f);
				rectTransform.anchoredPosition = Vector2.zero;
				rectTransform.sizeDelta = Vector2.zero;
				val = (Transform)val3;
			}
			else
			{
				val4 = ((Component)val).GetComponentInChildren<Text>(true);
			}
			if (!((Component)val).gameObject.activeSelf)
			{
				((Component)val).gameObject.SetActive(true);
			}
			string text = "×" + quantos;
			if ((Object)(object)val4 != (Object)null && val4.text != text)
			{
				val4.text = text;
				((RectTransform)val).sizeDelta = new Vector2(Mathf.Ceil(val4.preferredWidth) + 8f, 17f);
			}
			val.SetAsLastSibling();
		}

		private static Vector2[] MontarTentativas()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			List<Vector2> list = new List<Vector2> { Vector2.zero };
			float[] array = new float[2] { 12f, 24f };
			foreach (float num in array)
			{
				for (int j = 0; j < 8; j++)
				{
					float num2 = (float)j * (float)Math.PI / 4f;
					list.Add(new Vector2(Mathf.Round(num * Mathf.Cos(num2)), Mathf.Round(num * Mathf.Sin(num2))));
				}
			}
			return list.ToArray();
		}
	}
	public sealed class CliqueDaBarra : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler
	{
		internal Action Esquerdo;

		internal Action Direito;

		internal Action Entrou;

		internal Action Saiu;

		public void OnPointerClick(PointerEventData dados)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			if ((int)dados.button == 0)
			{
				Esquerdo?.Invoke();
			}
			else if ((int)dados.button == 1)
			{
				Direito?.Invoke();
			}
		}

		public void OnPointerEnter(PointerEventData dados)
		{
			Entrou?.Invoke();
		}

		public void OnPointerExit(PointerEventData dados)
		{
			Saiu?.Invoke();
		}
	}
	internal static class BarraDeGrupos
	{
		private sealed class Botao
		{
			internal GrupoDaBarra Grupo;

			internal RectTransform Rect;

			internal Image Fundo;

			internal Outline Borda;

			internal Image Icone;

			internal Text Nome;

			internal Text Quantos;

			internal Image Parcial;

			internal bool ComMouse;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Func<Tipo, bool> <0>__Filtrado;

			public static Action <1>__FecharLista;

			public static Func<Tipo, bool> <2>__Pequena;

			public static UnityAction <3>__Desselecionar;
		}

		private const float AlturaDoBotao = 80f;

		private const float LarguraMaxima = 100f;

		private const float LarguraMinima = 60f;

		private const float Espaco = 6f;

		private const float Recuo = 6f;

		private const float LarguraDoMestre = 64f;

		private const float Esquerda = 20f;

		private const float AcimaDasDicas = 72f;

		private const float SemDicas = 20f;

		private const float AntesDoPainel = 12f;

		private const float PainelDaDireita = 355f;

		private const float LadoDoIcone = 36f;

		private const float MargemDaLista = 14f;

		private const float AlturaDaLinha = 34f;

		private const float LarguraDaColuna = 236f;

		private const float LarguraDaColunaUnica = 300f;

		private const float EntreColunas = 14f;

		private const float AlturaDoChip = 28f;

		private const float AlturaDoRodape = 30f;

		private static readonly Color FundoDaBarra = new Color(0f, 0f, 0f, 0.55f);

		private static readonly Color Desligado = new Color(0.118f, 0.102f, 0.086f, 0.72f);

		private static readonly Color DesligadoComMouse = new Color(0.227f, 0.188f, 0.149f, 0.85f);

		private static readonly Color Ligado = new Color(0.188f, 0.141f, 0.086f, 0.82f);

		private static readonly Color LigadoComMouse = new Color(0.26f, 0.2f, 0.13f, 0.9f);

		private static readonly Color BordaLigada = new Color(1f, 0.64f, 0f, 0.95f);

		private static readonly Color BordaDesligada = new Color(1f, 1f, 1f, 0.07f);

		private static readonly Color NomeLigado = new Color(1f, 0.667f, 0.235f, 1f);

		private static readonly Color NomeDesligado = new Color(0.561f, 0.537f, 0.49f, 1f);

		private static readonly Color IconeDesligado = new Color(0.55f, 0.55f, 0.55f, 0.45f);

		private static readonly Color Laranja = new Color(1f, 0.64f, 0f, 1f);

		private static readonly Color CorDoNumero = new Color(0.81f, 0.78f, 0.71f, 1f);

		private static readonly Color FundoDoNumero = new Color(0f, 0f, 0f, 0.55f);

		private static readonly Color FundoDaAlca = new Color(0f, 0f, 0f, 0.5f);

		private static readonly Color Seta = new Color(0.91f, 0.86f, 0.76f, 1f);

		private static readonly Color FundoDaLista = new Color(0.055f, 0.047f, 0.039f, 0.95f);

		private static readonly Color BordaDaLista = new Color(1f, 0.64f, 0.24f, 0.45f);

		private static readonly Color Apagado = new Color(0.725f, 0.694f, 0.631f, 1f);

		private static readonly Color Ouro = new Color(1f, 0.745f, 0.157f, 1f);

		private static readonly Color EstrelaApagada = new Color(0.435f, 0.416f, 0.376f, 1f);

		private static readonly Color NomeOculto = new Color(0.49f, 0.467f, 0.424f, 1f);

		private static readonly Color IconeOculto = new Color(0.6f, 0.6f, 0.6f, 0.4f);

		private static readonly Color FundoDoBotao = new Color(0.118f, 0.102f, 0.086f, 0.85f);

		private static readonly Color BotaoComMouse = new Color(0.25f, 0.2f, 0.15f, 0.95f);

		private static readonly Color BordaDoBotao = new Color(1f, 1f, 1f, 0.1f);

		private static readonly Color ChipLigado = new Color(1f, 0.64f, 0.24f, 0.18f);

		private static readonly Color BordaDoChipLigado = new Color(1f, 0.64f, 0.24f, 0.6f);

		private static readonly Color ChipDesligado = new Color(1f, 1f, 1f, 0.02f);

		private static readonly Color BordaDoChipDesligado = new Color(1f, 1f, 1f, 0.18f);

		private static readonly Color TextoDoChipDesligado = new Color(0.55f, 0.525f, 0.475f, 1f);

		private static readonly (string titulo, Classe classe)[] Habitantes = new(string, Classe)[3]
		{
			("$vc_ui_hostile", Classe.Inimigos),
			("$vc_ui_neutral", Classe.Neutros),
			("$vc_ui_empty", Classe.Vazio)
		};

		private static Minimap mapaDaBarra;

		private static RectTransform barra;

		private static readonly List<Botao> Botoes = new List<Botao>();

		private static float larguraDoBotao;

		private static float baixoDaBarra;

		private static (float largura, float limite, bool dicas) medidas;

		private static RectTransform lista;

		private static GrupoDaBarra grupoDaLista;

		private static bool refazerLista;

		private static bool repintar = true;

		private static float proximaContagem;

		private static readonly Dictionary<GrupoDaBarra, int> Contagem = new Dictionary<GrupoDaBarra, int>();

		internal static void Ligar()
		{
			Marcadores.FiltroMudou += delegate
			{
				repintar = true;
				refazerLista = (Object)(object)lista != (Object)null;
			};
		}

		internal static void Atualizar()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			Minimap instance = Minimap.instance;
			if ((Object)(object)instance == (Object)null)
			{
				Esquecer();
				return;
			}
			if ((int)instance.m_mode != 2)
			{
				FecharLista();
				return;
			}
			if (!((Object)(object)instance != (Object)(object)mapaDaBarra) && !((Object)(object)barra == (Object)null))
			{
				(float, float, bool) tuple = Medir(instance);
				(float, float, bool) tuple2 = medidas;
				if (tuple.Item1 == tuple2.Item1 && tuple.Item2 == tuple2.Item2 && tuple.Item3 == tuple2.Item3)
				{
					goto IL_0080;
				}
			}
			Destruir();
			Criar(instance);
			goto IL_0080;
			IL_0080:
			if (refazerLista && (Object)(object)lista != (Object)null)
			{
				refazerLista = false;
				AbrirLista(grupoDaLista);
			}
			if (repintar || Time.time >= proximaContagem)
			{
				repintar = false;
				proximaContagem = Time.time + 0.5f;
				Contar(instance);
				foreach (Botao boto in Botoes)
				{
					Pintar(boto);
				}
			}
			if ((Object)(object)lista != (Object)null && (ZInput.GetMouseButtonDown(0) || ZInput.GetMouseButtonDown(1)) && !Contem(lista) && !Contem(barra))
			{
				FecharLista();
			}
		}

		internal static bool CursorEmCima()
		{
			if (!((Object)(object)barra != (Object)null) || !((Component)barra).gameObject.activeInHierarchy || !Contem(barra))
			{
				if ((Object)(object)lista != (Object)null)
				{
					return Contem(lista);
				}
				return false;
			}
			return true;
		}

		internal static void Fechar()
		{
			FecharLista();
			DicaDoMapa.EsconderDaBarra();
		}

		private static bool Contem(RectTransform rect)
		{
			//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)
			return RectTransformUtility.RectangleContainsScreenPoint(rect, Vector2.op_Implicit(ZInput.pointerPosition), (Camera)null);
		}

		private static (float largura, float limite, bool dicas) Medir(Minimap mapa)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_007d: 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)
			RectTransform val = (RectTransform)mapa.m_largeRoot.transform;
			Rect rect = val.rect;
			float width = ((Rect)(ref rect)).width;
			float item = width - 355f;
			if ((Object)(object)mapa.m_publicPosition != (Object)null)
			{
				Transform parent = ((Component)mapa.m_publicPosition).transform.parent;
				RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
				if (val2 != null && (Object)(object)val2 != (Object)(object)val)
				{
					Vector3[] array = (Vector3[])(object)new Vector3[4];
					val2.GetWorldCorners(array);
					float x = ((Transform)val).InverseTransformPoint(array[0]).x;
					rect = val.rect;
					float num = x - ((Rect)(ref rect)).xMin;
					if (num > width / 3f && num < width)
					{
						item = Mathf.Round(num);
					}
				}
			}
			bool item2 = mapa.m_hints != null && mapa.m_hints.Any((GameObject dica) => (Object)(object)dica != (Object)null && dica.activeSelf);
			return (largura: Mathf.Round(width), limite: item, dicas: item2);
		}

		private static void Criar(Minimap mapa)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00c7: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			mapaDaBarra = mapa;
			medidas = Medir(mapa);
			int num = GruposDaBarra.Todos.Length;
			float num2 = 12f + 6f * (float)num + 64f;
			larguraDoBotao = Mathf.Clamp(Mathf.Floor((medidas.limite - 12f - 20f - num2) / (float)num), 60f, 100f);
			baixoDaBarra = (medidas.dicas ? 72f : 20f);
			GameObject val = new GameObject("SharedMap_Barra", new Type[1] { typeof(RectTransform) });
			barra = (RectTransform)val.transform;
			((Transform)barra).SetParent(mapa.m_largeRoot.transform, false);
			barra.anchorMin = Vector2.zero;
			barra.anchorMax = Vector2.zero;
			barra.pivot = Vector2.zero;
			barra.anchoredPosition = new Vector2(20f, baixoDaBarra);
			barra.sizeDelta = new Vector2(num2 + larguraDoBotao * (float)num, 92f);
			((Graphic)val.AddComponent<Image>()).color = FundoDaBarra;
			Botoes.Clear();
			float num3 = 6f;
			GrupoDaBarra[] todos = GruposDaBarra.Todos;
			foreach (GrupoDaBarra grupo in todos)
			{
				Botoes.Add(CriarBotao(grupo, num3));
				num3 += larguraDoBotao + 6f;
			}
			RectTransform pai = Interface.Retangulo("Mestre", (Transform)(object)barra, num3, 6f, 64f, 80f);
			float num4 = 37f;
			BotaoDeTexto(pai, 0f, 0f, 64f, num4, "$vc_ui_all", 14, delegate
			{
				Marcadores.FiltrarGrupos(GruposDaBarra.Todos, visiveis: true);
			});
			BotaoDeTexto(pai, 0f, num4 + 6f, 64f, num4, "$vc_ui_none", 14, delegate
			{
				Marcadores.FiltrarGrupos(GruposDaBarra.Todos, visiveis: false);
			});
			repintar = true;
		}

		private static Botao CriarBotao(GrupoDaBarra grupo, float x)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Interface.Retangulo("Grupo_" + grupo.Id, (Transform)(object)barra, x, 6f, larguraDoBotao, 80f);
			Botao botao = new Botao
			{
				Grupo = grupo,
				Rect = val
			};
			botao.Fundo = ((Component)val).gameObject.AddComponent<Image>();
			botao.Borda = ((Component)val).gameObject.AddComponent<Outline>();
			((Shadow)botao.Borda).effectDistance = new Vector2(2f, -2f);
			CliqueDaBarra cliqueDaBarra = ((Component)val).gameObject.AddComponent<CliqueDaBarra>();
			cliqueDaBarra.Esquerdo = delegate
			{
				Marcadores.FiltrarGrupos(new GrupoDaBarra[1] { grupo }, Marcadores.GrupoDesligado(grupo));
			};
			cliqueDaBarra.Direito = delegate
			{
				AbrirOuFechar(grupo);
			};
			cliqueDaBarra.Entrou = delegate
			{
				botao.ComMouse = true;
				Pintar(botao);
				MostrarDica(botao);
			};
			cliqueDaBarra.Saiu = delegate
			{
				botao.ComMouse = false;
				Pintar(botao);
				DicaDoMapa.EsconderDaBarra();
			};
			botao.Icone = Interface.Imagem("Icone", (Transform)(object)val, (larguraDoBotao - 36f) / 2f, 9f, 36f, GruposDaBarra.Icone(grupo), Color.white);
			botao.Icone.preserveAspect = true;
			botao.Nome = Interface.Texto((Transform)(object)val, Localization.instance.Localize(grupo.Titulo), 4f, 54f, larguraDoBotao - 8f, 20f, 15, NomeDesligado, negrito: true);
			botao.Nome.alignment = (TextAnchor)4;
			Image val2 = Interface.Imagem("Quantos", (Transform)(object)val, 4f, 4f, 30f, 16f, null, FundoDoNumero);
			botao.Quantos = Interface.Texto(((Component)val2).transform, "", 0f, 0f, 30f, 16f, 12, CorDoNumero);
			botao.Quantos.alignment = (TextAnchor)4;
			botao.Parcial = Interface.Imagem("Parcial", (Transform)(object)val, 6f, 65f, 8f, Icones.Figura("circulo"), Laranja);
			RectTransform val3 = Interface.Retangulo("Lista", (Transform)(object)val, larguraDoBotao - 27f, 3f, 24f, 20f);
			Image fundo = ((Component)val3).gameObject.AddComponent<Image>();
			Button obj = ((Component)val3).gameObject.AddComponent<Button>();
			Cores(obj, fundo, FundoDaAlca, Laranja);
			((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
			{
				AbrirOuFechar(grupo);
			});
			Interface.Imagem("Seta", (Transform)(object)val3, 7f, 5f, 10f, 10f, Icones.Figura("seta"), Seta);
			return botao;
		}

		private static void Pintar(Botao botao)
		{
			//IL_003f: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0052: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			GrupoDaBarra grupo = botao.Grupo;
			bool flag = !Marcadores.GrupoDesligado(grupo);
			((Graphic)botao.Fundo).color = ((!flag) ? (botao.ComMouse ? DesligadoComMouse : Desligado) : (botao.ComMouse ? LigadoComMouse : Ligado));
			((Shadow)botao.Borda).effectColor = (flag ? BordaLigada : BordaDesligada);
			if ((Object)(object)botao.Icone.sprite == (Object)null)
			{
				botao.Icone.sprite = GruposDaBarra.Icone(grupo);
			}
			((Behaviour)botao.Icone).enabled = (Object)(object)botao.Icone.sprite != (Object)null;
			((Graphic)botao.Icone).color = (flag ? Color.white : IconeDesligado);
			((Graphic)botao.Nome).color = (flag ? NomeLigado : NomeDesligado);
			((Behaviour)botao.Parcial).enabled = flag && Parcial(grupo);
			botao.Quantos.text = (Contagem.TryGetValue(grupo, out var value) ? value.ToString() : "");
		}

		private static bool Parcial(GrupoDaBarra grupo)
		{
			if (!grupo.Tipos.Any(Marcadores.Filtrado))
			{
				if (grupo.Habitantes)
				{
					return Habitantes.Any(((string titulo, Classe classe) h) => Marcadores.ClasseFiltrada(h.classe));
				}
				return false;
			}
			return true;
		}

		private static void MostrarDica(Botao botao)
		{
			Localization instance = Localization.instance;
			List<string> list = new List<string>
			{
				instance.Localize("$vc_ui_tile_click"),
				instance.Localize("$vc_ui_tile_right")
			};
			if (!Marcadores.GrupoDesligado(botao.Grupo) && Parcial(botao.Grupo))
			{
				list.Add(instance.Localize("$vc_ui_tile_partial"));
			}
			DicaDoMapa.MostrarDaBarra(instance.Localize(botao.Grupo.Titulo), list, botao.Rect);
		}

		private static void Contar(Minimap mapa)
		{
			Contagem.Clear();
			GrupoDaBarra[] todos = GruposDaBarra.Todos;
			foreach (GrupoDaBarra key in todos)
			{
				Contagem[key] = 0;
			}
			foreach (Marcadores.Ponto value in Marcadores.Pontos.Values)
			{
				if (Visivel(value))
				{
					Contagem[GruposDaBarra.De(value.Tipo)]++;
				}
			}
			Contagem[GruposDaBarra.Portais] += Quantos(mapa, Catalogo.Portal);
			Contagem[GruposDaBarra.Mercadores] += Quantos(mapa, Catalogo.Comerciante);
			Contagem[GruposDaBarra.Missoes] += Quantos(mapa, Catalogo.PinosDeMissao);
		}

		private static bool Visivel(Marcadores.Ponto ponto)
		{
			if (!Marcadores.Filtrado(ponto.Tipo))
			{
				if (GruposDaBarra.De(ponto.Tipo).Habitantes && ponto.Classe != Classe.Nenhuma)
				{
					return !Marcadores.ClasseFiltrada(ponto.Classe);
				}
				return true;
			}
			return false;
		}

		private static int Quantos(Minimap mapa, Tipo tipo)
		{
			if (Marcadores.Filtrado(tipo))
			{
				return 0;
			}
			if (tipo == Catalogo.Portal)
			{
				return Portais.Lista.Count;
			}
			if (tipo == Catalogo.Comerciante)
			{
				return IconesDoJogo.ContarMercadores(mapa);
			}
			if (tipo == Catalogo.PinosDeMissao)
			{
				return IconesDoJogo.ContarPinosDeMissao(mapa);
			}
			return Marcadores.Pontos.Values.Count((Marcadores.Ponto ponto) => ponto.Tipo == tipo && Visivel(ponto));
		}

		private static int QuantosNaLista(Minimap mapa, Tipo tipo)
		{
			if (tipo == Catalogo.Portal)
			{
				return Portais.Lista.Count;
			}
			if (tipo == Catalogo.Comerciante)
			{
				return IconesDoJogo.ContarMercadores(mapa);
			}
			if (tipo == Catalogo.PinosDeMissao)
			{
				return IconesDoJogo.ContarPinosDeMissao(mapa);
			}
			bool habitantes = GruposDaBarra.De(tipo).Habitantes;
			return Marcadores.Pontos.Values.Count((Marcadores.Ponto ponto) => ponto.Tipo == tipo && (!habitantes || ponto.Classe == Classe.Nenhuma || !Marcadores.ClasseFiltrada(ponto.Classe)));
		}

		private static void AbrirOuFechar(GrupoDaBarra grupo)
		{
			if ((Object)(object)lista != (Object)null && grupoDaLista == grupo)
			{
				FecharLista();
			}
			else
			{
				AbrirLista(grupo);
			}
		}

		private static void FecharLista()
		{
			if ((Object)(object)lista != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)lista).gameObject);
			}
			lista = null;
			grupoDaLista = null;
			refazerLista = false;
		}

		private static void AbrirLista(GrupoDaBarra grupo)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			FecharLista();
			Minimap val = mapaDaBarra;
			if ((Object)(object)val == (Object)null || (Object)(object)barra == (Object)null || grupo == null)
			{
				return;
			}
			Localization instance = Localization.instance;
			grupoDaLista = grupo;
			List<Tipo> tipos = grupo.Tipos;
			int num = ((tipos.Count > 10) ? 3 : ((tipos.Count <= 1) ? 1 : 2));
			float num2 = ((num == 1) ? 300f : 236f);
			float num3 = 28f + (float)num * num2 + (float)(num - 1) * 14f;
			GameObject val2 = new GameObject("SharedMap_Lista", new Type[1] { typeof(RectTransform) });
			lista = (RectTransform)val2.transform;
			((Transform)lista).SetParent(val.m_largeRoot.transform, false);
			lista.anchorMin = Vector2.zero;
			lista.anchorMax = Vector2.zero;
			lista.pivot = Vector2.zero;
			((Graphic)val2.AddComponent<Image>()).color = FundoDaLista;
			Outline obj = val2.AddComponent<Outline>();
			((Shadow)obj).effectColor = BordaDaLista;
			((Shadow)obj).effectDistance = new Vector2(1f, -1f);
			float num4 = 12f;
			Icone(Interface.Imagem("Icone", (Transform)(object)lista, 14f, num4, 36f, GruposDaBarra.Icone(grupo), Color.white));
			float num5 = 60f;
			Text val3 = Interface.Texto((Transform)(object)lista, instance.Localize(grupo.Titulo), num5, num4, num3 - num5 - 120f, 36f, 22, NomeLigado, negrito: true);
			val3.resizeTextForBestFit = false;
			float x = num5 + Mathf.Min(Mathf.Ceil(val3.preferredWidth), num3 - num5 - 120f) + 10f;
			Contagem.TryGetValue(grupo, out var value);
			Interface.Texto((Transform)(object)lista, value.ToString(), x, num4, 60f, 36f, 15, Apagado);
			BotaoDeTexto(lista, num3 - 14f - 30f, num4 + 3f, 30f, 30f, "×", 18, FecharLista);
			num4 += 42f;
			string text = "";
			if (tipos.Any((Tipo tipo) => !GruposDaBarra.Fixo(tipo)))
			{
				text = instance.Localize("$vc_ui_list_hint");
			}
			if (tipos.Any(GruposDaBarra.Pequena))
			{
				text = text + ((text.Length > 0) ? " " : "") + instance.Localize("$vc_ui_list_hint_small");
			}
			if (text.Length > 0)
			{
				Text obj2 = Interface.Texto((Transform)(object)lista, text, 14f, num4, num3 - 28f, 20f, 14, Apagado);
				obj2.resizeTextForBestFit = false;
				obj2.horizontalOverflow = (HorizontalWrapMode)0;
				obj2.verticalOverflow = (VerticalWrapMode)1;
				obj2.alignment = (TextAnchor)0;
				float num6 = Mathf.Ceil(obj2.preferredHeight);
				((Graphic)obj2).rectTransform.sizeDelta = new Vector2(num3 - 28f, num6);
				num4 += num6 + 8f;
			}
			if (grupo.Habitantes)
			{
				num4 = LinhaDeHabitantes(val, grupo, num4, num3) + 8f;
			}
			for (int num7 = 0; num7 < tipos.Count; num7++)
			{
				int num8 = num7 % num;
				int num9 = num7 / num;
				Linha(val, tipos[num7], 14f + (float)num8 * (num2 + 14f), num4 + (float)num9 * 34f, num2);
			}
			num4 += Mathf.Ceil((float)tipos.Count / (float)num) * 34f + 10f;
			float num10 = 14f;
			num10 += BotaoDeTexto(lista, num10, num4, 0f, 30f, "$vc_ui_only_group", 14, delegate
			{
				SoOGrupo(grupo);
			}) + 8f;
			if (tipos.Count > 1)
			{
				BotaoDeTexto(lista, num10, num4, 0f, 30f, "$vc_ui_all_types", 14, delegate
				{
					Marcadores.Filtrar(tipos, visiveis: true);
					if (grupo.Habitantes)
					{
						Marcadores.FiltrarClasses(Habitantes.Select(((string titulo, Classe classe) h) => h.classe), visiveis: true);
					}
				});
			}
			num4 += 42f;
			lista.sizeDelta = new Vector2(num3, num4);
			Botao botao = Botoes.FirstOrDefault((Botao b) => b.Grupo == grupo);
			Rect rect = ((RectTransform)val.m_largeRoot.transform).rect;
			float width = ((Rect)(ref rect)).width;
			float num11 = Mathf.Clamp(barra.anchoredPosition.x + ((botao != null) ? (botao.Rect.anchoredPosition.x + larguraDoBotao / 2f) : (barra.sizeDelta.x / 2f)) - num3 / 2f, 12f, Mathf.Max(12f, width - 12f - num3));
			lista.anchoredPosition = new Vector2(num11, baixoDaBarra + barra.sizeDelta.y + 10f);
		}

		private static float LinhaDeHabitantes(Minimap mapa, GrupoDaBarra grupo, float y, float largura)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: 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_0221: Unknown result type (might be due to invalid IL or missing references)
			Text val = Interface.Texto((Transform)(object)lista, Localization.instance.Localize("$vc_ui_inhabitants") + ":", 14f, y, 0f, 28f, 15, Interface.CorDoTexto);
			val.resizeTextForBestFit = false;
			float num = 14f + Mathf.Ceil(val.preferredWidth) + 10f;
			((Graphic)val).rectTransform.sizeDelta = new Vector2(Mathf.Ceil(val.preferredWidth), 28f);
			(string, Classe)[] habitantes = Habitantes;
			for (int i = 0; i < habitantes.Length; i++)
			{
				(string, Classe) tuple = habitantes[i];
				string item = tuple.Item1;
				Classe classe = tuple.Item2;
				int num2 = Marcadores.Pontos.Values.Count((Marcadores.Ponto p) => GruposDaBarra.De(p.Tipo) == grupo && p.Classe == classe && !Marcadores.Filtrado(p.Tipo));
				bool flag = !Marcadores.ClasseFiltrada(classe);
				string conteudo = Localization.instance.Localize(item) + " · " + num2;
				RectTransform obj = Interface.Retangulo("Habitantes", (Transform)(object)lista, num, y, 0f, 28f);
				Image fundo = ((Component)obj).gameObject.AddComponent<Image>();
				Button val2 = ((Component)obj).gameObject.AddComponent<Button>();
				Cores(val2, fundo, flag ? ChipLigado : ChipDesligado, BotaoComMouse);
				Outline obj2 = ((Component)obj).gameObject.AddComponent<Outline>();
				((Shadow)obj2).effectColor = (flag ? BordaDoChipLigado : BordaDoChipDesligado);
				((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
				((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
				{
					Marcadores.FiltrarClasses(new Classe[1] { classe }, Marcadores.ClasseFiltrada(classe));
				});
				Text obj3 = Interface.Texto((Transform)(object)obj, conteudo, 11f, 0f, 0f, 28f, 14, flag ? Interface.CorDoTexto : TextoDoChipDesligado);
				obj3.resizeTextForBestFit = false;
				float num3 = Mathf.Ceil(obj3.preferredWidth) + 22f;
				((Graphic)obj3).rectTransform.sizeDelta = new Vector2(num3 - 22f, 28f);
				obj.sizeDelta = new Vector2(num3, 28f);
				num += num3 + 8f;
			}
			return y + 28f;
		}

		private static void Linha(Minimap mapa, Tipo tipo, float x, float y, float largura)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			RectTransform pai = Interface.Retangulo("Tipo_" + tipo.Id, (Transform)(object)lista, x, y, largura, 34f);
			bool flag = Marcadores.Filtrado(tipo);
			if (!GruposDaBarra.Fixo(tipo))
			{
				bool flag2 = Marcadores.Destacado(tipo);
				RectTransform val = Interface.Retangulo("Estrela", (Transform)(object)pai, 0f, 2f, 30f, 30f);
				Interface.Clicavel(val, delegate
				{
					Marcadores.Destacar(tipo, !Marcadores.Destacado(tipo));
				});
				Interface.Imagem("Figura", (Transform)(object)val, 5f, 5f, 20f, Icones.Figura("estrela"), flag2 ? Ouro : EstrelaApagada);
			}
			RectTransform val2 = Interface.Retangulo("Nome", (Transform)(object)pai, 34f, 0f, largura - 34f, 34f);
			Interface.Clicavel(val2, delegate
			{
				Marcadores.Filtrar(new Tipo[1] { tipo }, Marcadores.Filtrado(tipo));
			});
			Icone(Interface.Imagem("Icone", (Transform)(object)val2, 2f, 3f, 28f, Icones.Obter(tipo), flag ? IconeOculto : Color.white));
			Interface.Texto((Transform)(object)val2, Localization.instance.Localize(tipo.NomeNoFiltro), 36f, 0f, largura - 34f - 36f - 46f, 34f, 16, flag ? NomeOculto : Interface.CorDoTexto);
			Interface.Texto((Transform)(object)val2, QuantosNaLista(mapa, tipo).ToString(), largura - 34f - 44f, 0f, 40f, 34f, 14, Apagado).alignment = (TextAnchor)5;
		}

		private static void Icone(Image imagem)
		{
			imagem.preserveAspect = true;
			((Behaviour)imagem).enabled = (Object)(object)imagem.sprite != (Object)null;
		}

		private static void SoOGrupo(GrupoDaBarra grupo)
		{
			Plugin.GruposOcultos.Value = string.Join(",", from g in GruposDaBarra.Todos
				where g != grupo
				select g.Id);
		}

		private static float BotaoDeTexto(RectTransform pai, float x, float y, float largura, float altura, string token, int tamanho, Action acao)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Interface.Retangulo("Botao", (Transform)(object)pai, x, y, largura, altura);
			Image fundo = ((Component)val).gameObject.AddComponent<Image>();
			Button val2 = ((Component)val).gameObject.AddComponent<Button>();
			Cores(val2, fundo, FundoDoBotao, BotaoComMouse);
			Outline obj = ((Component)val).gameObject.AddComponent<Outline>();
			((Shadow)obj).effectColor = BordaDoBotao;
			((Shadow)obj).effectDistance = new Vector2(1f, -1f);
			((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
			{
				acao();
			});
			string conteudo = (token.StartsWith("$") ? Localization.instance.Localize(token) : token);
			Text val3 = Interface.Texto((Transform)(object)val, conteudo, 0f, 0f, largura, altura, tamanho, Interface.CorDoTexto, negrito: true);
			val3.alignment = (TextAnchor)4;
			if (largura <= 0f)
			{
				val3.resizeTextForBestFit = false;
				largura = Mathf.Ceil(val3.preferredWidth) + 24f;
				val.sizeDelta = new Vector2(largura, altura);
				((Graphic)val3).rectTransform.sizeDelta = new Vector2(largura, altura);
			}
			return largura;
		}

		private static void Cores(Button botao, Image fundo, Color normal, Color comMouse)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0023: 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_003e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			((Graphic)fundo).color = Color.white;
			ColorBlock defaultColorBlock = ColorBlock.defaultColorBlock;
			((ColorBlock)(ref defaultColorBlock)).normalColor = normal;
			((ColorBlock)(ref defaultColorBlock)).selectedColor = normal;
			((ColorBlock)(ref defaultColorBlock)).highlightedColor = comMouse;
			((ColorBlock)(ref defaultColorBlock)).pressedColor = comMouse;
			((ColorBlock)(ref defaultColorBlock)).fadeDuration = 0f;
			((Selectable)botao).colors = defaultColorBlock;
			((Selectable)botao).targetGraphic = (Graphic)(object)fundo;
			Navigation navigation = default(Navigation);
			((Navigation)(ref navigation)).mode = (Mode)0;
			((Selectable)botao).navigation = navigation;
			((Graphic)fundo).canvasRenderer.SetColor(normal);
			ButtonClickedEvent onClick = botao.onClick;
			object obj = <>O.<3>__Desselecionar;
			if (obj == null)
			{
				UnityAction val = Interface.Desselecionar;
				<>O.<3>__Desselecionar = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		private static void Destruir()
		{
			FecharLista();
			DicaDoMapa.EsconderDaBarra();
			if ((Object)(object)barra != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)barra).gameObject);
			}
			barra = null;
			Botoes.Clear();
		}

		private static void Esquecer()
		{
			barra = null;
			lista = null;
			grupoDaLista = null;
			mapaDaBarra = null;
			Botoes.Clear();
		}
	}
	internal static class Camas
	{
		internal const int ConfortoDaBase = 4;

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

		private static HashSet<int> hashes;

		private static readonly List<Piece> Pecas = new List<Piece>();

		private static readonly Dictionary<string, int> MelhorPorGrupo = new Dictionary<string, int>();

		internal static HashSet<int> Hashes
		{
			get
			{
				if (hashes == null && (Object)(object)ZNetScene.instance != (Object)null)
				{
					hashes = new HashSet<int>();
					foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
					{
						if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent<Bed>() != (Object)null)
						{
							hashes.Add(StringExtensionMethods.GetStableHashCode(((Object)prefab).name));
						}
					}
				}
				return hashes ?? Vazio;
			}
		}

		internal static int Conforto(Vector3 posicao)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected I4, but got Unknown
			float num = default(float);
			bool flag = default(bool);
			Cover.GetCoverForPoint(posicao + Vector3.up, ref num, ref flag, 0.5f);
			if (num < 0.8f || !flag)
			{
				return 1;
			}
			Pecas.Clear();
			MelhorPorGrupo.Clear();
			Piece.GetAllComfortPiecesInRadius(posicao, 10f, Pecas);
			foreach (Piece peca in Pecas)
			{
				string key = (((int)peca.m_comfortGroup != 0) ? ("g" + (int)peca.m_comfortGroup) : ("n" + peca.m_name));
				if (!MelhorPorGrupo.TryGetValue(key, out var value) || peca.m_comfort > value)
				{
					MelhorPorGrupo[key] = peca.m_comfort;
				}
			}
			int num2 = 2;
			foreach (int value2 in MelhorPorGrupo.Values)
			{
				num2 += value2;
			}
			return num2;
		}
	}
	internal static class Captura
	{
		private const int Largura = 480;

		private const float Validade = 1f;

		private static RenderTexture alvo;

		private static CommandBuffer comando;

		private static Camera cameraAnexada;

		private static int quadroDoPedido = -1;

		private static bool lendo;

		private static Color32[] pixels;

		private static int largura;

		private static int altura;

		private static float quando = -10f;

		internal static bool Disponivel
		{
			get
			{
				if (pixels != null)
				{
					return Time.time - quando <= 1f;
				}
				return false;
			}
		}

		internal static void Pedir(Camera camera)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0090: 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_00a5: Expected O, but got Unknown
			//IL_00ab: 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)
			if (quadroDoPedido >= 0 || lendo || (Object)(object)camera == (Object)null || !SystemInfo.supportsAsyncGPUReadback)
			{
				return;
			}
			int num = Mathf.Max(1, Mathf.RoundToInt(480f * (float)camera.pixelHeight / (float)camera.pixelWidth));
			if ((Object)(object)alvo == (Object)null || ((Texture)alvo).height != num)
			{
				if ((Object)(object)alvo != (Object)null)
				{
					alvo.Release();
				}
				alvo = new RenderTexture(480, num, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2);
				alvo.Create();
				comando = new CommandBuffer
				{
					name = "Shared Map and Auto Discover capture"
				};
				comando.Blit(RenderTargetIdentifier.op_Implicit((BuiltinRenderTextureType)1), RenderTargetIdentifier.op_Implicit((Texture)(object)alvo));
			}
			camera.AddCommandBuffer((CameraEvent)20, comando);
			cameraAnexada = camera;
			quadroDoPedido = Time.frameCount;
		}

		internal static void Atualizar()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (quadroDoPedido >= 0 && Time.frameCount > quadroDoPedido)
			{
				if ((Object)(object)cameraAnexada != (Object)null)
				{
					cameraAnexada.RemoveCommandBuffer((CameraEvent)20, comando);
				}
				quadroDoPedido = -1;
				lendo = true;
				AsyncGPUReadback.Request((Texture)(object)alvo, 0, (TextureFormat)4, (Action<AsyncGPUReadbackRequest>)AoLer);
			}
		}

		private static void AoLer(AsyncGPUReadbackRequest pedido)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			lendo = false;
			if (!((AsyncGPUReadbackRequest)(ref pedido)).hasError)
			{
				pixels = ((AsyncGPUReadbackRequest)(ref pedido)).GetData<Color32>(0).ToArray();
				largura = ((AsyncGPUReadbackRequest)(ref pedido)).width;
				altura = ((AsyncGPUReadbackRequest)(ref pedido)).height;
				quando = Time.time;
			}
		}

		internal static bool Cor(Camera camera, Vector2 tela, out Vector3 lab)
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			lab = Vector3.zero;
			if (!Disponivel)
			{
				return false;
			}
			int num = Mathf.RoundToInt(tela.x / (float)camera.pixelWidth * (float)largura);
			int num2 = Mathf.RoundToInt(tela.y / (float)camera.pixelHeight * (float)altura);
			if (Plugin.CapturaInvertida.Value)
			{
				num2 = altura - 1 - num2;
			}
			if (num < 1 || num2 < 1 || num >= largura - 1 || num2 >= altura - 1)
			{
				return false;
			}
			Vector3 val = Vector3.zero;
			for (int i = -1; i <= 1; i++)
			{
				for (int j = -1; j <= 1; j++)
				{
					Color32 val2 = pixels[(num2 + i) * largura + num + j];
					val += new Vector3((float)(int)val2.r, (float)(int)val2.g, (float)(int)val2.b);
				}
			}
			lab = Lab(val / 9f);
			return true;
		}

		private static Vector3 Lab(Vector3 rgb)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			float num = Linear(rgb.x / 255f);
			float num2 = Linear(rgb.y / 255f);
			float num3 = Linear(rgb.z / 255f);
			float t = (0.4124f * num + 0.3576f * num2 + 0.1805f * num3) / 0.95047f;
			float t2 = 0.2126f * num + 0.7152f * num2 + 0.0722f * num3;
			float t3 = (0.0193f * num + 0.1192f * num2 + 0.9505f * num3) / 1.08883f;
			float num4 = F(t);
			float num5 = F(t2);
			float num6 = F(t3);
			return new Vector3(116f * num5 - 16f, 500f * (num4 - num5), 200f * (num5 - num6));
		}

		private static float Linear(float c)
		{
			if (!(c <= 0.04045f))
			{
				return Mathf.Pow((c + 0.055f) / 1.055f, 2.4f);
			}
			return c / 12.92f;
		}

		private static float F(float t)
		{
			if (!(t > 0.008856f))
			{
				return 7.787f * t + 0.13793103f;
			}
			return Mathf.Pow(t, 1f / 3f);
		}

		internal static string Gravar()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (pixels == null)
			{
				return null;
			}
			Texture2D val = new Texture2D(largura, altura, (TextureFormat)4, false);
			val.SetPixels32(pixels);
			val.Apply();
			string text = Path.Combine(Paths.ConfigPath, "SharedMapAndAutoDiscover");
			Directory.CreateDirectory(text);
			string text2 = Path.Combine(text, "capture.png");
			File.WriteAllBytes(text2, ImageConversion.EncodeToPNG(val));
			Object.Destroy((Object)(object)val);
			return text2;
		}
	}
	internal enum Gatilho
	{
		Mira,
		Visao,
		Nenhum
	}
	internal enum Grupo
	{
		Minerios,
		Masmorras,
		Estruturas,
		Coleta,
		Chefes,
		Spawns,
		Jogadores,
		DoJogo
	}
	internal enum Classe : byte
	{
		Nenhuma,
		Inimigos,
		Neutros,
		Vazio
	}
	internal enum CondicaoDoResto
	{
		Existir,
		NaoColhido,
		BauComItens
	}
	internal sealed class Tipo
	{
		internal readonly string Id;

		internal readonly string Rotulo;

		internal readonly string ItemDoIcone;

		internal readonly Gatilho Gatilho;

		internal readonly float Raio;

		internal readonly string[] Restos;

		internal readonly CondicaoDoResto Condicao;

		internal Grupo Grupo;

		internal string NomeNoFiltro;

		internal Classe ClassePadrao;

		internal bool Pseudo => Gatilho == Gatilho.Nenhum;

		internal bool TemClasse
		{
			get
			{
				if (Grupo != Grupo.Estruturas)
				{
					return Grupo == Grupo.Masmorras;
				}
				return true;
			}
		}

		internal Tipo(string id, string rotulo, string itemDoIcone, Gatilho gatilho, float raio, string[] restos = null, CondicaoDoResto condicao = CondicaoDoResto.Existir)
		{
			Id = id;
			Rotulo = rotulo;
			ItemDoIcone = itemDoIcone;
			Gatilho = gatilho;
			Raio = raio;
			Restos = restos;
			Condicao = condicao;
			NomeNoFiltro = rotulo;
		}
	}
	internal static class Catalogo
	{
		internal static readonly Dictionary<string, Tipo> PorId;

		internal static readonly List<Tipo> Lista;

		internal static readonly Dictionary<int, Tipo> PorObjeto;

		internal static readonly Dictionary<string, Tipo> PorLocal;

		internal static Tipo Base;

		internal static Tipo Portal;

		internal static Tipo Comerciante;

		internal static Tipo PinosDeMissao;

		internal static Tipo Tecido;

		internal static readonly HashSet<int> PartesDeGigante;

		internal const float DistanciaDoCerebro = 25f;

		internal const float FolgaDosRestos = 10f;

		internal static readonly (string antigo, string novo)[] Migracoes;

		internal const float DistanciaDaMigracao = 2f;

		private static readonly Dictionary<string, HashSet<int>> RestosPorTipo;

		private static HashSet<int> restosDeLocais;

		private static readonly HashSet<int> Nenhum;

		private static Grupo grupoAtual;

		internal static readonly Dictionary<string, Classe> ClassePorLocal;

		private static readonly Dictionary<string, Classe> ClassesPadrao;

		internal static bool Migra(string antigo, string novo)
		{
			return Array.IndexOf<(string, string)>(Migracoes, (antigo, novo)) >= 0;
		}

		private static Tipo Novo(string id, string rotulo, string item, Gatilho gatilho, float raio, string[] restos = null, CondicaoDoResto condicao = CondicaoDoResto.Existir)
		{
			Tipo tipo = new Tipo(id, rotulo, item, gatilho, raio, restos, condicao)
			{
				Grupo = grupoAtual
			};
			PorId[id] = tipo;
			Lista.Add(tipo);
			return tipo;
		}

		private static void Objetos(Tipo tipo, params string[] prefabs)
		{
			foreach (string text in prefabs)
			{
				PorObjeto[StringExtensionMethods.GetStableHashCode(text)] = tipo;
			}
		}

		private static void Locais(Tipo tipo, params string[] prefabs)
		{
			foreach (string key in prefabs)
			{
				PorLocal[key] = tipo;
			}
		}

		private static string[] Numerados(string prefixo, int de, int ate, string sufixo = "")
		{
			string[] array = new string[ate - de + 1];
			for (int i = de; i <= ate; i++)
			{
				array[i - de] = prefixo + i + sufixo;
			}
			return array;
		}

		private static void Minerio(string id, string rotulo, string item, float raio, params string[] prefabs)
		{
			Objetos(Novo(id, rotulo, item, Gatilho.Mira, raio, prefabs), prefabs);
		}

		private static Tipo Spawn(string id, string rotulo, string item, params string[] prefabs)
		{
			Tipo tipo = Novo(id, rotulo, item, Gatilho.Visao, 15f, prefabs);
			Objetos(tipo, prefabs);
			return tipo;
		}

		private static void Local(string id, string rotulo, string item, params string[] prefabs)
		{
			Locais(Novo(id, rotulo, item, Gatilho.Visao, 20f), prefabs);
		}

		private static void LocalComRestos(string id, string rotulo, string item, string[] restos, CondicaoDoResto condicao, params string[] prefabs)
		{
			Locais(Novo(id, rotulo, item, Gatilho.Visao, 20f, restos, condicao), prefabs);
		}

		private static void Chefe(string id, string inimigo, string item, string prefab)
		{
			Local(id, "$vc_boss " + inimigo, item, prefab);
			PorId[id].NomeNoFiltro = inimigo;
		}

		private static Tipo Pseudo(string id, string nome)
		{
			return Novo(id, nome, null, Gatilho.Nenhum, 0f);
		}

		internal static HashSet<int> Restos(Tipo tipo)
		{
			if (tipo.Restos == null || (Object)(object)ZNetScene.instance == (Object)null)
			{
				return null;
			}
			if (!RestosPorTipo.TryGetValue(tipo.Id, out var value))
			{
				value = new HashSet<int>();
				string[] restos = tipo.Restos;
				foreach (string text in restos)
				{
					if ((Object)(object)ZNetScene.instance.GetPrefab(text) != (Object)null)
					{
						value.Add(StringExtensionMethods.GetStableHashCode(text));
						continue;
					}
					Plugin.Log.LogWarning((object)("Tipo " + tipo.Id + ": prefab " + text + " não existe no jogo"));
				}
				RestosPorTipo[tipo.Id] = value;
			}
			if (value.Count <= 0)
			{
				return null;
			}
			return value;
		}

		internal static HashSet<int> RestosDeLocais()
		{
			if (restosDeLocais == null && (Object)(object)ZNetScene.instance != (Object)null)
			{
				restosDeLocais = new HashSet<int>();
				foreach (Tipo item in PorLocal.Values.Distinct())
				{
					HashSet<int> hashSet = Restos(item);
					if (hashSet != null)
					{
						restosDeLocais.UnionWith(hashSet);
					}
				}
			}
			return restosDeLocais ?? Nenhum;
		}

		internal static void EsquecerRestos()
		{
			RestosPorTipo.Clear();
			restosDeLocais = null;
		}

		internal static bool Vivo(Tipo tipo, ZDO zdo)
		{
			switch (tipo.Condicao)
			{
			case CondicaoDoResto.NaoColhido:
				return !zdo.GetBool(ZDOVars.s_picked, false);
			case CondicaoDoResto.BauComItens:
				if (zdo.GetBool(ZDOVars.s_addedDefaultItems, false))
				{
					return ItensNoBau(zdo) > 0;
				}
				return true;
			default:
				return true;
			}
		}

		private static int ItensNoBau(ZDO zdo)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			byte[] byteArray = zdo.GetByteArray(ZDOVars.s_items, (byte[])null);
			if (byteArray == null || byteArray.Length < 4)
			{
				return 0;
			}
			try
			{
				ZPackage val = new ZPackage(byteArray);
				return (val.ReadInt() >= 108) ? val.ReadUShort() : val.ReadInt();
			}
			catch (Exception)
			{
				return 1;
			}
		}

		internal static Classe ClasseDe(Tipo tipo, string prefabDoLocal)
		{
			if (!tipo.TemClasse)
			{
				return Classe.Nenhuma;
			}
			if (prefabDoLocal == null || !PorLocal.TryGetValue(prefabDoLocal, out var value) || value != tipo || !ClassePorLocal.TryGetValue(prefabDoLocal, out var value2))
			{
				return tipo.ClassePadrao;
			}
			return value2;
		}

		static Catalogo()
		{
			PorId = new Dictionary<string, Tipo>();
			Lista = new List<Tipo>();
			PorObjeto = new Dictionary<int, Tipo>();
			PorLocal = new Dictionary<string, Tipo>();
			PartesDeGigante = new HashSet<int>();
			Migracoes = new(string, string)[5]
			{
				("torre", "dvergr"),
				("ruina", "dvergr"),
				("escavacao", "dvergr"),
				("pedras", "memorial"),
				("vila", "casa")
			};
			RestosPorTipo = new Dictionary<string, HashSet<int>>();
			Nenhum = new HashSet<int>();
			ClassePorLocal = new Dictionary<string, Classe>
			{
				["Mistlands_Swords1"] = Classe.Vazio,
				["Mistlands_Swords2"] = Classe.Vazio,
				["Mistlands_Swords3"] = Classe.Vazio,
				["Mistlands_Giant1"] = Classe.Inimigos,
				["DN_gammeltrollFrac01"] = Classe.Vazio,
				["DN_gammeltrollFrac02"] = Classe.Vazio,
				["Crypt2"] = Classe.Inimigos,
				["Crypt3"] = Classe.Inimigos,
				["Crypt4"] = Classe.Inimigos,
				["SunkenCrypt4"] = Classe.Inimigos,
				["TrollCave02"] = Classe.Inimigos,
				["BearCave"] = Classe.Inimigos,
				["MountainCave01"] = Classe.Inimigos,
				["MountainCave02"] = Classe.Inimigos,
				["Mistlands_DvergrTownEntrance1"] = Classe.Inimigos,
				["Mistlands_DvergrTownEntrance2"] = Classe.Inimigos,
				["Mistlands_DvergrBossEntrance1"] = Classe.Inimigos,
				["MorgenHole1"] = Classe.Inimigos,
				["MorgenHole2"] = Classe.Inimigos,
				["MorgenHole3"] = Classe.Inimigos,
				["MorkBorg"] = Classe.Inimigos,
				["TheHole01"] = Classe.Inimigos,
				["Hildir_crypt"] = Classe.Inimigos,
				["Hildir_cave"] = Classe.Inimigos,
				["Hildir_plainsfortress"] = Classe.Inimigos,
				["StoneHouse3"] = Classe.Inimigos,
				["StoneHouse4"] = Classe.Inimigos,
				["DN_hut01"] = Classe.Vazio,
				["LumberCamp"] = Classe.Vazio,
				["AbandonedLogCabin02"] = Classe.Inimigos,
				["AbandonedLogCabin03"] = Classe.Inimigos,
				["AbandonedLogCabin04"] = Classe.Inimigos,
				["WoodHouse1"] = Classe.Vazio,
				["WoodHouse2"] = Classe.Vazio,
				["WoodHouse3"] = Classe.Vazio,
				["WoodHouse4"] = Classe.Vazio,
				["WoodHouse5"] = Classe.Vazio,
				["WoodHouse6"] = Classe.Vazio,
				["WoodHouse7"] = Classe.Vazio,
				["WoodHouse8"] = Classe.Vazio,
				["WoodHouse9"] = Classe.Vazio,
				["WoodHouse10"] = Classe.Vazio,
				["WoodHouse11"] = Classe.Vazio,
				["WoodHouse12"] = Classe.Vazio,
				["WoodHouse13"] = Classe.Vazio,
				["SwampHut1"] = Classe.Vazio,
				["SwampHut2"] = Classe.Vazio,
				["SwampHut3"] = Classe.Vazio,
				["SwampHut4"] = Classe.Inimigos,
				["SwampHut5"] = Classe.Vazio,
				["SwampHut1_1"] = Classe.Vazio,
				["SwampHut2_1"] = Classe.Vazio,
				["SwampHut3_1"] = Classe.Vazio,
				["StoneTowerRuins03"] = Classe.Inimigos,
				["StoneTowerRuins04"] = Classe.Inimigos,
				["StoneTowerRuins05"] = Classe.Inimigos,
				["StoneTowerRuins07"] = Classe.Inimigos,
				["StoneTowerRuins08"] = Classe.Inimigos,
				["StoneTowerRuins09"] = Classe.Inimigos,
				["StoneTowerRuins10"] = Classe.Inimigos,
				["StoneTower1"] = Classe.Inimigos,
				["StoneTower3"] = Classe.Inimigos,
				["CharredTowerRuins1"] = Classe.Vazio,
				["CharredTowerRuins2"] = Classe.Vazio,
				["CharredTowerRuins3"] = Classe.Inimigos,
				["Mistlands_GuardTower1_ruined_new"] = Classe.Inimigos,
				["Mistlands_GuardTower1_ruined_new2"] = Classe.Inimigos,
				["Mistlands_GuardTower3_ruined_new"] = Classe.Inimigos,
				["StoneTowerRuins07_sunk"] = Classe.Vazio,
				["StoneTowerRuins08_sunk"] = Classe.Vazio,
				["StoneTowerRuins09_sunk"] = Classe.Vazio,
				["StoneTowerRuins10_sunk"] = Classe.Vazio,
				["StoneTowerRuins05_leet"] = Classe.Inimigos,
				["CombatRuin01"] = Classe.Inimigos,
				["Ruin1"] = Classe.Inimigos,
				["Ruin2"] = Classe.Inimigos,
				["Ruin3"] = Classe.Inimigos,
				["SwampRuin1"] = Classe.Inimigos,
				["SwampRuin2"] = Classe.Inimigos,
				["AshlandRuins"] = Classe.Inimigos,
				["CharredRuins1"] = Classe.Vazio,
				["CharredRuins2"] = Classe.Vazio,
				["CharredRuins3"] = Classe.Vazio,
				["CharredRuins4"] = Classe.Vazio,
				["FortressRuins"] = Classe.Inimigos,
				["WoodVillage1"] = Classe.Inimigos,
				["WoodVillage2"] = Classe.Inimigos,
				["WoodFarm1"] = Classe.Inimigos,
				["NorthVillage"] = Classe.Inimigos,
				["GoblinCamp2"] = Classe.Inimigos,
				["GoblinCamp2_1"] = Classe.Inimigos,
				["GoblinHut01"] = Classe.Inimigos,
				["GoblinHut02"] = Classe.Inimigos,
				["GoblinHut03"] = Classe.Inimigos,
				["Mistlands_GuardTower1_new"] = Classe.Neutros,
				["Mistlands_GuardTower2_new"] = Classe.Neutros,
				["Mistlands_GuardTower3_new"] = Classe.Neutros,
				["Mistlands_Lighthouse1_new"] = Classe.Neutros,
				["Mistlands_Harbour1"] = Classe.Neutros,
				["Mistlands_Excavation1"] = Classe.Neutros,
				["Mistlands_Excavation2"] = Classe.Neutros,
				["CharredTowerRuins1_dvergr"] = Classe.Neutros,
				["Greydwarf_camp1"] = Classe.Inimigos,
				["StoneCircle"] = Classe.Vazio,
				["Dolmen01"] = Classe.Inimigos,
				["Dolmen02"] = Classe.Inimigos,
				["Dolmen03"] = Classe.Inimigos,
				["ShipSetting01"] = Classe.Inimigos,
				["ShipSetting02"] = Classe.Vazio,
				["ShipSetting03"] = Classe.Vazio,
				["StoneHenge1"] = Classe.Inimigos,
				["StoneHenge2"] = Classe.Inimigos,
				["StoneHenge3"] = Classe.Inimigos,
				["StoneHenge4"] = Classe.Inimigos,
				["StoneHenge5"] = Classe.Inimigos,
				["StoneHenge6"] = Classe.Vazio,
				["NorthMemorialPlace"] = Classe.Vazio,
				["SwampWell1"] = Classe.Inimigos,
				["MountainWell1"] = Classe.Vazio,
				["Mistlands_Excavation3"] = Classe.Inimigos,
				["Mistlands_RockSpire1"] = Classe.Inimigos,
				["CharredFortress"] = Classe.Inimigos,
				["ShipWreck01"] = Classe.Vazio,
				["ShipWreck02"] = Classe.Vazio,
				["ShipWreck03"] = Classe.Vazio,
				["ShipWreck04"] = Classe.Vazio,
				["ShipWreck01_DN"] = Classe.Vazio,
				["ShipWreck02_DN"] = Classe.Vazio,
				["FrozenShip01_DN"] = Classe.Vazio,
				["FrozenShip02_DN"] = Classe.Vazio,
				["FrozenShip03_DN"] = Classe.Vazio,
				["Runestone_Boars"] = Classe.Inimigos,
				["Runestone_Meadows"] = Classe.Vazio,
				["Runestone_BlackForest"] = Classe.Vazio,
				["Runestone_Greydwarfs"] = Classe.Vazio,
				["Runestone_Draugr"] = Classe.Inimigos,
				["Runestone_Swamps"] = Classe.Vazio,
				["Runestone_Mountains"] = Classe.Vazio,
				["Runestone_Plains"] = Classe.Vazio,
				["Runestone_Ashlands"] = Classe.Vazio,
				["Runestone_DeepNorth"] = Classe.Vazio,
				["Runestone_Mistlands"] = Classe.Vazio,
				["DrakeLorestone"] = Classe.Vazio,
				["PlaceofMystery1"] = Classe.Inimigos,
				["PlaceofMystery2"] = Classe.Inimigos,
				["PlaceofMystery3"] = Classe.Inimigos,
				["DrakeNest01"] = Classe.Inimigos,
				["VoltureNest"] = Classe.Inimigos,
				["SulfurArch"] = Classe.Vazio,
				["InfestedTree01"] = Classe.Vazio,
				["TarPit1"] = Classe.Inimigos,
				["TarPit2"] = Classe.Inimigos,
				["TarPit3"] = Classe.Inimigos,
				["TarPit1_1"] = Classe.Inimigos,
				["TarPit2_1"] = Classe.Inimigos,
				["TarPit3_1"] = Classe.Inimigos,
				["Mistlands_Viaduct1"] = Classe.Vazio,
				["Mistlands_Viaduct2"] = Classe.Vazio,
				["Eikthyrnir"] = Classe.Nenhuma,
				["GDKing"] = Classe.Nenhuma,
				["Bonemass"] = Classe.Nenhuma,
				["Dragonqueen"] = Classe.Nenhuma,
				["GoblinKing"] = Classe.Nenhuma,
				["FaderLocation"] = Classe.Nenhuma,
				["DN_Bossroom"] = Classe.Nenhuma,
				["Grave1"] = Classe.Inimigos,
				["FireHole"] = Classe.Inimigos,
				["CharredStone_Spawner"] = Classe.Inimigos
			};
			ClassesPadrao = new Dictionary<string, Classe>
			{
				["sucata"] = Classe.Vazio,
				["tecido"] = Classe.Inimigos,
				["gammeltroll"] = Classe.Vazio,
				["cripta"] = Classe.Inimigos,
				["cripta_afundada"] = Classe.Inimigos,
				["caverna_troll"] = Classe.Inimigos,
				["caverna_urso"] = Classe.Inimigos,
				["caverna_gelo"] = Classe.Inimigos,
				["mina"] = Classe.Inimigos,
				["cidadela"] = Classe.Inimigos,
				["buraco"] = Classe.Inimigos,
				["morkhalla"] = Classe.Inimigos,
				["tuneis"] = Classe.Inimigos,
				["hildir_tumba"] = Classe.Inimigos,
				["hildir_caverna"] = Classe.Inimigos,
				["hildir_torre"] = Classe.Inimigos,
				["casa"] = Classe.Inimigos,
				["torre"] = Classe.Inimigos,
				["ruina"] = Classe.Inimigos,
				["vila"] = Classe.Inimigos,
				["fuling"] = Classe.Inimigos,
				["cabana"] = Classe.Inimigos,
				["dvergr"] = Classe.Neutros,
				["acampamento"] = Classe.Inimigos,
				["pedras"] = Classe.Inimigos,
				["memorial"] = Classe.Vazio,
				["poco"] = Classe.Inimigos,
				["escavacao"] = Classe.Inimigos,
				["pinaculo"] = Classe.Inimigos,
				["fortaleza"] = Classe.Inimigos,
				["naufragio"] = Classe.Vazio,
				["runa"] = Classe.Vazio,
				["misterio"] = Classe.Inimigos,
				["ovos"] = Classe.Inimigos,
				["ninho"] = Classe.Inimigos,
				["enxofre"] = Classe.Vazio,
				["gosma"] = Classe.Vazio,
				["piche"] = Classe.Inimigos,
				["ponte"] = Classe.Vazio,
				["chefe_eikthyr"] = Classe.Nenhuma,
				["chefe_anciao"] = Classe.Nenhuma,
				["chefe_massa"] = Classe.Nenhuma,
				["chefe_moder"] = Classe.Nenhuma,
				["chefe_yagluth"] = Classe.Nenhuma,
				["chefe_fader"] = Classe.Nenhuma,
				["chefe_kall"] = Classe.Nenhuma,
				["draugr"] = Classe.Inimigos,
				["surtling"] = Classe.Inimigos,
				["carbonizado"] = Classe.Inimigos
			};
			grupoAtual = Grupo.Minerios;
			Minerio("cobre", "$vc_copper", "CopperOre", 15f, "rock4_copper", "rock4_copper_frac");
			Minerio("estanho", "$vc_tin", "TinOre", 30f, "MineRock_Tin");
			Minerio("prata", "$vc_silver", "SilverOre", 15f, "silvervein", "silvervein_frac", "rock3_silver", "rock3_silver_frac");
			Minerio("obsidiana", "$vc_obsidian", "Obsidian", 30f, "MineRock_Obsidian");
			Minerio("ferro", "$vc_iron", "IronScrap", 15f, "mudpile_beacon", "mudpile", "mudpile_frac", "mudpile2", "mudpile2_frac", "mudpile_old");
			string[] array = new string[4] { "giant_ribs", "giant_ribs_frac", "giant_skull", "giant_skull_frac" };
			string[] array2 = new string[8] { "giant_helmet1", "giant_helmet1_destruction", "giant_helmet2", "giant_helmet2_destruction", "giant_sword1", "giant_sword1_destruction", "giant_sword2", "giant_sword2_destruction" };
			Minerio("marmore", "$vc_marble", "BlackMarble", 15f, array);
			Minerio("sucata", "$vc_scrap", "CopperScrap", 15f, array2);
			Minerio("tecido", "$vc_tissue", "Softtissue", 15f, "giant_brain", "giant_brain_frac");
			Minerio("flametal", "$vc_flametal", "FlametalOreNew", 20f, "MineRock_Meteorite", "LeviathanLava");
			Minerio("gammeltroll", "$vc_gammeltroll", "GoldOre", 15f, "goldvein", "goldvein_frac", "TrollFrost_Frac", "TrollFrost_Frac_arm", "TrollFrost_Frac_legs");
			Tecido = PorId["tecido"];
			Locais(Tecido, "Mistlands_Giant1");
			Locais(PorId["sucata"], "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3");
			Locais(PorId["gammeltroll"], "DN_gammeltrollFrac01", "DN_gammeltrollFrac02");
			foreach (string item in array.Concat(array2))
			{
				PartesDeGigante.Add(StringExtensionMethods.GetStableHashCode(item));
			}
			grupoAtual = Grupo.Masmorras;
			Local("cripta", "$vc_crypt", null, "Crypt2", "Crypt3", "Crypt4");
			Local("cripta_afundada", "$vc_crypt", null, "SunkenCrypt4");
			Local("caverna_troll", "$vc_cave", null, "TrollCave02");
			Local("caverna_urso", "$vc_cave", null, "BearCave");
			Local("caverna_gelo", "$vc_cave", null, "MountainCave01", "MountainCave02");
			PorId["cripta"].NomeNoFiltro = "$location_forestcrypt";
			PorId["cripta_afundada"].NomeNoFiltro = "$location_sunkencrypt";
			PorId["caverna_troll"].NomeNoFiltro = "$location_forestcave";
			PorId["caverna_urso"].NomeNoFiltro = "$location_bearcave";
			PorId["caverna_gelo"].NomeNoFiltro = "$location_mountaincave";
			Local("mina", "$vc_mine", null, "Mistlands_DvergrTownEntrance1", "Mistlands_DvergrTownEntrance2");
			Local("cidadela", "$vc_citadel", null, "Mistlands_DvergrBossEntrance1");
			Local("buraco", "$vc_hole", null, Numerados("MorgenHole", 1, 3));
			Local("morkhalla", "$vc_morkhalla", null, "MorkBorg");
			Local("tuneis", "$vc_tunnels", null, "TheHole01");
			Local("hildir_tumba", "$npc_hildir", "chest_hildir1", "Hildir_crypt");
			Local("hildir_caverna", "$npc_hildir", "chest_hildir2", "Hildir_cave");
			Local("hildir_torre", "$npc_hildir", "chest_hildir3", "Hildir_plainsfortress");
			PorId["hildir_tumba"].NomeNoFiltro = "$hud_pin_hildir1";
			PorId["hildir_caverna"].NomeNoFiltro = "$hud_pin_hildir2";
			Po