Decompiled source of ContentMiniMap MiniMap v1.0.0

CWMapMod.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CWMapMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CWMapMod")]
[assembly: AssemblyTitle("CWMapMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.cwmap.mod", "Hey Bay Be", "1.67.0")]
public class CWMapMod : BaseUnityPlugin
{
	private Texture2D whiteTexture;

	private Texture2D terrainTexture;

	private GUIStyle itemLabelStyle;

	private GUIStyle headerStyle;

	private GUIStyle footerStyle;

	private GUIStyle waypointLabelStyle;

	private const float MAP_SIZE = 220f;

	private const float BORDER = 2f;

	private const float HEADER_H = 22f;

	private const float FOOTER_H = 18f;

	private const float MARGIN = 16f;

	private Rect panelRect;

	private Rect mapRect;

	private float radarRange = 50f;

	private const float RANGE_MIN = 15f;

	private const float RANGE_MAX = 150f;

	private const float RANGE_STEP = 5f;

	private float heightTolerance = 5f;

	private Color colBackground = new Color(0.035f, 0.03f, 0.025f, 0.95f);

	private Color colBorder = new Color(0.847f, 0.741f, 0.561f, 1f);

	private Color colTerrain = new Color(0.35f, 0.3f, 0.22f, 1f);

	private Color colEmpty = new Color(0.05f, 0.045f, 0.035f, 0.5f);

	private Color colScanLine = new Color(0.847f, 0.741f, 0.561f, 0.15f);

	private Color colPlayer = new Color(0.95f, 0.85f, 0.65f, 1f);

	private Color colMonster = new Color(0.9f, 0.25f, 0.2f, 1f);

	private Color colMonsterHigh = new Color(1f, 0.75f, 0.2f, 1f);

	private Color colMonsterLow = new Color(0.75f, 0.25f, 0.8f, 1f);

	private Color colItem = new Color(0.35f, 1f, 0.45f, 1f);

	private Color colHeader = new Color(0.847f, 0.741f, 0.561f, 1f);

	private Color colFooter = new Color(0.65f, 0.55f, 0.4f, 1f);

	private Color colWaypoint = new Color(1f, 0.65f, 0.2f, 1f);

	private LayerMask terrainMask;

	private int scanFrame = 0;

	private const int SCAN_INTERVAL = 2;

	private int MAP_TEXTURE_SIZE = 96;

	private bool indoorMode = false;

	private const float OUTDOOR_ORIGIN = 50f;

	private const float OUTDOOR_REACH = 100f;

	private const float INDOOR_ORIGIN = 8f;

	private const float INDOOR_REACH = 12f;

	private const float INDOOR_ROOF_CAP = -1f;

	private float scanLineY = 0f;

	private List<Vector3> waypoints = new List<Vector3>();

	private bool placingWaypoint = false;

	private float targetRadarRange = 50f;

	private float zoomSpeed = 5f;

	private void Awake()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_00a1: 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_00c4: Expected O, but got Unknown
		//IL_00de: 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_0101: Expected O, but got Unknown
		//IL_0128: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"CW Radar Loaded");
		whiteTexture = MakeTex(1, 1, Color.white);
		itemLabelStyle = new GUIStyle();
		itemLabelStyle.fontSize = 9;
		itemLabelStyle.fontStyle = (FontStyle)1;
		itemLabelStyle.normal.textColor = colItem;
		itemLabelStyle.alignment = (TextAnchor)4;
		headerStyle = new GUIStyle();
		headerStyle.fontSize = 11;
		headerStyle.fontStyle = (FontStyle)1;
		headerStyle.normal.textColor = colHeader;
		headerStyle.alignment = (TextAnchor)3;
		footerStyle = new GUIStyle();
		footerStyle.fontSize = 10;
		footerStyle.normal.textColor = colFooter;
		footerStyle.alignment = (TextAnchor)3;
		waypointLabelStyle = new GUIStyle();
		waypointLabelStyle.fontSize = 9;
		waypointLabelStyle.fontStyle = (FontStyle)1;
		waypointLabelStyle.normal.textColor = colWaypoint;
		waypointLabelStyle.alignment = (TextAnchor)4;
		terrainMask = LayerMask.op_Implicit(-1);
		terrainTexture = new Texture2D(MAP_TEXTURE_SIZE, MAP_TEXTURE_SIZE, (TextureFormat)4, false);
		((Texture)terrainTexture).filterMode = (FilterMode)1;
		ClearTerrainTexture();
		RecalcRects();
	}

	private void RecalcRects()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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)
		float num = 224f;
		float num2 = 264f;
		float num3 = (float)Screen.width - num - 16f;
		float num4 = ((float)Screen.height - num2) / 2f;
		panelRect = new Rect(num3, num4, num, num2);
		mapRect = new Rect(((Rect)(ref panelRect)).x + 2f, ((Rect)(ref panelRect)).y + 2f + 22f, 220f, 220f);
	}

	private Texture2D MakeTex(int w, int h, Color c)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(w, h);
		Color[] array = (Color[])(object)new Color[w * h];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = c;
		}
		val.SetPixels(array);
		val.Apply();
		return val;
	}

	private void ClearTerrainTexture()
	{
		//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)
		Color[] array = (Color[])(object)new Color[MAP_TEXTURE_SIZE * MAP_TEXTURE_SIZE];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = colEmpty;
		}
		terrainTexture.SetPixels(array);
		terrainTexture.Apply();
	}

	private void Update()
	{
		//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)
		//IL_0043: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: 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_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = (((Object)(object)SimplePlayer.localPlayer != (Object)null) ? ((Component)SimplePlayer.localPlayer).transform.position : (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : Vector3.zero));
		bool flag = val.y < -5f;
		if (flag != indoorMode)
		{
			indoorMode = flag;
			if (indoorMode)
			{
				targetRadarRange = 35f;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Indoor mode");
			}
			else
			{
				targetRadarRange = 75f;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Outdoor mode");
			}
		}
		radarRange = Mathf.Lerp(radarRange, targetRadarRange, Time.deltaTime * zoomSpeed);
		if (Input.GetKeyDown((KeyCode)112))
		{
			placingWaypoint = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Click on radar to place waypoint");
		}
		if (Input.GetKeyDown((KeyCode)8))
		{
			waypoints.Clear();
		}
		scanLineY += Time.deltaTime * 0.4f;
		if (scanLineY > 1f)
		{
			scanLineY = 0f;
		}
		scanFrame++;
		if (scanFrame >= 2)
		{
			scanFrame = 0;
			Vector3 playerPos = (((Object)(object)SimplePlayer.localPlayer != (Object)null) ? ((Component)SimplePlayer.localPlayer).transform.position : (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : Vector3.zero));
			ScanTerrain(playerPos);
		}
	}

	private void ScanTerrain(Vector3 playerPos)
	{
		//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_0063: 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)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: 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_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		Color[] array = (Color[])(object)new Color[MAP_TEXTURE_SIZE * MAP_TEXTURE_SIZE];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = colEmpty;
		}
		float num;
		float num2;
		if (indoorMode)
		{
			num = Mathf.Min(playerPos.y + 8f, -1f);
			num2 = 12f;
		}
		else
		{
			num = playerPos.y + 50f;
			num2 = 100f;
		}
		Vector3 val = default(Vector3);
		RaycastHit val2 = default(RaycastHit);
		for (int j = 0; j < MAP_TEXTURE_SIZE; j++)
		{
			for (int k = 0; k < MAP_TEXTURE_SIZE; k++)
			{
				float num3 = (((float)j + 0.5f) / (float)MAP_TEXTURE_SIZE * 2f - 1f) * radarRange;
				float num4 = (((float)k + 0.5f) / (float)MAP_TEXTURE_SIZE * 2f - 1f) * radarRange;
				((Vector3)(ref val))..ctor(playerPos.x + num3, num, playerPos.z + num4);
				if (Physics.Raycast(val, Vector3.down, ref val2, num2, LayerMask.op_Implicit(terrainMask)) && Mathf.Abs(((RaycastHit)(ref val2)).point.y - playerPos.y) <= heightTolerance)
				{
					float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4) / radarRange;
					Color val3 = Color.Lerp(new Color(0.28f, 0.36f, 0.5f, 1f), colTerrain, num5);
					array[k * MAP_TEXTURE_SIZE + j] = val3;
				}
			}
		}
		terrainTexture.SetPixels(array);
		terrainTexture.Apply();
	}

	private void OnGUI()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Invalid comparison between Unknown and I4
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: 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_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_064e: Unknown result type (might be due to invalid IL or missing references)
		//IL_065f: Unknown result type (might be due to invalid IL or missing references)
		//IL_066c: Unknown result type (might be due to invalid IL or missing references)
		//IL_069c: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_06de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0728: Unknown result type (might be due to invalid IL or missing references)
		//IL_073a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0507: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_052c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_054d: Unknown result type (might be due to invalid IL or missing references)
		//IL_054f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0554: Unknown result type (might be due to invalid IL or missing references)
		//IL_055c: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_0592: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_0487: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0607: Unknown result type (might be due to invalid IL or missing references)
		//IL_061e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		if ((Object)(object)main == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)main).transform.position;
		RecalcRects();
		GUI.color = colBorder;
		GUI.DrawTexture(panelRect, (Texture)(object)whiteTexture);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref panelRect)).x + 2f, ((Rect)(ref panelRect)).y + 2f, ((Rect)(ref panelRect)).width - 4f, ((Rect)(ref panelRect)).height - 4f);
		GUI.color = colBackground;
		GUI.DrawTexture(val, (Texture)(object)whiteTexture);
		Rect val2 = default(Rect);
		((Rect)(ref val2))..ctor(((Rect)(ref panelRect)).x + 2f + 6f, ((Rect)(ref panelRect)).y + 2f, 214f, 22f);
		GUI.color = Color.white;
		string text = (indoorMode ? "[IN]" : "[OUT]");
		GUI.Label(val2, "◈  RADAR - MODE" + text, headerStyle);
		GUI.color = new Color(colBorder.r, colBorder.g, colBorder.b, 0.4f);
		GUI.DrawTexture(new Rect(((Rect)(ref mapRect)).x, ((Rect)(ref mapRect)).y - 1f, 220f, 1f), (Texture)(object)whiteTexture);
		GUI.color = Color.white;
		GUI.DrawTexture(mapRect, (Texture)(object)terrainTexture);
		Vector2 center = default(Vector2);
		((Vector2)(ref center))..ctor(((Rect)(ref mapRect)).x + ((Rect)(ref mapRect)).width / 2f, ((Rect)(ref mapRect)).y + ((Rect)(ref mapRect)).height / 2f);
		if (placingWaypoint && (int)Event.current.type == 0)
		{
			Vector2 mousePosition = Event.current.mousePosition;
			if (((Rect)(ref mapRect)).Contains(mousePosition))
			{
				Vector3 val3 = RadarToWorld(mousePosition, position, center);
				waypoints.Add(val3);
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Waypoint placed at {val3}");
				placingWaypoint = false;
				Event.current.Use();
			}
		}
		float num = ((Rect)(ref mapRect)).y + scanLineY * 220f;
		GUI.color = colScanLine;
		GUI.DrawTexture(new Rect(((Rect)(ref mapRect)).x, num, 220f, 3f), (Texture)(object)whiteTexture);
		GUI.color = Color.white;
		for (int i = 0; i < waypoints.Count; i++)
		{
			Vector2 val4 = WorldToRadar(waypoints[i], position, center);
			if (((Rect)(ref mapRect)).Contains(val4))
			{
				Color val5 = colWaypoint;
				DrawDot(val4, val5, 7f);
				GUI.color = new Color(val5.r, val5.g, val5.b, 0.85f);
				GUI.Label(new Rect(val4.x - 20f, val4.y - 16f, 40f, 12f), "WP" + (i + 1), waypointLabelStyle);
			}
		}
		Bot[] array = Object.FindObjectsByType<Bot>((FindObjectsSortMode)0);
		Bot[] array2 = array;
		foreach (Bot val6 in array2)
		{
			if ((Object)(object)val6 == (Object)null || (Object)(object)val6.centerTransform == (Object)null)
			{
				continue;
			}
			Vector3 position2 = val6.centerTransform.position;
			float num2 = position2.y - position.y;
			if (Mathf.Abs(num2) > heightTolerance)
			{
				continue;
			}
			float num3 = Vector3.Distance(position2, position);
			if (num3 > radarRange)
			{
				continue;
			}
			Vector2 val7 = WorldToRadar(position2, position, center);
			if (((Rect)(ref mapRect)).Contains(val7))
			{
				Color color = colMonster;
				if (num2 > 1f)
				{
					color = colMonsterHigh;
				}
				if (num2 < -1f)
				{
					color = colMonsterLow;
				}
				DrawDot(val7, color, 7f);
			}
		}
		ItemInstance[] array3 = Object.FindObjectsByType<ItemInstance>((FindObjectsSortMode)0);
		ItemInstance[] array4 = array3;
		foreach (ItemInstance val8 in array4)
		{
			if ((Object)(object)val8 == (Object)null)
			{
				continue;
			}
			Vector3 position3 = ((Component)val8).transform.position;
			float num4 = position3.y - position.y;
			if (Mathf.Abs(num4) > heightTolerance)
			{
				continue;
			}
			float num5 = Vector3.Distance(position3, position);
			if (num5 > radarRange)
			{
				continue;
			}
			Vector2 val9 = WorldToRadar(position3, position, center);
			if (((Rect)(ref mapRect)).Contains(val9))
			{
				float num6 = Mathf.Clamp(1f - num5 / radarRange, 0.2f, 1f);
				Color color2 = colItem;
				color2.a = num6;
				DrawDot(val9, color2, 5f);
				if ((Object)(object)val8.item != (Object)null)
				{
					GUI.color = new Color(colItem.r, colItem.g, colItem.b, num6 * 0.85f);
					GUI.Label(new Rect(val9.x - 40f, val9.y + 5f, 80f, 14f), ((Object)val8.item).name, itemLabelStyle);
				}
			}
		}
		GUI.color = Color.white;
		float y = ((Component)main).transform.eulerAngles.y;
		DrawPlayerArrow(center, y);
		GUI.color = new Color(colBorder.r, colBorder.g, colBorder.b, 0.4f);
		GUI.DrawTexture(new Rect(((Rect)(ref mapRect)).x, ((Rect)(ref mapRect)).y + 220f, 220f, 1f), (Texture)(object)whiteTexture);
		GUI.color = Color.white;
		Rect val10 = default(Rect);
		((Rect)(ref val10))..ctor(((Rect)(ref panelRect)).x + 2f + 6f, ((Rect)(ref mapRect)).y + 220f + 2f, 220f, 18f);
		GUI.Label(val10, "Y " + Mathf.Round(position.y).ToString("+0;-0;0") + "   RNG " + (int)radarRange + "m   WP " + waypoints.Count + "  (P=add  BS=clear)", footerStyle);
	}

	private Vector3 RadarToWorld(Vector2 radarPos, Vector3 player, Vector2 center)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: 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_006a: 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)
		float num = player.x + (radarPos.x - center.x) / (((Rect)(ref mapRect)).width / 2f) * radarRange;
		float num2 = player.z - (radarPos.y - center.y) / (((Rect)(ref mapRect)).height / 2f) * radarRange;
		return new Vector3(num, player.y, num2);
	}

	private Vector2 WorldToRadar(Vector3 world, Vector3 player, Vector2 center)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = world - player;
		float num = center.x + val.x / radarRange * (((Rect)(ref mapRect)).width / 2f);
		float num2 = center.y - val.z / radarRange * (((Rect)(ref mapRect)).height / 2f);
		return new Vector2(num, num2);
	}

	private void DrawDot(Vector2 position, Color color, float size)
	{
		//IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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)
		GUI.color = color;
		GUI.DrawTexture(new Rect(position.x - size / 2f, position.y - size / 2f, size, size), (Texture)(object)whiteTexture);
		GUI.color = Color.white;
	}

	private Vector2 RotateAround(Vector2 point, Vector2 pivot, float angleDeg)
	{
		//IL_0017: 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_0019: 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)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0058: Unknown result type (might be due to invalid IL or missing references)
		float num = angleDeg * (MathF.PI / 180f);
		float num2 = Mathf.Cos(num);
		float num3 = Mathf.Sin(num);
		Vector2 val = point - pivot;
		return new Vector2(pivot.x + val.x * num2 - val.y * num3, pivot.y + val.x * num3 + val.y * num2);
	}

	private void DrawPlayerArrow(Vector2 center, float yawDeg)
	{
		//IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: 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_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_0064: 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_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_006e: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00a6: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: 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_00f7: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		Vector2 point = center + new Vector2(0f, -13f);
		Vector2 point2 = center + new Vector2(-9f, 11f);
		Vector2 point3 = center + new Vector2(9f, 11f);
		Vector2 point4 = center + new Vector2(0f, 5f);
		point = RotateAround(point, center, yawDeg);
		point2 = RotateAround(point2, center, yawDeg);
		point3 = RotateAround(point3, center, yawDeg);
		point4 = RotateAround(point4, center, yawDeg);
		Color color = default(Color);
		((Color)(ref color))..ctor(0.05f, 0.15f, 0.25f, 1f);
		GUI.color = color;
		DrawLineWidth(point, point2, 3f);
		DrawLineWidth(point2, point4, 3f);
		DrawLineWidth(point4, point3, 3f);
		DrawLineWidth(point3, point, 3f);
		GUI.color = colPlayer;
		DrawLineWidth(point, point2, 2f);
		DrawLineWidth(point2, point4, 2f);
		DrawLineWidth(point4, point3, 2f);
		DrawLineWidth(point3, point, 2f);
		GUI.color = Color.white;
	}

	private void DrawLineWidth(Vector2 start, Vector2 end, float width)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//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_0011: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_005a: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = end - start;
		float magnitude = ((Vector2)(ref val)).magnitude;
		float num = Mathf.Atan2(val.y, val.x) * 57.29578f;
		GUIUtility.RotateAroundPivot(num, start);
		GUI.DrawTexture(new Rect(start.x, start.y - width / 2f, magnitude, width), (Texture)(object)whiteTexture);
		GUIUtility.RotateAroundPivot(0f - num, start);
	}
}