Decompiled source of MoreMap v1.1.0

plugins/MoreMap.dll

Decompiled 10 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
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 Microsoft.CodeAnalysis;
using ModLocalizer;
using MoreMap.Properties;
using Reptile;
using Reptile.Phone;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MoreMap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds pins to the map for each collectible.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+c1ff856e215e74a340baf42e1d3e2076ee349720")]
[assembly: AssemblyProduct("MoreMap")]
[assembly: AssemblyTitle("MoreMap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 MoreMap
{
	public class AppMap : App
	{
		public enum AppMapOptions
		{
			GraffitiSpot,
			Taxi,
			Toilet,
			Cypher,
			GraffitiCollectible,
			Music,
			Outfit,
			Movestyle,
			Character,
			Polo
		}

		public TextMeshProUGUI title;

		public TextMeshProUGUI selectText;

		public TextMeshProUGUI prevText;

		public TextMeshProUGUI next1Text;

		public TextMeshProUGUI next2Text;

		public TextMeshProUGUI toggleText;

		public TextMeshProUGUI pinCount;

		public Image toggleSelectIcon;

		public Image togglePrevIcon;

		public Image toggleNext1Icon;

		public Image toggleNext2Icon;

		public Image pin;

		public Image pinX;

		public Image specialIcon;

		public static AppMap Instance { get; private set; }

		public static Color AppBlue => new Color(0.224f, 0.302f, 0.624f);

		public static Color AppOrange => new Color(0.978f, 0.424f, 0.216f);

		public static Sprite AppIcon { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/icon.png");


		public static Sprite TrueSprite { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/true.png");


		public static Sprite FalseSprite { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/false.png");


		public static Sprite PinSprite { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/pin.png");


		public static Sprite PinDisabledSprite { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/pin_disabled.png");


		public static Sprite PinXSprite { get; private set; } = Core.Bundle.LoadAsset<Sprite>("assets/pin_x.png");


		public static Sprite TaxiSprite { get; private set; }

		public static Sprite ToiletSprite { get; private set; }

		public static Sprite CypherSprite { get; private set; }

		public static AppMapOptions CurrentOption { get; private set; } = AppMapOptions.GraffitiSpot;


		public static AppMapOptions PrevOption
		{
			get
			{
				AppMapOptions appMapOptions = CurrentOption - 1;
				if (appMapOptions < AppMapOptions.GraffitiSpot)
				{
					appMapOptions = 10 + appMapOptions;
				}
				return appMapOptions;
			}
		}

		public static AppMapOptions Next1Option
		{
			get
			{
				AppMapOptions appMapOptions = CurrentOption + 1;
				if (appMapOptions > AppMapOptions.Polo)
				{
					appMapOptions -= 10;
				}
				return appMapOptions;
			}
		}

		public static AppMapOptions Next2Option
		{
			get
			{
				AppMapOptions appMapOptions = CurrentOption + 2;
				if (appMapOptions > AppMapOptions.Polo)
				{
					appMapOptions -= 10;
				}
				return appMapOptions;
			}
		}

		public static void DoAppSetup()
		{
			//IL_0296: 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_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_076e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Expected O, but got Unknown
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_089f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_091f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0948: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a45: Expected O, but got Unknown
			//IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be7: Unknown result type (might be due to invalid IL or missing references)
			if (Core.Instance.BaseModule.IsPlayingInStage && !((Object)(object)Instance != (Object)null))
			{
				Phone value = Traverse.Create((object)WorldHandler.instance.GetCurrentPlayer()).Field<Phone>("phone").Value;
				Instance = Object.Instantiate<GameObject>(((Component)((Component)((Component)value).GetComponentInChildren<AppEmail>(true)).transform).gameObject, ((Component)((Component)value).GetComponentInChildren<AppEmail>(true)).transform.parent).AddComponent<AppMap>();
				((Object)((Component)Instance).gameObject).name = "AppMap";
				Object.DestroyImmediate((Object)(object)((Component)Instance).GetComponent<AppEmail>());
				Traverse val = Traverse.Create((object)Instance);
				val.Method("Awake", Array.Empty<object>()).GetValue();
				val.Field<Phone>("<MyPhone>k__BackingField").Value = value;
				val.Field<AUnlockable[]>("m_Unlockables").Value = (AUnlockable[])(object)new AUnlockable[0];
				Object.DestroyImmediate((Object)(object)((Component)((Transform)((App)Instance).Content).Find("EmailScroll")).gameObject);
				Object.DestroyImmediate((Object)(object)((Component)((Transform)((App)Instance).Content).Find("MessagePanel")).gameObject);
				((Component)((Transform)((App)Instance).Content).Find("Overlay")).GetComponentInChildren<TMProFontLocalizer>().UpdateTextMeshLanguageFont((SystemLanguage)10);
				Traverse.Create((object)((Component)((Transform)((App)Instance).Content).Find("Overlay")).GetComponentInChildren<TMProFontLocalizer>()).Field<GameFontType>("gameFontType").Value = Core.PhoneFont;
				Object.Destroy((Object)(object)((Component)((Transform)((App)Instance).Content).Find("Overlay")).GetComponentInChildren<TMProLocalizationAddOn>());
				Instance.title = ((Component)((Transform)((App)Instance).Content).Find("Overlay")).GetComponentInChildren<TextMeshProUGUI>();
				((TMP_Text)Instance.title).text = Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_HEADER");
				TMP_FontAsset font = ((TMP_Text)Instance.title).font;
				Image componentInChildren = ((Component)((Transform)((App)Instance).Content).Find("Overlay").Find("Icons").Find("AppIcon")).GetComponentInChildren<Image>();
				componentInChildren.sprite = AppIcon;
				GameObject val2 = Object.Instantiate<GameObject>(((Component)((Transform)((App)value.GetAppInstance<AppHomeScreen>()).Content).Find("BottomView").Find("ButtonContainer").Find("Selector")
					.Find("Background")).gameObject, (Transform)(object)((App)Instance).Content);
				val2.transform.localPosition = new Vector3(100f, 250f, 0f);
				((Object)val2).name = "Selection Background";
				GameObject val3 = Object.Instantiate<GameObject>(((Component)((Transform)((App)value.GetAppInstance<AppHomeScreen>()).Content).Find("BottomView").Find("OtherElements").Find("ArrowsContainer")
					.Find("ArrowDown")).gameObject, (Transform)(object)((App)Instance).Content);
				val3.transform.localPosition = new Vector3(75f, 50f, 0f);
				((Object)val3).name = "Arrow Down";
				GameObject val4 = Object.Instantiate<GameObject>(val3, (Transform)(object)((App)Instance).Content);
				val4.transform.Rotate(0f, 0f, 180f);
				val4.transform.localPosition = new Vector3(75f, 450f, 0f);
				((Object)val4).name = "Arrow Up";
				GameObject val5 = Object.Instantiate<GameObject>(((Component)((Transform)((App)Instance).Content).Find("Overlay").Find("Icons").Find("Arrow")).gameObject, (Transform)(object)((App)Instance).Content);
				val5.transform.Rotate(0f, 0f, 180f);
				val5.transform.localPosition = new Vector3(450f, -650f, 0f);
				((Object)val5).name = "Arrow Right";
				GameObject val6 = Object.Instantiate<GameObject>(val2, (Transform)(object)((App)Instance).Content);
				val6.transform.Rotate(0f, 0f, 180f);
				val6.transform.localPosition = new Vector3(-700f, -450f, 0f);
				((Object)val6).name = "Pin Background";
				GameObject val7 = Object.Instantiate<GameObject>(val2, (Transform)(object)((App)Instance).Content);
				Object.DestroyImmediate((Object)(object)val7.GetComponent<Image>());
				val7.transform.localPosition = new Vector3(-180f, 250f, 0f);
				((Object)val7).name = "Selection Text";
				Instance.selectText = val7.AddComponent<TextMeshProUGUI>();
				Traverse val8 = Traverse.Create((object)((Component)Instance.selectText).gameObject.AddComponent<TMProFontLocalizer>());
				val8.Field<GameFontType>("gameFontType").Value = Core.PhoneFont;
				val8.Field<TextMeshProUGUI>("textMesh").Value = Instance.selectText;
				((TMP_Text)Instance.selectText).alignment = (TextAlignmentOptions)516;
				((TMP_Text)Instance.selectText).fontSize = 65f;
				((TMP_Text)Instance.selectText).font = font;
				((TMP_Text)Instance.selectText).text = "Graffiti Designs";
				Instance.prevText = Object.Instantiate<GameObject>(((Component)Instance.selectText).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<TextMeshProUGUI>();
				((Object)Instance.prevText).name = "Previous Text";
				((Graphic)Instance.prevText).color = AppBlue;
				((TMP_Text)Instance.prevText).fontSize = 45f;
				((TMP_Text)Instance.prevText).transform.localPosition = new Vector3(-155f, 550f, 0f);
				Instance.next1Text = Object.Instantiate<GameObject>(((Component)Instance.prevText).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<TextMeshProUGUI>();
				((Object)Instance.next1Text).name = "Next 1 Text";
				((TMP_Text)Instance.next1Text).transform.localPosition = new Vector3(-155f, -75f, 0f);
				Instance.next2Text = Object.Instantiate<GameObject>(((Component)Instance.next1Text).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<TextMeshProUGUI>();
				((Object)Instance.next2Text).name = "Next 2 Text";
				((TMP_Text)Instance.next2Text).transform.localPosition = new Vector3(-155f, -225f, 0f);
				Instance.toggleText = Object.Instantiate<GameObject>(((Component)Instance.next2Text).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<TextMeshProUGUI>();
				((Object)Instance.toggleText).name = "Toggle Text";
				((Graphic)Instance.toggleText).color = AppOrange;
				((TMP_Text)Instance.toggleText).fontSize = 75f;
				((TMP_Text)Instance.toggleText).text = "Disable";
				((TMP_Text)Instance.toggleText).transform.localPosition = new Vector3(-175f, -650f, 0f);
				Instance.pinCount = Object.Instantiate<GameObject>(((Component)Instance.toggleText).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<TextMeshProUGUI>();
				((Object)Instance.pinCount).name = "Pin Count";
				((Graphic)Instance.pinCount).color = Color.white;
				((TMP_Text)Instance.pinCount).fontSize = 60f;
				((TMP_Text)Instance.pinCount).transform.localPosition = new Vector3(-175f, -750f, 0f);
				GameObject val9 = new GameObject
				{
					name = "Selection IsActive",
					layer = 24
				};
				val9.transform.SetParent((Transform)(object)((App)Instance).Content);
				Instance.toggleSelectIcon = val9.AddComponent<Image>();
				Instance.toggleSelectIcon.sprite = TrueSprite;
				((Component)Instance.toggleSelectIcon).transform.localScale = Vector3.one;
				((Component)Instance.toggleSelectIcon).transform.localPosition = new Vector3(450f, 250f, 0f);
				Instance.togglePrevIcon = Object.Instantiate<GameObject>(((Component)Instance.toggleSelectIcon).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<Image>();
				((Object)Instance.togglePrevIcon).name = "Previous Icon";
				((Graphic)Instance.togglePrevIcon).color = AppBlue;
				((Component)Instance.togglePrevIcon).transform.localPosition = new Vector3(460f, 550f, 0f);
				((Component)Instance.togglePrevIcon).transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
				Instance.toggleNext1Icon = Object.Instantiate<GameObject>(((Component)Instance.togglePrevIcon).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<Image>();
				((Object)Instance.toggleNext1Icon).name = "Next 1 Icon";
				((Component)Instance.toggleNext1Icon).transform.localPosition = new Vector3(460f, -75f, 0f);
				Instance.toggleNext2Icon = Object.Instantiate<GameObject>(((Component)Instance.togglePrevIcon).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<Image>();
				((Object)Instance.toggleNext2Icon).name = "Next 2 Icon";
				((Component)Instance.toggleNext2Icon).transform.localPosition = new Vector3(460f, -225f, 0f);
				GameObject val10 = new GameObject
				{
					name = "Pin",
					layer = 24
				};
				val10.transform.SetParent((Transform)(object)((App)Instance).Content);
				Instance.pin = val10.AddComponent<Image>();
				Instance.pin.sprite = PinSprite;
				((Component)Instance.pin).GetComponent<RectTransform>().sizeDelta = new Vector2(128f, 256f);
				((Component)Instance.pin).transform.localScale = new Vector3(2f, 2f, 1f);
				((Component)Instance.pin).transform.localPosition = new Vector3(-325f, -200f, 0f);
				Instance.specialIcon = Object.Instantiate<GameObject>(((Component)Instance.pin).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<Image>();
				((Object)Instance.specialIcon).name = "Special Icon";
				((Component)Instance.specialIcon).transform.localPosition = ((Component)Instance.pin).transform.localPosition;
				((Component)Instance.specialIcon).GetComponent<RectTransform>().sizeDelta = new Vector2(128f, 128f);
				Instance.pinX = Object.Instantiate<GameObject>(((Component)Instance.pin).gameObject, (Transform)(object)((App)Instance).Content).GetComponent<Image>();
				((Object)Instance.pinX).name = "PinX";
				((Component)Instance.pinX).transform.localPosition = ((Component)Instance.pin).transform.localPosition;
				Instance.pinX.sprite = PinXSprite;
				((Component)Instance.pinX).gameObject.SetActive(false);
				HomeScreenApp val11 = ScriptableObject.CreateInstance<HomeScreenApp>();
				((Object)val11).name = "AppMap";
				Traverse val12 = Traverse.Create((object)val11);
				val12.Field<HomeScreenAppType>("appType").Value = (HomeScreenAppType)0;
				val12.Field<string>("m_AppName").Value = "AppMap";
				val12.Field<string>("m_DisplayName").Value = "APP_MAP_HEADER";
				val12.Field<Sprite>("m_AppIcon").Value = AppIcon;
				Traverse.Create((object)value).Field<Dictionary<string, App>>("<AppInstances>k__BackingField").Value.Add("AppMap", (App)(object)Instance);
				Traverse.Create((object)value.GetAppInstance<AppHomeScreen>()).Method("AddApp", new object[1] { val11 }).GetValue();
			}
		}

		public void LoadMinimapSprites()
		{
			//IL_002e: 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_007a: 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_00c6: 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)
			TaxiSprite = Sprite.Create(Core.Instance.Assets.LoadAssetFromBundle<Texture2D>("minimap", "assets/games/phone/appassets/minimap/taxipin.png"), new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
			ToiletSprite = Sprite.Create(Core.Instance.Assets.LoadAssetFromBundle<Texture2D>("minimap", "assets/games/phone/appassets/minimap/toiletpin.png"), new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
			CypherSprite = Sprite.Create(Core.Instance.Assets.LoadAssetFromBundle<Texture2D>("minimap", "assets/games/phone/appassets/minimap/cypherpin.png"), new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
		}

		private string GetOptionName(AppMapOptions option)
		{
			if (1 == 0)
			{
			}
			string result = option switch
			{
				AppMapOptions.GraffitiSpot => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_GRAFFITI_SPOT"), 
				AppMapOptions.Taxi => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_TAXI"), 
				AppMapOptions.Toilet => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_TOILET"), 
				AppMapOptions.Cypher => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_CYPHER"), 
				AppMapOptions.GraffitiCollectible => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_GRAFFITI_COLLECTIBLE"), 
				AppMapOptions.Music => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_MUSIC"), 
				AppMapOptions.Outfit => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_OUTFIT"), 
				AppMapOptions.Movestyle => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_MOVESTYLE"), 
				AppMapOptions.Character => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_CHARACTER"), 
				AppMapOptions.Polo => Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_TYPE_POLO"), 
				_ => "?", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private Color GetOptionColor(AppMapOptions option)
		{
			//IL_003a: 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_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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0059: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_009d: 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)
			if (1 == 0)
			{
			}
			Color result = (Color)(option switch
			{
				AppMapOptions.GraffitiSpot => Core.colorGraffitiSpot.Value, 
				AppMapOptions.GraffitiCollectible => Core.colorGraffitiCollectible.Value, 
				AppMapOptions.Music => Core.colorMusic.Value, 
				AppMapOptions.Outfit => Core.colorOutfit.Value, 
				AppMapOptions.Movestyle => Core.colorMovestyle.Value, 
				AppMapOptions.Character => Core.colorCharacter.Value, 
				AppMapOptions.Polo => Core.colorPolo.Value, 
				_ => Color.white, 
			});
			if (1 == 0)
			{
			}
			return result;
		}

		private bool OptionValue(AppMapOptions option, bool? value = null)
		{
			switch (option)
			{
			case AppMapOptions.GraffitiSpot:
				if (value.HasValue)
				{
					Core.showGraffitiSpot.Value = value.Value;
				}
				return Core.showGraffitiSpot.Value;
			case AppMapOptions.Taxi:
				if (value.HasValue)
				{
					Core.showTaxi.Value = value.Value;
				}
				return Core.showTaxi.Value;
			case AppMapOptions.Toilet:
				if (value.HasValue)
				{
					Core.showToilet.Value = value.Value;
				}
				return Core.showToilet.Value;
			case AppMapOptions.Cypher:
				if (value.HasValue)
				{
					Core.showCypher.Value = value.Value;
				}
				return Core.showCypher.Value;
			case AppMapOptions.GraffitiCollectible:
				if (value.HasValue)
				{
					Core.showGraffitiCollectible.Value = value.Value;
				}
				return Core.showGraffitiCollectible.Value;
			case AppMapOptions.Music:
				if (value.HasValue)
				{
					Core.showMusic.Value = value.Value;
				}
				return Core.showMusic.Value;
			case AppMapOptions.Outfit:
				if (value.HasValue)
				{
					Core.showOutfit.Value = value.Value;
				}
				return Core.showOutfit.Value;
			case AppMapOptions.Movestyle:
				if (value.HasValue)
				{
					Core.showMovestyle.Value = value.Value;
				}
				return Core.showMovestyle.Value;
			case AppMapOptions.Character:
				if (value.HasValue)
				{
					Core.showCharacter.Value = value.Value;
				}
				return Core.showCharacter.Value;
			case AppMapOptions.Polo:
				if (value.HasValue)
				{
					Core.showPolo.Value = value.Value;
				}
				return Core.showPolo.Value;
			default:
				return true;
			}
		}

		public override void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			((App)this).Awake();
			Core.Instance.Localizer.OnLanguageChanged += new OnLanguageChangedDelegate(UpdateLanguage);
			LoadMinimapSprites();
		}

		public void OnDestroy()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Core.Instance.Localizer.OnLanguageChanged -= new OnLanguageChangedDelegate(UpdateLanguage);
		}

		public override void OnAppUpdate()
		{
			((App)this).OnAppUpdate();
			UpdateCount();
		}

		public override void OnAppEnable()
		{
			((App)this).OnAppEnable();
			((App)this).HandleInput = true;
			UpdateText();
			UpdateImages();
		}

		public override void OnAppDisable()
		{
			((App)this).OnAppDisable();
			((App)this).HandleInput = false;
		}

		public override void OnReleaseLeft()
		{
			((App)this).OnReleaseLeft();
			((App)this).MyPhone.CloseCurrentApp();
		}

		public override void OnReleaseUp()
		{
			PlaySfx((SfxCollectionID)14, (AudioClipID)308);
			CurrentOption--;
			if (CurrentOption < AppMapOptions.GraffitiSpot)
			{
				CurrentOption = AppMapOptions.Polo;
			}
			UpdateText();
			UpdateImages();
		}

		public override void OnReleaseDown()
		{
			PlaySfx((SfxCollectionID)14, (AudioClipID)308);
			CurrentOption++;
			if (CurrentOption > AppMapOptions.Polo)
			{
				CurrentOption = AppMapOptions.GraffitiSpot;
			}
			UpdateText();
			UpdateImages();
		}

		public override void OnReleaseRight()
		{
			PlaySfx((SfxCollectionID)14, (AudioClipID)308);
			OptionValue(CurrentOption, !OptionValue(CurrentOption));
			if (CurrentOption == AppMapOptions.Polo && OptionValue(AppMapOptions.Polo))
			{
				PinManager.Instance.EnablePhotoPins();
			}
			else
			{
				PinManager.Instance.SetPinsEnabled(GetPinsForOption(CurrentOption), OptionValue(CurrentOption));
			}
			UpdateText();
			UpdateImages();
		}

		public void UpdateText()
		{
			((TMP_Text)selectText).text = GetOptionName(CurrentOption);
			((TMP_Text)prevText).text = GetOptionName(PrevOption);
			((TMP_Text)next1Text).text = GetOptionName(Next1Option);
			((TMP_Text)next2Text).text = GetOptionName(Next2Option);
			((TMP_Text)toggleText).text = (OptionValue(CurrentOption) ? Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_DISABLE") : Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_ENABLE"));
		}

		public void UpdateCount()
		{
			if (OptionValue(CurrentOption))
			{
				int num = PinManager.Instance.CountActivePins(GetPinsForOption(CurrentOption));
				((TMP_Text)pinCount).text = ((num == 1) ? string.Format(Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_COUNT_SINGLE"), num) : string.Format(Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_COUNT"), num));
				((Component)pinCount).gameObject.SetActive(true);
			}
			else
			{
				((Component)pinCount).gameObject.SetActive(false);
			}
		}

		public void UpdateImages()
		{
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentOption == AppMapOptions.Taxi || CurrentOption == AppMapOptions.Toilet || CurrentOption == AppMapOptions.Cypher)
			{
				((Component)pin).gameObject.SetActive(false);
				((Component)specialIcon).gameObject.SetActive(true);
				if (CurrentOption == AppMapOptions.Taxi)
				{
					specialIcon.sprite = TaxiSprite;
				}
				else if (CurrentOption == AppMapOptions.Toilet)
				{
					specialIcon.sprite = ToiletSprite;
				}
				else if (CurrentOption == AppMapOptions.Cypher)
				{
					specialIcon.sprite = CypherSprite;
				}
				((Graphic)specialIcon).color = (Color)(OptionValue(CurrentOption) ? Color.white : new Color(1f, 1f, 1f, 0.5f));
				((Component)pinX).gameObject.SetActive(!OptionValue(CurrentOption));
			}
			else
			{
				((Component)specialIcon).gameObject.SetActive(false);
				((Component)pin).gameObject.SetActive(true);
				pin.sprite = (OptionValue(CurrentOption) ? PinSprite : PinDisabledSprite);
				((Graphic)pin).color = GetOptionColor(CurrentOption);
				((Component)pinX).gameObject.SetActive(!OptionValue(CurrentOption));
			}
			toggleSelectIcon.sprite = (OptionValue(CurrentOption) ? TrueSprite : FalseSprite);
			togglePrevIcon.sprite = (OptionValue(PrevOption) ? TrueSprite : FalseSprite);
			toggleNext1Icon.sprite = (OptionValue(Next1Option) ? TrueSprite : FalseSprite);
			toggleNext2Icon.sprite = (OptionValue(Next2Option) ? TrueSprite : FalseSprite);
		}

		public List<MapPin> GetPinsForOption(AppMapOptions option)
		{
			if (1 == 0)
			{
			}
			List<MapPin> result = option switch
			{
				AppMapOptions.GraffitiSpot => PinManager.Instance.graffitiSpotPins, 
				AppMapOptions.Taxi => PinManager.Instance.taxiPins, 
				AppMapOptions.Toilet => PinManager.Instance.toiletPins, 
				AppMapOptions.Cypher => PinManager.Instance.cypherPins, 
				AppMapOptions.GraffitiCollectible => PinManager.Instance.graffitiCollectiblePins, 
				AppMapOptions.Music => PinManager.Instance.musicPins, 
				AppMapOptions.Outfit => PinManager.Instance.outfitPins, 
				AppMapOptions.Movestyle => PinManager.Instance.movestylePins, 
				AppMapOptions.Character => PinManager.Instance.characterPins, 
				AppMapOptions.Polo => PinManager.Instance.poloPins, 
				_ => null, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		public void UpdateLanguage(SystemLanguage language)
		{
			((TMP_Text)title).text = Core.Instance.Localizer.GetRawTextValue((Subgroups)0, "APP_MAP_HEADER");
			UpdateText();
		}

		public void PlaySfx(SfxCollectionID collectionId, AudioClipID audioClipId)
		{
			//IL_001d: 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)
			Traverse.Create((object)Core.Instance.AudioManager).Method("PlaySfxGameplay", new object[3] { collectionId, audioClipId, 0f }).GetValue();
		}
	}
	[BepInPlugin("trpg.brc.moremap", "MoreMap", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Core : BaseUnityPlugin
	{
		public const string PluginGUID = "trpg.brc.moremap";

		public const string PluginName = "MoreMap";

		public const string PluginVersion = "1.1.0";

		public static ManualLogSource Logger = Logger.CreateLogSource("MoreMap");

		public static ConfigEntry<bool> requireMap;

		public static ConfigEntry<bool> showGraffitiSpot;

		public static ConfigEntry<bool> showTaxi;

		public static ConfigEntry<bool> showToilet;

		public static ConfigEntry<bool> showCypher;

		public static ConfigEntry<bool> showGraffitiCollectible;

		public static ConfigEntry<bool> showMusic;

		public static ConfigEntry<bool> showOutfit;

		public static ConfigEntry<bool> showMovestyle;

		public static ConfigEntry<bool> showCharacter;

		public static ConfigEntry<bool> showPolo;

		public static ConfigEntry<Color> colorGraffitiSpot;

		public static ConfigEntry<Color> colorGraffitiCollectible;

		public static ConfigEntry<Color> colorMusic;

		public static ConfigEntry<Color> colorOutfit;

		public static ConfigEntry<Color> colorMovestyle;

		public static ConfigEntry<Color> colorCharacter;

		public static ConfigEntry<Color> colorPolo;

		public static Core Instance { get; private set; }

		public static AssetBundle Bundle { get; private set; } = AssetBundle.LoadFromMemory(Resources.moremap);


		public PluginLocalizer Localizer { get; private set; }

		public static GameFontType PhoneFont { get; private set; }

		private void Awake()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance != (Object)null)
			{
				Object.Destroy((Object)(object)this);
			}
			Instance = this;
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			Localizer = new PluginLocalizer("MoreMap", Path.Combine(directoryName, "Languages"), (SystemLanguage)10);
			Localizer.OnInitializationFinished += (OnInitializationFinishedDelegate)delegate
			{
				PhoneFont = Localizer.LoadFontTypeAndRemoveUnusedFonts((GameFontTypes)30);
			};
			Harmony val = new Harmony("MoreMap");
			val.PatchAll();
			StageManager.OnStagePostInitialization += (OnStageInitializedDelegate)delegate
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				bool mapFound = Core.Instance.SaveManager.CurrentSaveSlot.GetCurrentStageProgress().mapFound;
				Logger.LogInfo((object)$"Current stage: {Core.Instance.BaseModule.CurrentStage} | Map found? {mapFound}");
				if (mapFound || !requireMap.Value)
				{
					DoMapSetup();
				}
			};
			requireMap = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Require map", true, "Whether the map must be collected before the custom pins will appear.");
			showGraffitiSpot = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Graffiti Spot pins", true, (ConfigDescription)null);
			showTaxi = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Taxi pins", true, (ConfigDescription)null);
			showToilet = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Toilet pins", true, (ConfigDescription)null);
			showCypher = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Cypher Spot pins", true, (ConfigDescription)null);
			showGraffitiCollectible = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Graffiti Collectible pins", true, (ConfigDescription)null);
			showMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Music CD pins", true, (ConfigDescription)null);
			showOutfit = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Outfit pins", true, (ConfigDescription)null);
			showMovestyle = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Movestyle pins", true, (ConfigDescription)null);
			showCharacter = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Character pins", true, (ConfigDescription)null);
			showPolo = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "Show Polo pins", true, (ConfigDescription)null);
			colorGraffitiSpot = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Graffiti Spot pin color", new Color(0.956f, 0.827f, 0.258f), (ConfigDescription)null);
			colorGraffitiCollectible = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Graffiti Collectible pin color", new Color(0.953f, 0.259f, 0.259f), (ConfigDescription)null);
			colorMusic = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Music CD pin color", new Color(0.259f, 0.608f, 0.953f), (ConfigDescription)null);
			colorOutfit = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Outfit pin color", new Color(0.961f, 0.961f, 0.961f), (ConfigDescription)null);
			colorMovestyle = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Movestyle pin color", new Color(0.259f, 0.953f, 0.375f), (ConfigDescription)null);
			colorCharacter = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Character pin color", new Color(0.956f, 0.321f, 0.7339f), (ConfigDescription)null);
			colorPolo = ((BaseUnityPlugin)this).Config.Bind<Color>("Colors", "Polo pin color", new Color(0.259f, 0.259f, 0.957f), (ConfigDescription)null);
		}

		public void DoMapSetup()
		{
			((Component)Mapcontroller.Instance).gameObject.AddComponent<PinManager>();
			AppMap.DoAppSetup();
		}

		public void DelayMapSetup(float seconds)
		{
			((MonoBehaviour)this).Invoke("DoMapSetup", seconds);
		}
	}
	public class PinManager : MonoBehaviour
	{
		public Mapcontroller Mapcontroller;

		public Traverse MapcontrollerT;

		public List<MapPin> objectivePins = new List<MapPin>();

		public List<MapPin> graffitiSpotPins = new List<MapPin>();

		public List<MapPin> taxiPins = new List<MapPin>();

		public List<MapPin> toiletPins = new List<MapPin>();

		public List<MapPin> cypherPins = new List<MapPin>();

		public List<MapPin> graffitiCollectiblePins = new List<MapPin>();

		public List<MapPin> musicPins = new List<MapPin>();

		public List<MapPin> outfitPins = new List<MapPin>();

		public List<MapPin> movestylePins = new List<MapPin>();

		public List<MapPin> characterPins = new List<MapPin>();

		public List<MapPin> poloPins = new List<MapPin>();

		public Dictionary<VendingMachine, MapPin> vendingMachineLinks = new Dictionary<VendingMachine, MapPin>();

		public List<GameObject> characterNPCs = new List<GameObject>();

		public Dictionary<MapPin, MapPin> tempRacerLinks = new Dictionary<MapPin, MapPin>();

		public Dictionary<PhotoObjectiveProgressable, MapPin> poloLinks = new Dictionary<PhotoObjectiveProgressable, MapPin>();

		public static PinManager Instance { get; private set; }

		public void Start()
		{
			if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this))
			{
				Instance = this;
				Mapcontroller = ((Component)this).GetComponent<Mapcontroller>();
				MapcontrollerT = Traverse.Create((object)Mapcontroller);
				FindAllPins();
			}
		}

		public void Update()
		{
			if (Core.showGraffitiCollectible.Value)
			{
				UpdatePins(graffitiCollectiblePins);
			}
			if (Core.showCharacter.Value)
			{
				UpdateCharacterPins();
				UpdateTempRacerPins();
			}
		}

		public void FindAllPins()
		{
			GetExistingPins();
			CreatePinsFromProgressables();
			CreateCharacterPins();
			CreateVendingMachinePins();
			DisableAllPins(poloPins);
			if (Core.showPolo.Value)
			{
				EnablePhotoPins();
			}
			Core.Logger.LogInfo((object)"Finished pin setup.");
		}

		public void GetExistingPins()
		{
			//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_0044: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected I4, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			foreach (MapPin item in MapcontrollerT.Field<List<MapPin>>("m_MapPins").Value)
			{
				Traverse val = Traverse.Create((object)item);
				PinType value = val.Field<PinType>("m_pinType").Value;
				PinType val2 = value;
				switch (val2 - 1)
				{
				case 0:
					graffitiSpotPins.Add(item);
					break;
				case 1:
					objectivePins.Add(item);
					break;
				case 2:
					taxiPins.Add(item);
					break;
				case 3:
					toiletPins.Add(item);
					break;
				case 4:
					cypherPins.Add(item);
					break;
				}
				SetPinColor(item, GetPinColor(item));
			}
		}

		public void CreatePinsFromProgressables()
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00cb: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected I4, but got Unknown
			//IL_016a: 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_00e8: Invalid comparison between Unknown and I4
			foreach (AProgressable progressable in WorldHandler.instance.SceneObjectsRegister.progressables)
			{
				if (!(progressable is Collectable) && !(progressable is PhotoObjectiveProgressable))
				{
					continue;
				}
				Traverse val = Traverse.Create((object)progressable);
				MapPin value = MapcontrollerT.Method("CreatePin", new object[1] { (object)(PinType)1 }).GetValue<MapPin>();
				value.AssignGameplayEvent(((Component)progressable).gameObject);
				if (progressable is PhotoObjectiveProgressable)
				{
					value.InitMapPin((PinType)0);
				}
				else
				{
					value.InitMapPin((PinType)2);
				}
				value.OnPinEnable();
				if (progressable is Collectable)
				{
					PickUpType value2 = val.Field<PickUpType>("pickUpType").Value;
					PickUpType val2 = value2;
					switch (val2 - 3)
					{
					default:
						if ((int)val2 == 11)
						{
							movestylePins.Add(value);
						}
						break;
					case 0:
						musicPins.Add(value);
						break;
					case 1:
						graffitiCollectiblePins.Add(value);
						break;
					case 2:
						outfitPins.Add(value);
						break;
					}
				}
				else
				{
					PhotoObjectiveProgressable val3 = (PhotoObjectiveProgressable)(object)((progressable is PhotoObjectiveProgressable) ? progressable : null);
					if (val3 != null)
					{
						poloPins.Add(value);
						poloLinks.Add(val3, value);
					}
				}
				SetPinColor(value, GetPinColor(value));
			}
		}

		public void CreateCharacterPins()
		{
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Invalid comparison between Unknown and I4
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Invalid comparison between Unknown and I4
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<Stage, List<string>> dictionary = new Dictionary<Stage, List<string>>
			{
				{
					(Stage)4,
					new List<string> { "NPC_Rave1", "NPC_Rave2", "NPC_Rave3", "NPC_Frank_UnlockChallenge", "NPC_Irene" }
				},
				{
					(Stage)11,
					new List<string> { "NPC_DJ_UnlockChallenge" }
				},
				{
					(Stage)12,
					new List<string> { "Graffiti_Challenge/NPC_rogue", "Score_Challenge /NPC_crew", "WaterChallenge/NPC_rogue", "WaterChallenge/NPC_rogue (1)", "Chapter6/NPC_Eclipe_UnlockChallenge" }
				},
				{
					(Stage)6,
					new List<string> { "ShineNPC1", "ShineNPC2", "ShineNPC3", "ShineNPC4", "NPC_DOTEXE_UnlockChallenge" }
				},
				{
					(Stage)9,
					new List<string> { "NPC_Rogue_PufferGirl (1)", "NPC_Rogue_PufferGirl_Start", "NPC_DevilTheory_UnlockChallenge" }
				},
				{
					(Stage)7,
					new List<string> { "NPC_coil1", "NPC_coil2", "NPC_coil3", "NPC_coil4", "NPC_Futurism_UnlockChallenge", "NPC_FlesPrince_UnlockDance" }
				}
			};
			List<NPC> list = new List<NPC>();
			Stage currentStage = Core.Instance.BaseModule.CurrentStage;
			if (!dictionary.ContainsKey(currentStage))
			{
				return;
			}
			foreach (NPC nPC in WorldHandler.instance.SceneObjectsRegister.NPCs)
			{
				if ((int)currentStage == 12)
				{
					if (!((Object)(object)((Component)nPC).transform.parent == (Object)null) && dictionary[currentStage].Contains(((Object)((Component)nPC).transform.parent).name + "/" + ((Object)nPC).name))
					{
						list.Add(nPC);
					}
				}
				else if (dictionary[currentStage].Contains(((Object)nPC).name))
				{
					list.Add(nPC);
				}
			}
			foreach (NPC item in list)
			{
				characterNPCs.Add(((Component)item).gameObject);
				MapPin value = MapcontrollerT.Method("CreatePin", new object[1] { (object)(PinType)1 }).GetValue<MapPin>();
				MapPin val = null;
				if (Traverse.Create((object)item).Field<bool>("activeTempRacerWithDialogue").Value)
				{
					foreach (Player player in WorldHandler.instance.SceneObjectsRegister.players)
					{
						Traverse val2 = Traverse.Create((object)player);
						if ((int)val2.Field<PlayerType>("playerType").Value == 2 && (Object)(object)val2.Field<PlayerAI>("AI").Value.linkedNPC == (Object)(object)item)
						{
							Core.Logger.LogInfo((object)"Creating temp racer for linked NPC!");
							val = MapcontrollerT.Method("CreatePin", new object[1] { (object)(PinType)1 }).GetValue<MapPin>();
							val.AssignGameplayEvent(((Component)player).gameObject);
							((Component)player).gameObject.AddComponent<TempRacerLink>().SetPin(val);
							val.InitMapPin((PinType)2);
							val.OnPinEnable();
							characterPins.Add(val);
							SetPinColor(val, GetPinColor(val));
							break;
						}
					}
				}
				value.AssignGameplayEvent(((Component)item).gameObject);
				value.InitMapPin((PinType)2);
				value.OnPinEnable();
				characterPins.Add(value);
				SetPinColor(value, GetPinColor(value));
				if ((Object)(object)val != (Object)null)
				{
					tempRacerLinks.Add(val, value);
				}
			}
		}

		public void CreateVendingMachinePins()
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			VendingMachine[] array = Object.FindObjectsOfType<VendingMachine>(true);
			foreach (VendingMachine val in array)
			{
				if (!val.rewards.Contains((Reward)4))
				{
					continue;
				}
				for (int j = 0; j < val.rewards.Length; j++)
				{
					if ((int)val.rewards[j] == 4 && val.RewardIsValid(j))
					{
						MapPin value = MapcontrollerT.Method("CreatePin", new object[1] { (object)(PinType)1 }).GetValue<MapPin>();
						value.AssignGameplayEvent(((Component)val).gameObject);
						value.InitMapPin((PinType)0);
						value.OnPinEnable();
						AUnlockable unlock = ((Pickup)val.unlockableDrop.GetComponent<DynamicPickup>()).unlock;
						if (unlock is MusicTrack)
						{
							musicPins.Add(value);
						}
						else if (unlock is GraffitiAppEntry)
						{
							graffitiCollectiblePins.Add(value);
						}
						else if (unlock is OutfitUnlockable)
						{
							outfitPins.Add(value);
						}
						else if (unlock is MoveStyleSkin)
						{
							movestylePins.Add(value);
						}
						SetPinColor(value, GetPinColor(value));
						vendingMachineLinks.Add(val, value);
					}
				}
			}
		}

		public void RemovePin(MapPin pin)
		{
			List<MapPin> value = MapcontrollerT.Field<List<MapPin>>("m_MapPins").Value;
			if (value.Contains(pin))
			{
				value.Remove(pin);
			}
			MapcontrollerT.Field<List<MapPin>>("m_MapPins").Value = value;
		}

		public void UpdatePins(List<MapPin> list)
		{
			foreach (MapPin item in list)
			{
				if (!vendingMachineLinks.ContainsValue(item))
				{
					Traverse val = Traverse.Create((object)item);
					if (val.Field<GameObject>("m_ObjectiveObject").Value.activeInHierarchy)
					{
						item.UpdateLocation();
						val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
					}
					else
					{
						val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
					}
				}
			}
		}

		public void UpdateCharacterPins()
		{
			foreach (MapPin characterPin in characterPins)
			{
				if (!tempRacerLinks.ContainsKey(characterPin) && !tempRacerLinks.ContainsValue(characterPin))
				{
					Traverse val = Traverse.Create((object)characterPin);
					if (val.Field<GameObject>("m_ObjectiveObject").Value.activeInHierarchy)
					{
						characterPin.UpdateLocation();
						val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
					}
					else
					{
						val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
					}
				}
			}
		}

		public void UpdateTempRacerPins()
		{
			foreach (MapPin key in tempRacerLinks.Keys)
			{
				Traverse val = Traverse.Create((object)key);
				Traverse val2 = Traverse.Create((object)tempRacerLinks[key]);
				if (!val.Field<GameObject>("m_ObjectiveObject").Value.activeInHierarchy && !val2.Field<GameObject>("m_ObjectiveObject").Value.activeInHierarchy)
				{
					val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
					val2.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
				else if (val.Field<GameObject>("m_ObjectiveObject").Value.activeInHierarchy)
				{
					key.UpdateLocation();
					val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
					val2.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
				else
				{
					tempRacerLinks[key].UpdateLocation();
					val2.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
					val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
			}
		}

		public void SetPinsEnabled(List<MapPin> list, bool value)
		{
			if (value)
			{
				EnableAllPins(list);
			}
			else
			{
				DisableAllPins(list);
			}
		}

		public void EnableAllPins(List<MapPin> list)
		{
			foreach (MapPin item in list)
			{
				Traverse val = Traverse.Create((object)item);
				val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
			}
		}

		public void DisableAllPins(List<MapPin> list)
		{
			foreach (MapPin item in list)
			{
				Traverse.Create((object)item).Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
			}
		}

		public int CountActivePins(List<MapPin> list)
		{
			int num = 0;
			foreach (MapPin item in list)
			{
				if (Traverse.Create((object)item).Field<bool>("isMapPinActive").Value)
				{
					num++;
				}
			}
			return num;
		}

		public void EnablePhotoPins()
		{
			foreach (PhotoObjectiveProgressable key in poloLinks.Keys)
			{
				if (!key.HasPhotoGraphedObject)
				{
					Traverse.Create((object)poloLinks[key]).Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
			}
		}

		public bool CanColorThisPin(MapPin pin)
		{
			if (objectivePins.Contains(pin) || taxiPins.Contains(pin) || toiletPins.Contains(pin) || cypherPins.Contains(pin))
			{
				return false;
			}
			return true;
		}

		public Color GetPinColor(MapPin pin)
		{
			//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_0036: 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_00ef: 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_005b: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//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_00b6: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			if (graffitiSpotPins.Contains(pin))
			{
				return Core.colorGraffitiSpot.Value;
			}
			if (graffitiCollectiblePins.Contains(pin))
			{
				return Core.colorGraffitiCollectible.Value;
			}
			if (musicPins.Contains(pin))
			{
				return Core.colorMusic.Value;
			}
			if (outfitPins.Contains(pin))
			{
				return Core.colorOutfit.Value;
			}
			if (movestylePins.Contains(pin))
			{
				return Core.colorMovestyle.Value;
			}
			if (characterPins.Contains(pin))
			{
				return Core.colorCharacter.Value;
			}
			if (poloPins.Contains(pin))
			{
				return Core.colorPolo.Value;
			}
			return (Color)((ConfigEntryBase)Core.colorGraffitiSpot).DefaultValue;
		}

		public void SetPinColor(MapPin pin, Color color)
		{
			//IL_0030: 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)
			if (CanColorThisPin(pin))
			{
				((Renderer)((Component)((Component)pin).transform.Find("Cube")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", color);
				((Renderer)((Component)pin).GetComponent<LineRenderer>()).material.color = color;
			}
		}
	}
	public class TempRacerLink : MonoBehaviour
	{
		private MapPin linkedPin;

		public void SetPin(MapPin pin)
		{
			linkedPin = pin;
		}

		private void OnDestroy()
		{
			Core.Logger.LogInfo((object)"Linked temp racer is being destroyed!");
			if ((Object)(object)PinManager.Instance != (Object)null)
			{
				if (PinManager.Instance.characterPins.Contains(linkedPin))
				{
					PinManager.Instance.characterPins.Remove(linkedPin);
				}
				if (PinManager.Instance.tempRacerLinks.ContainsKey(linkedPin))
				{
					PinManager.Instance.tempRacerLinks.Remove(linkedPin);
				}
				PinManager.Instance.RemovePin(linkedPin);
			}
			if ((Object)(object)linkedPin != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)linkedPin).gameObject);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoreMap";

		public const string PLUGIN_NAME = "MoreMap";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace MoreMap.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("MoreMap.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] moremap
		{
			get
			{
				object @object = ResourceManager.GetObject("moremap", resourceCulture);
				return (byte[])@object;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace MoreMap.Patches
{
	[HarmonyPatch(typeof(Battle), "StartBattle")]
	public class Battle_StartBattle_Patch
	{
		public static void Prefix()
		{
			WorldHandler.instance.RemoveTempRacers((NPC)null);
		}
	}
	[HarmonyPatch(typeof(HomescreenButton), "SetContent")]
	internal class HomescreenButton_SetContent_Patch
	{
		public static void Postfix(HomescreenButton __instance)
		{
			if (__instance.AssignedApp.AppName == "AppMap")
			{
				((TMP_Text)Traverse.Create((object)__instance).Field<TextMeshProUGUI>("m_TitleLabel").Value).text = Core.Instance.Localizer.GetRawTextValue((Subgroups)0, __instance.AssignedApp.DisplayName);
			}
		}
	}
	[HarmonyPatch(typeof(MapPin), "RefreshGraffitiMapPin")]
	public class MapPin_RefreshGraffitiMapPin_Patch
	{
		public static bool Prefix(MapPin __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			if (!val.Field<GameObject>("graffitiSpotGameObject").Value.activeSelf || ((Object)(object)val.Field<GameObject>("containingChapterObject").Value != (Object)null && !val.Field<GameObject>("containingChapterObject").Value.activeSelf) || ((Object)(object)val.Field<GameObject>("containingProgressObject").Value != (Object)null && !val.Field<GameObject>("containingProgressObject").Value.activeSelf))
			{
				if (val.Field<bool>("isMapPinActive").Value)
				{
					val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
				return false;
			}
			if (!Core.showGraffitiSpot.Value || val.Field("m_GraffitiSpot").Method("ClaimedByPlayableCrew", Array.Empty<object>()).GetValue<bool>())
			{
				if (val.Field<bool>("isMapPinActive").Value)
				{
					val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
				return false;
			}
			if (!Core.requireMap.Value || Core.Instance.SaveManager.CurrentSaveSlot.GetCurrentStageProgress().mapFound)
			{
				__instance.UpdateLocation();
				if (!val.Field<bool>("isMapPinActive").Value)
				{
					val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
				}
				return false;
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(MapPin), "RefreshTaxiPin")]
	public class MapPin_RefreshTaxiPin_Patch
	{
		public static bool Prefix(MapPin __instance)
		{
			if (!Core.showTaxi.Value)
			{
				Traverse.Create((object)__instance).Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				return false;
			}
			if (!Core.requireMap.Value)
			{
				Traverse.Create((object)__instance).Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MapPin), "RefreshToiletPin")]
	public class MapPin_RefreshToiletPin_Patch
	{
		public static bool Prefix(MapPin __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			if (!Core.showToilet.Value || !val.Field<PublicToilet>("toilet").Value.CanSwap)
			{
				val.Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				return false;
			}
			val.Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
			return false;
		}
	}
	[HarmonyPatch(typeof(MapPin), "RefreshCypherPin")]
	public class MapPin_RefreshCypherPin_Patch
	{
		public static bool Prefix(MapPin __instance)
		{
			if (!Core.showCypher.Value)
			{
				Traverse.Create((object)__instance).Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
				return false;
			}
			if (!Core.requireMap.Value)
			{
				Traverse.Create((object)__instance).Method("EnableMapPinGameObject", Array.Empty<object>()).GetValue();
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PhotoObjectiveProgressable), "MadePhotograph")]
	public class PhotoObjectiveProgressable_MadePhotograph_Patch
	{
		public static void Postfix(PhotoObjectiveProgressable __instance)
		{
			if ((Object)(object)PinManager.Instance != (Object)null && PinManager.Instance.poloLinks.ContainsKey(__instance))
			{
				Traverse.Create((object)PinManager.Instance.poloLinks[__instance]).Method("DisableMapPinGameObject", Array.Empty<object>()).GetValue();
			}
		}
	}
	[HarmonyPatch(typeof(Pickup), "ApplyPickupType")]
	public class Pickup_ApplyPickupType
	{
		public static void Postfix(PickUpType pickupType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			if ((Object)(object)PinManager.Instance == (Object)null && (int)pickupType == 10)
			{
				Core.Instance.DelayMapSetup(0.25f);
			}
		}
	}
	[HarmonyPatch(typeof(Type))]
	public class Type_GetType_Patch
	{
		[HarmonyPatch("GetType", new Type[] { typeof(string) })]
		public static void Postfix(string typeName, ref Type __result)
		{
			if (typeName == "Reptile.Phone.AppMap")
			{
				__result = typeof(AppMap);
			}
		}
	}
	[HarmonyPatch(typeof(VendingMachine), "SetState")]
	public class VendingMachine_SetState_Patch
	{
		public static void Postfix(VendingMachine __instance, object __0)
		{
			if ((int)__0 == 3 && __instance.rewards.Length != 0 && (int)__instance.rewards[Traverse.Create((object)__instance).Field<int>("rewardCount").Value] == 4 && (Object)(object)PinManager.Instance != (Object)null && PinManager.Instance.vendingMachineLinks.ContainsKey(__instance))
			{
				MapPin val = PinManager.Instance.vendingMachineLinks[__instance];
				if (PinManager.Instance.musicPins.Contains(val))
				{
					PinManager.Instance.musicPins.Remove(val);
				}
				if (PinManager.Instance.graffitiCollectiblePins.Contains(val))
				{
					PinManager.Instance.graffitiCollectiblePins.Remove(val);
				}
				if (PinManager.Instance.outfitPins.Contains(val))
				{
					PinManager.Instance.outfitPins.Remove(val);
				}
				if (PinManager.Instance.movestylePins.Contains(val))
				{
					PinManager.Instance.movestylePins.Remove(val);
				}
				PinManager.Instance.vendingMachineLinks.Remove(__instance);
				PinManager.Instance.RemovePin(val);
				if ((Object)(object)((Component)val).gameObject != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
		}
	}
	[HarmonyPatch(typeof(WorldHandler), "CreateTempRacer")]
	public class WorldHandler_CreateTempRacer_Patch
	{
		public static void Postfix(Player __result, NPC linkedNPC, TempRacer tempRacerSetup, Dialogue hookedUpToNPCDialogue = null)
		{
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)PinManager.Instance != (Object)null) || !((Object)(object)linkedNPC != (Object)null) || !PinManager.Instance.characterNPCs.Contains(((Component)linkedNPC).gameObject))
			{
				return;
			}
			Core.Logger.LogInfo((object)"Creating temp racer for linked NPC!");
			MapPin value = PinManager.Instance.MapcontrollerT.Method("CreatePin", new object[1] { (object)(PinType)1 }).GetValue<MapPin>();
			value.AssignGameplayEvent(((Component)__result).gameObject);
			((Component)__result).gameObject.AddComponent<TempRacerLink>().SetPin(value);
			value.InitMapPin((PinType)2);
			value.OnPinEnable();
			foreach (MapPin characterPin in PinManager.Instance.characterPins)
			{
				if ((Object)(object)Traverse.Create((object)characterPin).Field<GameObject>("m_ObjectiveObject").Value == (Object)(object)((Component)linkedNPC).gameObject)
				{
					PinManager.Instance.tempRacerLinks.Add(value, characterPin);
				}
			}
			PinManager.Instance.characterPins.Add(value);
			PinManager.Instance.SetPinColor(value, PinManager.Instance.GetPinColor(value));
		}
	}
	[HarmonyPatch(typeof(WorldHandler), "RemoveTempRacers")]
	public class WorldHandler_RemoveTempRacers_Patch
	{
		public static void Postfix()
		{
			if (!((Object)(object)PinManager.Instance != (Object)null))
			{
				return;
			}
			for (int i = 0; i < PinManager.Instance.characterPins.Count; i++)
			{
				if ((Object)(object)Traverse.Create((object)PinManager.Instance.characterPins[i]).Field<GameObject>("m_ObjectiveObject").Value == (Object)null)
				{
					PinManager.Instance.characterPins.RemoveAt(i);
				}
			}
			PinManager.Instance.tempRacerLinks.Clear();
		}
	}
}