Decompiled source of RevealSites v1.0.0

RevealSites.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RevealSites
{
	[BepInPlugin("com.dreich.revealsites", "Reveal Sites", "1.0.0")]
	public class RevealSitesPlugin : BaseUnityPlugin
	{
		public const string Guid = "com.dreich.revealsites";

		public const string Name = "Reveal Sites";

		public const string Version = "1.0.0";

		private const string DefaultTraders = "Vendor_BlackForest,Hildir_camp,BogWitch_Camp";

		private const string DefaultBosses = "Eikthyrnir,GDKing,Bonemass,Dragonqueen,GoblinKing,Mistlands_DvergrBossEntrance1,FaderLocation";

		internal static ManualLogSource Log;

		internal static ConfigEntry<string> Traders;

		internal static ConfigEntry<string> Bosses;

		internal static ConfigEntry<string> Forges;

		internal static ConfigEntry<bool> FindForges;

		private void Awake()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Traders = ((BaseUnityPlugin)this).Config.Bind<string>("Sites", "Traders", "Vendor_BlackForest,Hildir_camp,BogWitch_Camp", "Comma separated location names counted as traders.");
			Bosses = ((BaseUnityPlugin)this).Config.Bind<string>("Sites", "Bosses", "Eikthyrnir,GDKing,Bonemass,Dragonqueen,GoblinKing,Mistlands_DvergrBossEntrance1,FaderLocation", "Comma separated location names counted as boss altars. Use 'revealsites list' to see every location name in your world.");
			Forges = ((BaseUnityPlugin)this).Config.Bind<string>("Sites", "Forges", "", "Comma separated location names counted as a Forge of Potential, on top of the ones found automatically.");
			FindForges = ((BaseUnityPlugin)this).Config.Bind<bool>("Sites", "FindForgesAutomatically", true, "Counts every location that shows its own icon on the map, other than the traders and the starting area, as a Forge of Potential.");
			new Harmony("com.dreich.revealsites").PatchAll(typeof(RevealSitesPlugin).Assembly);
		}
	}
	internal enum SiteKind
	{
		Trader,
		Boss,
		Forge
	}
	internal struct Site
	{
		internal SiteKind Kind;

		internal string Location;

		internal Vector3 Position;
	}
	internal static class SiteFinder
	{
		private const string StartingArea = "StartTemple";

		internal static List<Site> Find(ICollection<SiteKind> wanted)
		{
			//IL_005e: 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_0065: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			List<Site> list = new List<Site>();
			ZoneSystem instance = ZoneSystem.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return list;
			}
			HashSet<string> traders = NameSet(RevealSitesPlugin.Traders.Value);
			HashSet<string> bosses = NameSet(RevealSitesPlugin.Bosses.Value);
			HashSet<string> forges = NameSet(RevealSitesPlugin.Forges.Value);
			foreach (LocationInstance value in instance.m_locationInstances.Values)
			{
				ZoneLocation location = value.m_location;
				if (location != null)
				{
					string name = location.m_prefab.Name;
					if (TryKind(location, name, traders, bosses, forges, out var kind) && wanted.Contains(kind))
					{
						list.Add(new Site
						{
							Kind = kind,
							Location = name,
							Position = value.m_position
						});
					}
				}
			}
			return list;
		}

		internal static SortedDictionary<string, int> CountLocations()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			SortedDictionary<string, int> sortedDictionary = new SortedDictionary<string, int>(StringComparer.OrdinalIgnoreCase);
			ZoneSystem instance = ZoneSystem.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return sortedDictionary;
			}
			foreach (LocationInstance value2 in instance.m_locationInstances.Values)
			{
				if (value2.m_location != null)
				{
					string name = value2.m_location.m_prefab.Name;
					sortedDictionary[name] = ((!sortedDictionary.TryGetValue(name, out var value)) ? 1 : (value + 1));
				}
			}
			return sortedDictionary;
		}

		private static bool TryKind(ZoneLocation location, string name, HashSet<string> traders, HashSet<string> bosses, HashSet<string> forges, out SiteKind kind)
		{
			kind = SiteKind.Trader;
			if (string.IsNullOrEmpty(name))
			{
				return false;
			}
			if (traders.Contains(name))
			{
				return true;
			}
			kind = SiteKind.Boss;
			if (bosses.Contains(name))
			{
				return true;
			}
			kind = SiteKind.Forge;
			if (forges.Contains(name))
			{
				return true;
			}
			bool flag = location.m_iconAlways || location.m_iconPlaced;
			if (RevealSitesPlugin.FindForges.Value && flag)
			{
				return name != "StartTemple";
			}
			return false;
		}

		private static HashSet<string> NameSet(string list)
		{
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			string[] array = list.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length > 0)
				{
					hashSet.Add(text);
				}
			}
			return hashSet;
		}
	}
	internal static class SitePins
	{
		private const string ForgeLabel = "Forge of Potential";

		private const string TraderLabel = "Trader";

		private const string BossLabel = "Boss";

		private const PinType TraderPin = (PinType)1;

		private const PinType BossPin = (PinType)9;

		private const PinType ForgePin = (PinType)2;

		private const string StartingArea = "StartTemple";

		private const float SameSpotDistance = 1f;

		private static readonly FieldRef<Minimap, List<PinData>> Pins = AccessTools.FieldRefAccess<Minimap, List<PinData>>("m_pins");

		private static readonly Dictionary<Vector3, string> shownIcons = new Dictionary<Vector3, string>();

		private static readonly Func<Minimap, Vector3, PinType, string, bool, bool> HaveSimilarPin = AccessTools.MethodDelegate<Func<Minimap, Vector3, PinType, string, bool, bool>>(AccessTools.Method(typeof(Minimap), "HaveSimilarPin", (Type[])null, (Type[])null), (object)null, true);

		private static readonly Dictionary<string, string> Labels = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Vendor_BlackForest", "Haldor" },
			{ "Hildir_camp", "Hildir" },
			{ "BogWitch_Camp", "Bog Witch" },
			{ "Eikthyrnir", "$enemy_eikthyr" },
			{ "GDKing", "$enemy_gdking" },
			{ "Bonemass", "$enemy_bonemass" },
			{ "Dragonqueen", "$enemy_dragon" },
			{ "GoblinKing", "$enemy_goblinking" },
			{ "Mistlands_DvergrBossEntrance1", "$enemy_seekerqueen" },
			{ "FaderLocation", "$enemy_fader" }
		};

		private static readonly Dictionary<string, string> IconLocations = new Dictionary<string, string>
		{
			{ "Haldor", "Vendor_BlackForest" },
			{ "Hildir", "Hildir_camp" },
			{ "Bog Witch", "BogWitch_Camp" }
		};

		internal static int RemoveFoundTraders(Minimap map)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Invalid comparison between Unknown and I4
			if ((Object)(object)map == (Object)null)
			{
				return 0;
			}
			HashSet<string> hashSet = FoundTraders();
			if (hashSet.Count == 0)
			{
				return 0;
			}
			HashSet<string> hashSet2 = new HashSet<string>();
			foreach (KeyValuePair<string, string> iconLocation in IconLocations)
			{
				if (hashSet.Contains(iconLocation.Value))
				{
					hashSet2.Add(iconLocation.Key);
				}
			}
			int num = 0;
			foreach (PinData item in new List<PinData>(Pins.Invoke(map)))
			{
				if ((int)item.m_type == 1 && hashSet2.Contains(item.m_name))
				{
					map.RemovePin(item);
					num++;
				}
			}
			return num;
		}

		internal static int ClearFoundTraders(List<Site> traderSites)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Invalid comparison between Unknown and I4
			Minimap instance = Minimap.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return 0;
			}
			int num = RemoveFoundTraders(instance);
			foreach (PinData item in new List<PinData>(Pins.Invoke(instance)))
			{
				if ((int)item.m_type == 1 && IconLocations.ContainsKey(item.m_name) && !StillThere(item, traderSites))
				{
					instance.RemovePin(item);
					num++;
				}
			}
			return num;
		}

		private static bool StillThere(PinData pin, List<Site> traderSites)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			foreach (Site traderSite in traderSites)
			{
				if (traderSite.Kind == SiteKind.Trader && !(LabelFor(traderSite) != pin.m_name) && Utils.DistanceXZ(traderSite.Position, pin.m_pos) <= 1f)
				{
					return true;
				}
			}
			return false;
		}

		private static HashSet<string> FoundTraders()
		{
			HashSet<string> hashSet = new HashSet<string>();
			if ((Object)(object)ZoneSystem.instance == (Object)null)
			{
				return hashSet;
			}
			shownIcons.Clear();
			ZoneSystem.instance.GetLocationIcons(shownIcons);
			foreach (string value in shownIcons.Values)
			{
				if (IconLocations.ContainsValue(value))
				{
					hashSet.Add(value);
				}
			}
			return hashSet;
		}

		internal static void UseLocationIcon(Minimap map, PinData pin, PinType type, string label)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)map == (Object)null) && pin != null && label != null)
			{
				Sprite val = IconOf(map, LocationFor(map, type, label));
				if ((Object)(object)val != (Object)null)
				{
					pin.m_icon = val;
				}
			}
		}

		private static string LocationFor(Minimap map, PinType type, string label)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if ((int)type == 1 && IconLocations.TryGetValue(label, out var value))
			{
				return value;
			}
			if ((int)type == 2 && label == "Forge of Potential")
			{
				return ForgeLocation(map);
			}
			return null;
		}

		private static string ForgeLocation(Minimap map)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			foreach (LocationSpriteData locationIcon in map.m_locationIcons)
			{
				if (!(locationIcon.m_name == "StartTemple") && !IconLocations.ContainsValue(locationIcon.m_name))
				{
					return locationIcon.m_name;
				}
			}
			return null;
		}

		private static Sprite IconOf(Minimap map, string location)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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)
			if (location == null)
			{
				return null;
			}
			foreach (LocationSpriteData locationIcon in map.m_locationIcons)
			{
				if (locationIcon.m_name == location)
				{
					return locationIcon.m_icon;
				}
			}
			return null;
		}

		internal static int Add(IEnumerable<Site> sites)
		{
			//IL_0049: 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_0061: 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_0075: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Minimap instance = Minimap.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return 0;
			}
			HashSet<string> hashSet = FoundTraders();
			int num = 0;
			foreach (Site site in sites)
			{
				if (site.Kind != SiteKind.Trader || !hashSet.Contains(site.Location))
				{
					PinType val = PinFor(site.Kind);
					string text = LabelFor(site);
					if (!HaveSimilarPin(instance, site.Position, val, text, arg5: true))
					{
						instance.AddPin(site.Position, val, text, true, false, 0L, default(PlatformUserID));
						num++;
					}
				}
			}
			return num;
		}

		private static PinType PinFor(SiteKind kind)
		{
			return (PinType)(kind switch
			{
				SiteKind.Trader => 1, 
				SiteKind.Boss => 9, 
				_ => 2, 
			});
		}

		private static string LabelFor(Site site)
		{
			if (site.Kind == SiteKind.Forge)
			{
				return "Forge of Potential";
			}
			if (Labels.TryGetValue(site.Location, out var value))
			{
				return value;
			}
			if (site.Kind != SiteKind.Trader)
			{
				return "Boss";
			}
			return "Trader";
		}
	}
	internal static class SiteNetwork
	{
		private const string RequestRpc = "RevealSites_Request";

		private const string ReplyRpc = "RevealSites_Reply";

		private const string ListRpc = "RevealSites_List";

		private const int Refused = -1;

		private static bool registered;

		internal static void Register()
		{
			if (!registered && ZRoutedRpc.instance != null)
			{
				ZRoutedRpc.instance.Register<string>("RevealSites_Request", (Action<long, string>)OnRequest);
				ZRoutedRpc.instance.Register<ZPackage>("RevealSites_Reply", (Action<long, ZPackage>)OnReply);
				ZRoutedRpc.instance.Register<ZPackage>("RevealSites_List", (Action<long, ZPackage>)OnList);
				registered = true;
			}
		}

		internal static void Forget()
		{
			registered = false;
		}

		internal static void Ask(string what)
		{
			ZNetPeer serverPeer = ZNet.instance.GetServerPeer();
			if (serverPeer != null)
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(serverPeer.m_uid, "RevealSites_Request", new object[1] { what });
			}
		}

		private static void OnRequest(long sender, string what)
		{
			if (!((Object)(object)ZNet.instance == (Object)null) && ZNet.instance.IsServer())
			{
				bool allowed = IsAdmin(sender);
				if (what == "list")
				{
					ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RevealSites_List", new object[1] { ListPackage(allowed) });
				}
				else
				{
					ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RevealSites_Reply", new object[1] { SitesPackage(allowed, what) });
				}
			}
		}

		private static bool IsAdmin(long sender)
		{
			if (sender == ZNet.GetUID())
			{
				return true;
			}
			ZNetPeer peer = ZNet.instance.GetPeer(sender);
			if (peer != null && peer.m_socket != null)
			{
				return ZNet.instance.IsAdmin(peer.m_socket.GetHostName());
			}
			return false;
		}

		private static ZPackage SitesPackage(bool allowed, string what)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			ZPackage val = new ZPackage();
			val.Write(what);
			if (!allowed)
			{
				val.Write(-1);
				return val;
			}
			List<Site> list = SiteFinder.Find(SiteCommand.KindsFor(what));
			val.Write(list.Count);
			foreach (Site item in list)
			{
				val.Write((int)item.Kind);
				val.Write(item.Location);
				val.Write(item.Position);
			}
			return val;
		}

		private static ZPackage ListPackage(bool allowed)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			ZPackage val = new ZPackage();
			if (!allowed)
			{
				val.Write(-1);
				return val;
			}
			SortedDictionary<string, int> sortedDictionary = SiteFinder.CountLocations();
			val.Write(sortedDictionary.Count);
			foreach (KeyValuePair<string, int> item in sortedDictionary)
			{
				val.Write(item.Key);
				val.Write(item.Value);
			}
			return val;
		}

		private static void OnReply(long sender, ZPackage package)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			string what = package.ReadString();
			int num = package.ReadInt();
			if (num == -1)
			{
				SiteCommand.Say("The server only reveals sites for admins.");
				return;
			}
			List<Site> list = new List<Site>(num);
			for (int i = 0; i < num; i++)
			{
				list.Add(new Site
				{
					Kind = (SiteKind)package.ReadInt(),
					Location = package.ReadString(),
					Position = package.ReadVector3()
				});
			}
			SiteCommand.ReportPins(what, list);
		}

		private static void OnList(long sender, ZPackage package)
		{
			int num = package.ReadInt();
			if (num == -1)
			{
				SiteCommand.Say("The server only lists locations for admins.");
				return;
			}
			SortedDictionary<string, int> sortedDictionary = new SortedDictionary<string, int>(StringComparer.OrdinalIgnoreCase);
			for (int i = 0; i < num; i++)
			{
				sortedDictionary[package.ReadString()] = package.ReadInt();
			}
			SiteCommand.ReportList(sortedDictionary);
		}
	}
	internal static class SiteCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ConsoleEvent <0>__Run;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ConsoleOptionsFetcher <>9__9_0;

			internal List<string> <Register>b__9_0()
			{
				return new List<string> { "all", "traders", "bosses", "forges", "clear", "list" };
			}
		}

		internal const string Name = "revealsites";

		internal const string ListTarget = "list";

		private const string AllTarget = "all";

		private const string TradersTarget = "traders";

		private const string BossesTarget = "bosses";

		private const string ForgesTarget = "forges";

		private const string ClearTarget = "clear";

		private const string Description = "revealsites [all | traders | bosses | forges | clear | list] - pins traders, boss altars and Forges of Potential on the map, clears pins for traders you've found, or lists every location in the world";

		private const int TargetArgument = 1;

		internal static void Register()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			object obj = <>O.<0>__Run;
			if (obj == null)
			{
				ConsoleEvent val = Run;
				<>O.<0>__Run = val;
				obj = (object)val;
			}
			object obj2 = <>c.<>9__9_0;
			if (obj2 == null)
			{
				ConsoleOptionsFetcher val2 = () => new List<string> { "all", "traders", "bosses", "forges", "clear", "list" };
				<>c.<>9__9_0 = val2;
				obj2 = (object)val2;
			}
			new ConsoleCommand("revealsites", "revealsites [all | traders | bosses | forges | clear | list] - pins traders, boss altars and Forges of Potential on the map, clears pins for traders you've found, or lists every location in the world", (ConsoleEvent)obj, true, false, false, false, false, false, (ConsoleOptionsFetcher)obj2, false, false, false);
		}

		internal static ICollection<SiteKind> KindsFor(string what)
		{
			switch (what)
			{
			case "traders":
			case "clear":
				return new SiteKind[1];
			case "bosses":
				return new SiteKind[1] { SiteKind.Boss };
			case "forges":
				return new SiteKind[1] { SiteKind.Forge };
			default:
				return new SiteKind[3]
				{
					SiteKind.Trader,
					SiteKind.Boss,
					SiteKind.Forge
				};
			}
		}

		private static void Run(ConsoleEventArgs args)
		{
			string text = ((args.Length > 1) ? args[1].ToLowerInvariant() : "all");
			if ((Object)(object)Minimap.instance == (Object)null || (Object)(object)ZNet.instance == (Object)null)
			{
				Say("Join a world first.");
			}
			else if (ZNet.instance.IsServer())
			{
				if (text == "list")
				{
					ReportList(SiteFinder.CountLocations());
				}
				else
				{
					ReportPins(text, SiteFinder.Find(KindsFor(text)));
				}
			}
			else
			{
				SiteNetwork.Ask(text);
				Say("Asking the server for sites...");
			}
		}

		internal static void ReportPins(string what, List<Site> sites)
		{
			int num = (new List<SiteKind>(KindsFor(what)).Contains(SiteKind.Trader) ? SitePins.ClearFoundTraders(sites) : 0);
			if (what == "clear")
			{
				Say($"Removed {num} pins for traders that have been found.");
				return;
			}
			int num2 = SitePins.Add(sites);
			Say($"Found {sites.Count} sites, added {num2} new pins, removed {num} for traders that have been found.");
		}

		internal static void ReportList(SortedDictionary<string, int> counts)
		{
			Say($"{counts.Count} kinds of location in this world:");
			foreach (KeyValuePair<string, int> count in counts)
			{
				Say($"  {count.Key} x{count.Value}");
			}
		}

		internal static void Say(string line)
		{
			if ((Object)(object)Console.instance != (Object)null)
			{
				((Terminal)Console.instance).AddString(line);
			}
			RevealSitesPlugin.Log.LogInfo((object)line);
		}
	}
	[HarmonyPatch(typeof(Terminal), "InitTerminal")]
	internal static class TerminalPatch
	{
		private static void Postfix()
		{
			SiteCommand.Register();
		}
	}
	[HarmonyPatch(typeof(Minimap), "AddPin")]
	internal static class LocationIconPatch
	{
		private static void Postfix(Minimap __instance, PinData __result, PinType __1, string __2)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			SitePins.UseLocationIcon(__instance, __result, __1, __2);
		}
	}
	[HarmonyPatch(typeof(Minimap), "UpdateLocationPins")]
	internal static class FoundTraderPatch
	{
		private const float SecondsBetweenChecks = 5f;

		private static float nextCheck;

		private static void Postfix(Minimap __instance)
		{
			if (!(Time.time < nextCheck))
			{
				nextCheck = Time.time + 5f;
				SitePins.RemoveFoundTraders(__instance);
			}
		}
	}
	[HarmonyPatch(typeof(Game), "Start")]
	internal static class GameStartPatch
	{
		private static void Postfix()
		{
			SiteNetwork.Register();
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnDestroy")]
	internal static class ZNetDestroyPatch
	{
		private static void Postfix()
		{
			SiteNetwork.Forget();
		}
	}
}