Decompiled source of MerchandTracker v1.1.1

MerchandTracker.dll

Decompiled 5 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LocateTrader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LocateTrader")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("df59bb66-807e-4109-b32b-c4bc8be33dd1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MerchantTracker;

[BepInPlugin("com.kaynoxDev.merchanttracker", "Merchant Tracker", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MerchantTrackerPlugin : BaseUnityPlugin
{
	private class DisplayMerchantsCommand : ConsoleCommand
	{
		public override string Name => "displaymerchants";

		public override string Help => "Displays nearby merchants.";

		public override void Run(string[] args)
		{
			TrackMerchants();
		}

		private static void TrackMerchants()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a8: 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)
			Dictionary<string, string> dictionary = new Dictionary<string, string>
			{
				{ "Vendor_BlackForest", "Haldor" },
				{ "Hildir_camp", "Hildir" }
			};
			bool flag = false;
			List<LocationInstance> list = ZoneSystem.instance.m_locationInstances.Values.ToList();
			foreach (KeyValuePair<string, string> item in dictionary)
			{
				foreach (LocationInstance item2 in list)
				{
					if (item2.m_location.m_prefabName == item.Key)
					{
						Vector3 position = item2.m_position;
						Console.instance.Print($"{item.Value} at {position}");
						Minimap.instance.AddPin(position, (PinType)3, item.Value, true, false, 0L, "");
						MessageHud.instance.ShowMessage((MessageType)2, "Hildir and Haldor has been found!", 0, (Sprite)null);
						flag = true;
						break;
					}
				}
			}
			if (!flag)
			{
				MessageHud.instance.ShowMessage((MessageType)2, "No merchants found.", 0, (Sprite)null);
			}
		}
	}

	private static Harmony harmony;

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		harmony = new Harmony("com.kaynoxDev.merchanttracker");
		harmony.PatchAll(typeof(MerchantTrackerPlugin));
		CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new DisplayMerchantsCommand());
	}
}