Decompiled source of Rune Tablet v1.0.0

RuneTablet/RuneTablet.dll

Decompiled 19 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("RuneTablet")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0065c1fd621cb5cccb51b6c443abd87c2d516272")]
[assembly: AssemblyProduct("Make a rune tablet to locate dungeons")]
[assembly: AssemblyTitle("RuneTablet")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 RuneTablet
{
	public static class Helper
	{
		public static Sprite GetSprite(string fileName)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(fileName);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(1, 1);
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}

		public static string GetHashedName(MonoBehaviour component)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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)
			Vector3 position = ((Component)component).transform.position;
			int num = (int)position.x * 31 + (int)position.z * 37;
			return ((Object)component).name + "-" + num;
		}

		public static string GetPinName(string locationName)
		{
			if (1 == 0)
			{
			}
			string result;
			switch (locationName)
			{
			case "Crypt2":
			case "Crypt3":
			case "Crypt4":
				result = "Burial Chambers";
				break;
			case "Mistlands_DvergrTownEntrance1":
			case "Mistlands_DvergrTownEntrance2":
				result = "Infested Mine";
				break;
			case "Hildir_crypt":
				result = "Smouldering Tomb";
				break;
			case "Hildir_cave":
				result = "Howling Cavern";
				break;
			case "Hildir_plainsfortress":
				result = "Sealed Tower";
				break;
			case "MountainCave02":
				result = "Frost Caves";
				break;
			case "GoblinCamp2":
				result = "Goblin Camp";
				break;
			case "SunkenCrypt4":
				result = "Sunken Crypt";
				break;
			case "StoneTower1":
			case "StoneTower3":
				result = "Stone Tower";
				break;
			default:
				result = "Dungeon";
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}
	}
	[HarmonyPatch(typeof(Player))]
	public class PlayerPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("Save")]
		public static void SavePostfix(ZPackage pkg, Player __instance)
		{
			Plugin.Logger.LogInfo((object)"Player.Save: Called");
			foreach (string foundRuneStone in Plugin.FoundRuneStones)
			{
				pkg.Write(foundRuneStone);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Load")]
		public static void LoadPostfix(ZPackage pkg, Player __instance)
		{
			Plugin.Logger.LogInfo((object)"Player.Load: Called");
			Plugin.FoundRuneStones.Clear();
			while (pkg.GetPos() < pkg.Size())
			{
				string text = pkg.ReadString();
				Plugin.FoundRuneStones.Add(text);
				Plugin.Logger.LogInfo((object)("Player.Load: Found runestone " + text));
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ConsumeItem")]
		public static bool ConsumeItemPrefix(Inventory inventory, ItemData item, ref Player __instance, ref bool __result)
		{
			if (item.m_shared.m_name != "$item_runetablet")
			{
				return true;
			}
			Plugin.Logger.LogInfo((object)"Player.ConsumeItem: Called on Rune Tablet");
			__result = RuneTablet.Consume(__instance);
			if (__result)
			{
				inventory.RemoveItem(item);
			}
			return !__result;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("org.bepinex.plugins.rune_tablet", "Rune Tablet", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string RuneTabletGuid = "org.bepinex.plugins.rune_tablet";

		public const string RuneTabletName = "Rune Tablet";

		public const string NumericVersion = "1.0.0";

		private static readonly GameVersion MinSupportedGameVersion = new GameVersion(0, 219, 10);

		private static readonly GameVersion TargetGameVersion = new GameVersion(0, 220, 3);

		public static List<string> FoundRuneStones = new List<string>();

		public static List<string> LocatedDungeons = new List<string>();

		private CustomLocalization Localization;

		private static readonly Harmony Harmony = new Harmony("mod.rune_tablet");

		public static ManualLogSource Logger { get; private set; }

		private static bool IsGameVersionTooOld()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Version.CurrentVersion < MinSupportedGameVersion;
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)("Valheim game version: " + Version.GetVersionString(false)));
			if (IsGameVersionTooOld())
			{
				LogTooOld();
				Logger.LogFatal((object)"Aborting loading of Rune Tablet due to incompatible version.");
				return;
			}
			LoadAssets();
			AddLocalization();
			PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
			Harmony.PatchAll();
			Logger.LogInfo((object)"Rune Tablet done loading.");
		}

		private void AddLocalization()
		{
			Localization = LocalizationManager.Instance.GetLocalization();
			CustomLocalization localization = Localization;
			string text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "item_runecrystal", "Rune Crystal" },
				{ "item_runecrystal_desc", "A potent source of energy from a runestone" },
				{ "item_runetablet", "Rune Tablet" },
				{ "item_runetablet_desc", "A mysterious tablet inscribed with runes glowing with energy." }
			});
		}

		private void LoadAssets()
		{
			//IL_004f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Texture2D val = AssetUtils.LoadTexture(Path.Combine(directoryName, "Assets/rune_crystal.png"), true);
			Texture2D val2 = AssetUtils.LoadTexture(Path.Combine(directoryName, "Assets/rune_tablet.png"), true);
			RuneCrystal.IconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero);
			RuneTablet.IconSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), Vector2.zero);
		}

		private void AddClonedItems()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			RuneCrystal runeCrystal = new RuneCrystal();
			RuneTablet runeTablet = new RuneTablet();
			ItemManager.Instance.AddItem((CustomItem)(object)runeCrystal);
			ItemManager.Instance.AddItem((CustomItem)(object)runeTablet);
			((CustomItem)runeTablet).ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
			PrefabManager.OnVanillaPrefabsAvailable -= AddClonedItems;
		}

		private static void LogTooOld()
		{
			//IL_0010: 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)
			Logger.LogError((object)("This version of Rune Tablet (1.0.0) expects a minimum game version of " + $"\"{MinSupportedGameVersion}\", but this game version is older at \"{Version.CurrentVersion}\". " + "Please either update the Valheim game, or use an older version of Rune Tablet."));
		}
	}
	public class RuneCrystal : CustomItem
	{
		internal static Sprite IconSprite;

		public RuneCrystal()
			: base("RuneCrystal", true, new ItemConfig
			{
				Name = "$item_runecrystal",
				Description = "$item_runecrystal_desc",
				StackSize = 10,
				Weight = 1f,
				Icon = IconSprite
			})
		{
		}//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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)
		//IL_0024: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown

	}
	[HarmonyPatch(typeof(RuneStone), "Interact")]
	public class RuneStoneInteractPatch
	{
		public static void Postfix(Humanoid character, bool hold, bool alt, RuneStone __instance)
		{
			Plugin.Logger.LogInfo((object)"RuneStone.Interact: Called");
			string hashedName = Helper.GetHashedName((MonoBehaviour)(object)__instance);
			Plugin.Logger.LogInfo((object)("RuneStone.Interact: Found runestone " + hashedName));
			if (!Plugin.FoundRuneStones.Contains(hashedName))
			{
				GameObject prefab = PrefabManager.Instance.GetPrefab("RuneCrystal");
				if (character.m_inventory.CanAddItem(prefab, -1))
				{
					((Humanoid)Player.m_localPlayer).m_inventory.AddItem(prefab, 1);
					((Character)Player.m_localPlayer).Message((MessageType)1, "A mysterious crystal falls into your hand.", 0, (Sprite)null);
					Plugin.FoundRuneStones.Add(hashedName);
				}
			}
		}
	}
	public static class RuneStones
	{
		public static string[] Prefabs = new string[11]
		{
			"Runestone_Ashlands", "Runestone_BlackForest", "Runestone_Boars", "Runestone_Draugr", "Runestone_Greydwarfs", "Runestone_Meadows", "Runestone_Mistlands", "Runestone_Mountains", "Runestone_Plains", "Runestone_Swamps",
			"DrakeLorestone"
		};

		public static GameObject GetRuneStoneOfLocation(Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(pos, 12f);
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				RuneStone component = ((Component)val).GetComponent<RuneStone>();
				if ((Object)(object)component != (Object)null)
				{
					return ((Component)component).gameObject;
				}
			}
			return null;
		}

		public static void RegisterPrefabs(GameObject itemDrop)
		{
			//IL_00eb: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			string[] prefabs = Prefabs;
			foreach (string text in prefabs)
			{
				GameObject val = PrefabManager.Instance.GetPrefab(text);
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Logger.LogWarning((object)("RuneStone " + text + " not found"));
					continue;
				}
				RuneStone componentInChildren = val.GetComponentInChildren<RuneStone>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					Plugin.Logger.LogInfo((object)("RuneStone " + text + " has a RuneStone component"));
					val = ((Component)componentInChildren).gameObject;
				}
				ZNetView val2 = val.AddComponent<ZNetView>();
				if (ZNetView.m_forceDisableInit || ZDOMan.instance == null)
				{
					Plugin.Logger.LogWarning((object)"ZNetView.m_forceDisableInit is true or ZDOMan.instance is null");
					continue;
				}
				Destructible val3 = val.AddComponent<Destructible>();
				val3.m_spawnWhenDestroyed = itemDrop;
				val3.m_health = 1000f;
				val3.m_destroyed = false;
				val3.m_damages.m_chop = (DamageModifier)4;
				val3.m_damages.m_pickaxe = (DamageModifier)2;
				val3.m_damages.m_fire = (DamageModifier)4;
				val3.m_damages.m_frost = (DamageModifier)4;
				val3.m_damages.m_lightning = (DamageModifier)4;
				val3.m_damages.m_pierce = (DamageModifier)4;
				val3.m_damages.m_poison = (DamageModifier)4;
				val3.m_damages.m_slash = (DamageModifier)4;
				val3.m_damages.m_spirit = (DamageModifier)4;
				val3.m_damages.m_blunt = (DamageModifier)4;
			}
		}

		public static void RegisterLocations()
		{
			List<LocationInstance> list = new List<LocationInstance>();
			if (!ZoneSystem.instance.FindLocations("Runestone_Meadows", ref list))
			{
				Plugin.Logger.LogWarning((object)"Runestone_Meadows not found");
			}
		}
	}
	public class RuneTablet : CustomItem
	{
		internal static Sprite IconSprite;

		public RuneTablet()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Name = "$item_runetablet";
			val.Description = "$item_runetablet_desc";
			val.CraftingStation = CraftingStations.Workbench;
			val.Icon = IconSprite;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "Stone",
					Amount = 10
				},
				new RequirementConfig
				{
					Item = "RuneCrystal",
					Amount = 4
				}
			};
			val.Weight = 10f;
			((CustomItem)this)..ctor("RuneTablet", true, val);
		}

		public static bool Consume(Player player)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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)
			if ((Object)(object)player == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"Player.ConsumeItem: Called with null player");
				return false;
			}
			Biome currentBiome = player.GetCurrentBiome();
			Plugin.Logger.LogInfo((object)("Player.ConsumeItem: Called in biome " + ((object)(Biome)(ref currentBiome)).ToString()));
			if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)256) || ((Enum)currentBiome).HasFlag((Enum)(object)(Biome)1))
			{
				((Character)player).Message((MessageType)2, "Cannot use that in this biome.", 0, (Sprite)null);
				return false;
			}
			if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)32) && player.IsBiomeKnown((Biome)32))
			{
				DiscoverNearestDungeon(player, (Biome)32);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)512) && player.IsBiomeKnown((Biome)512))
			{
				DiscoverNearestDungeon(player, (Biome)512);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)16) && player.IsBiomeKnown((Biome)16))
			{
				DiscoverNearestDungeon(player, (Biome)16);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)4) && player.IsBiomeKnown((Biome)4))
			{
				DiscoverNearestDungeon(player, (Biome)4);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)64) && player.IsBiomeKnown((Biome)64))
			{
				DiscoverNearestDungeon(player, (Biome)4);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)2) && player.IsBiomeKnown((Biome)2))
			{
				DiscoverNearestDungeon(player, (Biome)2);
			}
			else if (((Enum)currentBiome).HasFlag((Enum)(object)(Biome)8) && player.IsBiomeKnown((Biome)8))
			{
				DiscoverNearestDungeon(player, (Biome)8);
			}
			return true;
		}

		private static Tuple<string, Vector3> FindClosestLocationFromTypes(string[] types, Vector3 point)
		{
			//IL_0003: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00c2: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			string text = null;
			Vector3 item = Vector3.zero;
			float num = float.PositiveInfinity;
			List<LocationInstance> list = new List<LocationInstance>();
			foreach (string text2 in types)
			{
				List<LocationInstance> collection = new List<LocationInstance>();
				if (ZoneSystem.instance.FindLocations(text2, ref collection))
				{
					list.AddRange(collection);
				}
			}
			foreach (LocationInstance item2 in list)
			{
				string name = item2.m_location.m_prefab.Name;
				if (!Minimap.instance.HaveSimilarPin(item2.m_position, (PinType)14, Helper.GetPinName(name), true))
				{
					float num2 = Vector3.Distance(point, item2.m_position);
					if (num2 < num)
					{
						text = name;
						item = item2.m_position;
						num = num2;
					}
				}
			}
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			return new Tuple<string, Vector3>(text, item);
		}

		public static void DiscoverNearestDungeon(Player player, Biome biome)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			string[] array;
			if ((int)biome <= 8)
			{
				if ((int)biome != 2)
				{
					if ((int)biome != 4)
					{
						if ((int)biome != 8)
						{
							goto IL_011d;
						}
						array = new string[4] { "Hildir_crypt", "Crypt2", "Crypt3", "Crypt4" };
					}
					else
					{
						array = new string[2] { "Hildir_cave", "MountainCave02" };
					}
				}
				else
				{
					array = new string[1] { "SunkenCrypt4" };
				}
			}
			else if ((int)biome <= 32)
			{
				if ((int)biome != 16)
				{
					if ((int)biome != 32)
					{
						goto IL_011d;
					}
					array = new string[1] { "" };
				}
				else
				{
					array = new string[4] { "GoblinCamp2", "StoneTower1", "StoneTower3", "Hildir_plainsfortress" };
				}
			}
			else if ((int)biome != 64)
			{
				if ((int)biome != 512)
				{
					goto IL_011d;
				}
				array = new string[2] { "Mistlands_DvergrTownEntrance1", "Mistlands_DvergrTownEntrance2" };
			}
			else
			{
				array = new string[2] { "Hildir_cave", "MountainCave02" };
			}
			goto IL_0122;
			IL_011d:
			array = null;
			goto IL_0122;
			IL_0122:
			if (1 == 0)
			{
			}
			string[] array2 = array;
			if (array2 == null)
			{
				Plugin.Logger.LogWarning((object)$"DiscoverNearestDungeon: Invalid biome {biome}");
				return;
			}
			Vector3 position = ((Component)player).transform.position;
			Tuple<string, Vector3> tuple = FindClosestLocationFromTypes(array2, position);
			if (tuple == null)
			{
				Plugin.Logger.LogWarning((object)"DiscoverNearestDungeon: No location found");
				return;
			}
			string item = tuple.Item1;
			Vector3 item2 = tuple.Item2;
			Game.instance.DiscoverClosestLocation(item, item2, Helper.GetPinName(item), 14, true, false);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RuneTablet";

		public const string PLUGIN_NAME = "Make a rune tablet to locate dungeons";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}