Decompiled source of Score Attack Local Training v1.2.0

ScoreAttackPlugin.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using CommonAPI;
using CommonAPI.Phone;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using Reptile.Phone;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Playables;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: AssemblyCompany("ScoreAttackPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScoreAttackPlugin")]
[assembly: AssemblyTitle("ScoreAttackPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ScoreAttack
{
	public class AppFPSLimit : CustomApp
	{
		public bool LimitFramerate = false;

		public int FpsLimit = 60;

		public int CurrentFps = 60;

		public override bool Available => false;

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppFPSLimit>("fps select", (Sprite)null);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("FPS Limit", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("30 fps");
			SimplePhoneButton obj = val;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(30);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 30! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("40 fps");
			SimplePhoneButton obj2 = val;
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(40);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 40! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("60 fps");
			SimplePhoneButton obj3 = val;
			((PhoneButton)obj3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj3).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(60);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 60! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("90 fps");
			SimplePhoneButton obj4 = val;
			((PhoneButton)obj4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj4).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(90);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 90! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("120 fps");
			SimplePhoneButton obj5 = val;
			((PhoneButton)obj5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj5).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(120);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 120! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("144 fps");
			SimplePhoneButton obj6 = val;
			((PhoneButton)obj6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj6).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(144);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 144! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("240 fps");
			SimplePhoneButton obj7 = val;
			((PhoneButton)obj7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj7).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(240);
				Core.Instance.UIManager.ShowNotification("FPS Limit has been set to 240! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Unlimited");
			SimplePhoneButton obj8 = val;
			((PhoneButton)obj8).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj8).OnConfirm, (Action)delegate
			{
				SetTargetFrameRate(-1);
				Core.Instance.UIManager.ShowNotification("Your FPS has no limits! Make sure VSync is off for it to go into effect.", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private void SetTargetFrameRate(int frameRate)
		{
			Application.targetFrameRate = frameRate;
			ScoreAttackSaveData.Instance.TargetFrameRate = frameRate;
		}
	}
	public class AppMoveStyle : CustomApp
	{
		private Player player;

		private WorldHandler world;

		private bool coreHasBeenSetup;

		public override bool Available => false;

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppMoveStyle>("move styles", (Sprite)null);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Change Style", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			player = WorldHandler.instance.GetCurrentPlayer();
			world = WorldHandler.instance;
			coreHasBeenSetup = (Object)(object)player != (Object)null && (Object)(object)world != (Object)null;
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Skateboard");
			SimplePhoneButton obj = val;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				if (coreHasBeenSetup)
				{
					SwapStyle((MoveStyle)2);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Inline Skates");
			SimplePhoneButton obj2 = val;
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
				if (coreHasBeenSetup)
				{
					SwapStyle((MoveStyle)3);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("BMX");
			SimplePhoneButton obj3 = val;
			((PhoneButton)obj3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj3).OnConfirm, (Action)delegate
			{
				if (coreHasBeenSetup)
				{
					SwapStyle((MoveStyle)1);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private void SwapStyle(MoveStyle newStyle)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null)
			{
				Ability val = (Ability)Traverse.Create((object)player).Field("ability").GetValue();
				GrindAbility val2 = (GrindAbility)Traverse.Create((object)player).Field("grindAbility").GetValue();
				WallrunLineAbility val3 = (WallrunLineAbility)Traverse.Create((object)player).Field("wallrunAbility").GetValue();
				player.InitMovement(newStyle);
				if (val == val2)
				{
					player.SwitchToEquippedMovestyle(true, false, true, true);
				}
				else if (val == val3)
				{
					player.SwitchToEquippedMovestyle(true, true, true, true);
				}
				else
				{
					player.SwitchToEquippedMovestyle(true, true, true, true);
				}
			}
		}
	}
	public class AppPolice : CustomApp
	{
		private WantedManager wantedManager;

		public override bool Available => false;

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppPolice>("remove police", (Sprite)null);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Wanted Level", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Remove Police");
			SimplePhoneButton obj = val;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				if (PlayerIsWanted())
				{
					wantedManager.StopPlayerWantedStatus(true);
				}
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				currentPlayer.ResetHP();
				if (currentPlayer.AmountOfCuffs() > 0)
				{
					currentPlayer.RemoveAllCuffs((CuffMissileLauncher)null);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Enable Cops");
			SimplePhoneButton obj2 = val;
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		public void Update()
		{
			wantedManager = WantedManager.instance;
		}

		public bool PlayerIsWanted()
		{
			if ((Object)(object)wantedManager != (Object)null)
			{
				return wantedManager.Wanted;
			}
			return false;
		}

		public void StopWantedStatus()
		{
			if (PlayerIsWanted())
			{
				Debug.Log((object)"Stopping wanted status...");
				wantedManager.StopPlayerWantedStatus(true);
			}
		}
	}
	public class AppScoreAttack : CustomApp
	{
		public static Encounter globalEncounter;

		private PhoneButton goToRespawnButton = null;

		private WantedManager wantedManager;

		public readonly Sprite EncounterIcon = TextureUtility.LoadSprite("encounter.png");

		public override bool Available => false;

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppScoreAttack>("score atk", (Sprite)null);
		}

		public override void OnAppInit()
		{
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Select Length", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("3 Minutes");
			SimplePhoneButton obj = val;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Debug.Log((object)"Starting 3 Minute Score Battle...");
				if (BannedMods.IsAdvantageousModLoaded())
				{
					Core.Instance.UIManager.ShowNotification("The score attack app is not compatible with TrickGod!", Array.Empty<string>());
				}
				else
				{
					BattleRefresh();
					Stage currentStage3 = Core.Instance.BaseModule.CurrentStage;
					RespawnPoint respawnPoint3 = ScoreAttackSaveData.Instance.GetRespawnPoint(currentStage3);
					if (respawnPoint3 == null)
					{
						Core.Instance.UIManager.ShowNotification("Please set a respawn point first!", Array.Empty<string>());
					}
					else
					{
						respawnPoint3.ApplyToPlayer(((App)this).MyPhone.player);
						ScoreAttackManager.StartScoreAttack(180f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
						ScoreAttackManager.StartScoreAttack(180f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
					}
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("5 Minutes");
			SimplePhoneButton obj2 = val;
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Debug.Log((object)"Starting 5 Minute Score Battle...");
				BattleRefresh();
				if (BannedMods.IsAdvantageousModLoaded())
				{
					Core.Instance.UIManager.ShowNotification("The score attack app is not compatible with TrickGod!", Array.Empty<string>());
				}
				else
				{
					Stage currentStage2 = Core.Instance.BaseModule.CurrentStage;
					RespawnPoint respawnPoint2 = ScoreAttackSaveData.Instance.GetRespawnPoint(currentStage2);
					if (respawnPoint2 == null)
					{
						Core.Instance.UIManager.ShowNotification("Please set a respawn point first!", Array.Empty<string>());
					}
					else
					{
						respawnPoint2.ApplyToPlayer(((App)this).MyPhone.player);
						ScoreAttackManager.StartScoreAttack(300f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
						ScoreAttackManager.StartScoreAttack(300f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
					}
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("10 Minutes");
			SimplePhoneButton obj3 = val;
			((PhoneButton)obj3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj3).OnConfirm, (Action)delegate
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				Debug.Log((object)"Starting 10 Minute Score Battle...");
				BattleRefresh();
				if (BannedMods.IsAdvantageousModLoaded())
				{
					Core.Instance.UIManager.ShowNotification("The score attack app is not compatible with TrickGod!", Array.Empty<string>());
				}
				else
				{
					Stage currentStage = Core.Instance.BaseModule.CurrentStage;
					RespawnPoint respawnPoint = ScoreAttackSaveData.Instance.GetRespawnPoint(currentStage);
					if (respawnPoint == null)
					{
						Core.Instance.UIManager.ShowNotification("Please set a respawn point first!", Array.Empty<string>());
					}
					else
					{
						respawnPoint.ApplyToPlayer(((App)this).MyPhone.player);
						ScoreAttackManager.StartScoreAttack(600f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
						ScoreAttackManager.StartScoreAttack(600f);
						((App)this).MyPhone.CloseCurrentApp();
						((App)this).MyPhone.TurnOff(false);
					}
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Cancel Run");
			SimplePhoneButton obj4 = val;
			((PhoneButton)obj4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj4).OnConfirm, (Action)delegate
			{
				Debug.Log((object)"Cancelling Active Battle...");
				if (ScoreAttackEncounter.IsScoreAttackActive())
				{
					ScoreAttackEncounter scoreAttackEncounter2 = Object.FindObjectOfType<ScoreAttackEncounter>();
					scoreAttackEncounter2.EndScoreAttack();
					Core.Instance.SaveManager.SaveCurrentSaveSlot();
				}
				else
				{
					Core.Instance.UIManager.ShowNotification("There is no ongoing Score Battle run!", Array.Empty<string>());
				}
			});
			val.LabelUnselectedColor = Color.black;
			val.LabelSelectedColor = Color.red;
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Erase All Your Personal Bests");
			SimplePhoneButton obj5 = val;
			((PhoneButton)obj5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj5).OnConfirm, (Action)delegate
			{
				Debug.Log((object)"Clearing Personal Bests...");
				ScoreAttackEncounter scoreAttackEncounter = Object.FindObjectOfType<ScoreAttackEncounter>();
				if ((Object)(object)scoreAttackEncounter != (Object)null)
				{
					if (ScoreAttackEncounter.IsScoreAttackActive())
					{
						Debug.LogError((object)"Can't clear PB during a battle!");
						Core.Instance.UIManager.ShowNotification("You are in a run! Cancel the run to clear your personal bests.", Array.Empty<string>());
					}
					else
					{
						scoreAttackEncounter.ClearPersonalBest();
						Core.Instance.UIManager.ShowNotification("Personal bests have been erased.", Array.Empty<string>());
					}
				}
				else
				{
					Debug.LogError((object)"ScoreAttackEncounter instance not found!");
				}
			});
			val.LabelUnselectedColor = Color.black;
			val.LabelSelectedColor = Color.red;
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		public static void InitializeEncounter()
		{
			globalEncounter = Object.FindObjectOfType<Encounter>();
			if ((Object)(object)globalEncounter == (Object)null)
			{
				Debug.LogError((object)"Error: Encounter object not found!");
			}
		}

		public static void BattleRefresh()
		{
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			currentPlayer.boostCharge = currentPlayer.maxBoostCharge;
			Debug.Log((object)"Respawning Pickups...");
			Object.FindObjectsOfType<Pickup>().Where(delegate(Pickup pickup)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: 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_0009: Invalid comparison between Unknown and I4
				PickUpType pickupType = pickup.pickupType;
				bool flag = (int)pickupType <= 1;
				return flag && (Object)(object)pickup.pickupObject != (Object)null;
			}).ToList()
				.ForEach(delegate(Pickup boost)
				{
					boost.SetPickupActive(true);
				});
			Debug.Log((object)"Restoring Vending Machines...");
			List<VendingMachine> list = (from vending in Object.FindObjectsOfType<VendingMachine>()
				where vending.rewardCount > 0
				select vending).ToList();
			foreach (VendingMachine item in list)
			{
				if (item.dropCount > 0)
				{
					item.dropCount = 0;
				}
			}
			foreach (VendingMachine item2 in list)
			{
				if (item2.rewardCount > 0)
				{
					item2.rewardCount = 0;
				}
			}
			foreach (VendingMachine item3 in list)
			{
				if (item3.firstHit)
				{
					item3.firstHit = false;
				}
			}
		}
	}
	public class AppScoreAttackOffline : CustomApp
	{
		private static Sprite IconSprite;

		private PhoneButton goToRespawnButton = null;

		private WantedManager wantedManager;

		public static void Initialize()
		{
			IconSprite = TextureUtility.LoadSprite(Path.Combine(ScoreAttackPlugin.Instance.Directory, "scoreIcon.png"));
			PhoneAPI.RegisterApp<AppScoreAttackOffline>("score atk", IconSprite);
		}

		public void UpdateGoToRespawnButton()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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)
			Stage currentStage = Core.Instance.BaseModule.CurrentStage;
			RespawnPoint respawnPoint = ScoreAttackSaveData.Instance.GetRespawnPoint(currentStage);
			if (respawnPoint == null)
			{
				if (base.ScrollView.HasButton(goToRespawnButton))
				{
					base.ScrollView.RemoveButton(goToRespawnButton);
				}
			}
			else if (!base.ScrollView.HasButton(goToRespawnButton))
			{
				base.ScrollView.AddButton(goToRespawnButton);
			}
		}

		public override void OnAppEnable()
		{
			((App)this).OnAppEnable();
			UpdateGoToRespawnButton();
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("Score Attack", IconSprite, 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Start a Run...");
			SimplePhoneButton obj = val;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.OpenApp(typeof(AppScoreAttack));
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Go to Stage...");
			SimplePhoneButton obj2 = val;
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.OpenApp(typeof(AppScoreAttackStageSelect));
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Change Style...");
			SimplePhoneButton obj3 = val;
			((PhoneButton)obj3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj3).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.OpenApp(typeof(AppMoveStyle));
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Refill Boost");
			SimplePhoneButton obj4 = val;
			((PhoneButton)obj4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj4).OnConfirm, (Action)delegate
			{
				Player currentPlayer2 = WorldHandler.instance.GetCurrentPlayer();
				currentPlayer2.boostCharge = currentPlayer2.maxBoostCharge;
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Reset Capsules");
			SimplePhoneButton obj5 = val;
			((PhoneButton)obj5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj5).OnConfirm, (Action)delegate
			{
				Debug.Log((object)"Respawning Pickups...");
				Object.FindObjectsOfType<Pickup>().Where(delegate(Pickup pickup)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: 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_0009: Invalid comparison between Unknown and I4
					PickUpType pickupType = pickup.pickupType;
					bool flag = (int)pickupType <= 1;
					return flag && (Object)(object)pickup.pickupObject != (Object)null;
				}).ToList()
					.ForEach(delegate(Pickup boost)
					{
						boost.SetPickupActive(true);
					});
				Debug.Log((object)"Restoring Vending Machines...");
				List<VendingMachine> list = (from vending in Object.FindObjectsOfType<VendingMachine>()
					where vending.rewardCount > 0
					select vending).ToList();
				foreach (VendingMachine item in list)
				{
					if (item.dropCount > 0)
					{
						item.dropCount = 0;
					}
				}
				foreach (VendingMachine item2 in list)
				{
					if (item2.rewardCount > 0)
					{
						item2.rewardCount = 0;
					}
				}
				foreach (VendingMachine item3 in list)
				{
					if (item3.firstHit)
					{
						item3.firstHit = false;
					}
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Reset Cops");
			SimplePhoneButton obj6 = val;
			((PhoneButton)obj6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj6).OnConfirm, (Action)delegate
			{
				if (PlayerIsWanted())
				{
					wantedManager.StopPlayerWantedStatus(true);
				}
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				currentPlayer.ResetHP();
				if (currentPlayer.AmountOfCuffs() > 0)
				{
					currentPlayer.RemoveAllCuffs((CuffMissileLauncher)null);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = PhoneUIUtility.CreateSimpleButton("Set Respawn");
			SimplePhoneButton obj7 = val;
			((PhoneButton)obj7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj7).OnConfirm, (Action)delegate
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: 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)
				//IL_003c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				Stage currentStage2 = Core.Instance.BaseModule.CurrentStage;
				Vector3 position = ((Component)((App)this).MyPhone.player).transform.position;
				Quaternion rotation = ((Component)((App)this).MyPhone.player).transform.rotation;
				bool usingEquippedMovestyle = ((App)this).MyPhone.player.usingEquippedMovestyle;
				ScoreAttackSaveData.Instance.SetRespawnPoint(currentStage2, position, rotation, usingEquippedMovestyle);
				UpdateGoToRespawnButton();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			goToRespawnButton = (PhoneButton)(object)PhoneUIUtility.CreateSimpleButton("Go to Respawn");
			PhoneButton obj8 = goToRespawnButton;
			obj8.OnConfirm = (Action)Delegate.Combine(obj8.OnConfirm, (Action)delegate
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: 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)
				Stage currentStage = Core.Instance.BaseModule.CurrentStage;
				ScoreAttackSaveData.Instance.GetRespawnPoint(currentStage)?.ApplyToPlayer(((App)this).MyPhone.player);
			});
			val = PhoneUIUtility.CreateSimpleButton("Set FPS Limit...");
			SimplePhoneButton obj9 = val;
			((PhoneButton)obj9).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj9).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.OpenApp(typeof(AppFPSLimit));
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		public void Update()
		{
			wantedManager = WantedManager.instance;
		}

		public bool PlayerIsWanted()
		{
			if ((Object)(object)wantedManager != (Object)null)
			{
				return wantedManager.Wanted;
			}
			return false;
		}

		public void StopWantedStatus()
		{
			if (PlayerIsWanted())
			{
				wantedManager.StopPlayerWantedStatus(true);
			}
		}
	}
	public class AppScoreAttackStageSelect : CustomApp
	{
		public override bool Available => false;

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppScoreAttackStageSelect>("stage select", (Sprite)null);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Stage Select", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = CreateStageButton("Hideout", (Stage)5);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Versum Hill", (Stage)4);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Millennium Square", (Stage)11);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Brink Terminal", (Stage)12);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Millennium Mall", (Stage)6);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Mataan", (Stage)7);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Pyramid Island", (Stage)9);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			val = CreateStageButton("Police Station", (Stage)8);
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private SimplePhoneButton CreateStageButton(string label, Stage stage)
		{
			//IL_0007: 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)
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(label);
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				Core.Instance.BaseModule.StageManager.ExitCurrentStage(stage, (Stage)(-1));
			});
			return val;
		}
	}
	public class BannedMods : BaseUnityPlugin
	{
		private void Awake()
		{
			if (IsAdvantageousModLoaded())
			{
				Core.Instance.UIManager.ShowNotification("The score attack app is not compatible with TrickGod!", Array.Empty<string>());
			}
		}

		public static bool IsAdvantageousModLoaded()
		{
			return Chainloader.PluginInfos.ContainsKey("TrickGod");
		}
	}
	public class RespawnPoint
	{
		public Vector3 Position = Vector3.zero;

		public Quaternion Rotation = Quaternion.identity;

		public bool Gear = false;

		public RespawnPoint(Vector3 position, Quaternion rotation, bool gear)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0026: 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_002d: 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)
			Position = position;
			Rotation = rotation;
			Gear = gear;
		}

		public void ApplyToPlayer(Player player)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			WorldHandler.instance.PlacePlayerAt(player, Position, Rotation, true);
			player.SwitchToEquippedMovestyle(Gear, false, true, true);
		}
	}
	public class ScoreAttackEncounter : Encounter
	{
		public float timeLimit = 40f;

		public float ScoreGot;

		private float timeLimitTimer;

		private CultureInfo cultureInfo;

		private float personalBestScore = 0f;

		private float displayBestScore = 0f;

		private float countdownTimer = 3f;

		private bool isCountdownFinished = false;

		private bool isNewBestDisplayed = false;

		private static bool isScoreAttackActive;

		private Stage currentStage;

		public override void InitSceneObject()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			cultureInfo = CultureInfo.CurrentCulture;
			base.makeUnavailableDuringEncounter = (GameObject[])(object)new GameObject[0];
			base.introSequence = null;
			base.currentCheckpoint = -1;
			base.OnIntro = new UnityEvent();
			base.OnStart = new UnityEvent();
			base.OnOutro = new UnityEvent();
			base.OnCompleted = new UnityEvent();
			base.OnFailed = new UnityEvent();
			base.stopWantedOnStart = false;
			((Encounter)this).InitSceneObject();
		}

		public override void StartMainEvent()
		{
			//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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			currentStage = Core.Instance.BaseModule.CurrentStage;
			base.player.grindAbility.trickTimer = 0f;
			base.player.RefreshAllDegrade();
			isScoreAttackActive = true;
			base.player.score = 0f;
			ScoreGot = 0f;
			isCountdownFinished = false;
			countdownTimer = 3f;
			personalBestScore = ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).GetPersonalBest(timeLimit);
			if (personalBestScore == -1f)
			{
				personalBestScore = 0f;
				ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).SetPersonalBest(timeLimit, personalBestScore);
			}
			((Encounter)this).StartMainEvent();
		}

		public override void UpdateMainEvent()
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			float scoreGot = ScoreGot;
			if (base.player.IsBusyWithSequence())
			{
				return;
			}
			if (!isCountdownFinished)
			{
				countdownTimer -= Core.dt;
				string text = Mathf.CeilToInt(countdownTimer).ToString();
				GameplayUI gameplay = Core.Instance.UIManager.gameplay;
				((TMP_Text)gameplay.timeLimitLabel).text = text + "...";
				if (countdownTimer <= 0f)
				{
					isCountdownFinished = true;
					timeLimitTimer = timeLimit;
					base.player.score = 0f;
					base.player.baseScore = 0f;
					base.player.scoreMultiplier = 0f;
				}
				return;
			}
			timeLimitTimer -= Core.dt;
			if (timeLimitTimer < 0f)
			{
				Core.Instance.AudioManager.PlaySfxUI((SfxCollectionID)19, (AudioClipID)680, 0f);
				isScoreAttackActive = false;
				timeLimitTimer = 0f;
			}
			ScoreGot = base.player.score + base.player.baseScore * base.player.scoreMultiplier;
			SetScoreUI();
			if (ScoreGot > personalBestScore)
			{
				personalBestScore = ScoreGot;
				ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).SetPersonalBest(timeLimit, personalBestScore);
				Core.Instance.SaveManager.SaveCurrentSaveSlot();
			}
			Core.Instance.SaveManager.SaveCurrentSaveSlot();
			if (personalBestScore != ScoreGot)
			{
				displayBestScore = personalBestScore;
			}
			else
			{
				displayBestScore = 0f;
			}
			if (timeLimitTimer > 0f)
			{
				((Encounter)this).UpdateMainEvent();
			}
			else
			{
				((Encounter)this).SetEncounterState((EncounterState)5);
			}
		}

		public void SetScoreUI()
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			GameplayUI gameplay = Core.Instance.UIManager.gameplay;
			gameplay.challengeGroup.SetActive(true);
			if (!isCountdownFinished)
			{
				if (!isScoreAttackActive)
				{
					((TMP_Text)gameplay.timeLimitLabel).text = "";
					((TMP_Text)gameplay.targetScoreLabel).text = "";
					((TMP_Text)gameplay.totalScoreLabel).text = "";
					((TMP_Text)gameplay.targetScoreTitleLabel).text = "";
					((TMP_Text)gameplay.totalScoreTitleLabel).text = "";
				}
				else
				{
					((TMP_Text)gameplay.timeLimitLabel).text = Mathf.CeilToInt(countdownTimer).ToString();
					((TMP_Text)gameplay.targetScoreLabel).text = "";
					((TMP_Text)gameplay.totalScoreLabel).text = "";
					((TMP_Text)gameplay.targetScoreTitleLabel).text = "";
					((TMP_Text)gameplay.totalScoreTitleLabel).text = "";
				}
				isNewBestDisplayed = false;
				return;
			}
			string text = NiceTimerString(timeLimitTimer);
			((TMP_Text)gameplay.timeLimitLabel).text = text;
			if (ScoreGot > personalBestScore)
			{
				personalBestScore = ScoreGot;
				isNewBestDisplayed = true;
				ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).SetPersonalBest(timeLimit, personalBestScore);
				Core.Instance.SaveManager.SaveCurrentSaveSlot();
			}
			if (isNewBestDisplayed)
			{
				((TMP_Text)gameplay.targetScoreLabel).text = "New Best!";
			}
			else
			{
				((TMP_Text)gameplay.targetScoreLabel).text = FormattingUtility.FormatPlayerScore(cultureInfo, personalBestScore);
			}
			((TMP_Text)gameplay.totalScoreLabel).text = FormattingUtility.FormatPlayerScore(cultureInfo, ScoreGot);
			((TMP_Text)gameplay.targetScoreTitleLabel).text = "Personal Best:";
			((TMP_Text)gameplay.totalScoreTitleLabel).text = timeLimit / 60f + " Min. Score:";
		}

		public void EndScoreAttack()
		{
			//IL_0008: 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)
			personalBestScore = ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).GetPersonalBest(timeLimit);
			if (ScoreGot > personalBestScore)
			{
				personalBestScore = ScoreGot;
				ScoreAttackSaveData.Instance.GetOrCreatePersonalBest(currentStage).SetPersonalBest(timeLimit, personalBestScore);
			}
			Core.Instance.SaveManager.SaveCurrentSaveSlot();
			isScoreAttackActive = false;
			countdownTimer = 0f;
			isCountdownFinished = false;
			TurnOffScoreUI();
			((Encounter)this).SetEncounterState((EncounterState)6);
		}

		public void TurnOffScoreUI()
		{
			GameplayUI gameplay = Core.Instance.UIManager.gameplay;
			gameplay.challengeGroup.SetActive(false);
			((TMP_Text)gameplay.timeLimitLabel).text = "";
			((TMP_Text)gameplay.targetScoreLabel).text = "";
			((TMP_Text)gameplay.totalScoreLabel).text = "";
			((TMP_Text)gameplay.targetScoreTitleLabel).text = "";
			((TMP_Text)gameplay.totalScoreTitleLabel).text = "";
		}

		private string NiceTimerString(float timer)
		{
			string text = timer.ToString();
			int num = ((int)timer).ToString().Length + 3;
			if (text.Length > num)
			{
				text = text.Remove(num);
			}
			if (timer == 0f)
			{
				text = "0.00";
			}
			return text;
		}

		public override void EnterEncounterState(EncounterState setState)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if ((int)setState == 0 || (int)setState == 2 || (int)setState == 1)
			{
				TurnOffScoreUI();
			}
			else
			{
				SetScoreUI();
			}
			((Encounter)this).EnterEncounterState(setState);
		}

		public override void ReadFromData()
		{
		}

		public override void WriteToData()
		{
		}

		public static bool IsScoreAttackActive()
		{
			return isScoreAttackActive;
		}

		public void ClearPersonalBest()
		{
			foreach (ScoreAttackSaveData.PersonalBest value in ScoreAttackSaveData.Instance.PersonalBestByStage.Values)
			{
				value.PersonalBestByTimeLimit.Clear();
			}
			Core.Instance.SaveManager.SaveCurrentSaveSlot();
			Core.Instance.UIManager.ShowNotification("All personal bests have been erased.", Array.Empty<string>());
		}

		public override void SetEncounterState(EncounterState setState)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected I4, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			base.stateTimer = 0f;
			base.state = setState;
			EncounterState state = base.state;
			EncounterState val = state;
			switch ((int)val)
			{
			case 0:
				((Encounter)this).EnterEncounterState((EncounterState)0);
				if ((Object)(object)WorldHandler.instance.currentEncounter == (Object)(object)this)
				{
					WorldHandler.instance.MakeStuffAvailableAgainCauseEncounterOver();
				}
				if ((Object)(object)base.player.phone != (Object)null)
				{
					base.player.phone.AllowPhone(true, true, false);
				}
				break;
			case 1:
				((Encounter)this).EnterEncounterState((EncounterState)1);
				break;
			case 2:
				if ((int)((GameplayEvent)this).openOn == 1 && ((GameplayEvent)this).requirement != 0)
				{
					WorldHandler.instance.ResetRequiredREP();
				}
				((GameplayEvent)this).requirement = 0;
				((Encounter)this).EnterEncounterState((EncounterState)2);
				base.shownOpening = true;
				break;
			case 3:
				WorldHandler.instance.StartEncounter((Encounter)(object)this);
				base.currentlyActive = true;
				((Encounter)this).ChangeSkybox(true);
				base.player.phone.AllowPhone(base.allowPhone, true, false);
				((Encounter)this).EnterEncounterState((EncounterState)3);
				((Encounter)this).SetEncounterState((EncounterState)4);
				SequenceHandler.instance.LetPlayerExitSequence();
				((AProgressable)this).WriteToData();
				break;
			case 4:
				((Encounter)this).EnterEncounterState((EncounterState)4);
				((Encounter)this).StartMainEvent();
				break;
			case 5:
				base.win = true;
				((Encounter)this).EnterEncounterState((EncounterState)5);
				break;
			case 6:
				((Encounter)this).EnterEncounterState((EncounterState)6);
				break;
			case 7:
				((Encounter)this).EnterEncounterState((EncounterState)7);
				if ((Object)(object)WorldHandler.instance.currentEncounter == (Object)(object)this)
				{
					WorldHandler.instance.MakeStuffAvailableAgainCauseEncounterOver();
				}
				((Encounter)this).SetEncounterState((EncounterState)0);
				((Encounter)this).Complete((PlayableDirector)null);
				break;
			case 8:
				((Encounter)this).EnterEncounterState((EncounterState)8);
				((Encounter)this).Fail((PlayableDirector)null);
				if (base.restartImmediatelyOnFail)
				{
					((Encounter)this).ActivateEncounterInstantIntro();
					break;
				}
				if ((Object)(object)WorldHandler.instance.currentEncounter == (Object)(object)this)
				{
					WorldHandler.instance.MakeStuffAvailableAgainCauseEncounterOver();
				}
				((Encounter)this).SetEncounterState((EncounterState)0);
				break;
			}
		}
	}
	public static class ScoreAttackManager
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StageInitializationDelegate <0>__OnStagePreInitialization;
		}

		public static ScoreAttackEncounter Encounter;

		private const string UID = "ea696dc2-28cb-46c4-abfa-4193199b7e98";

		internal static void Initialize()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//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_0021: Expected O, but got Unknown
			StageInitializationDelegate onStagePreInitialization = StageAPI.OnStagePreInitialization;
			object obj = <>O.<0>__OnStagePreInitialization;
			if (obj == null)
			{
				StageInitializationDelegate val = OnStagePreInitialization;
				<>O.<0>__OnStagePreInitialization = val;
				obj = (object)val;
			}
			StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)onStagePreInitialization, (Delegate?)obj);
		}

		private static void OnStagePreInitialization(Stage newStage, Stage previousStage)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("Score Attack Encounter");
			Encounter = val.AddComponent<ScoreAttackEncounter>();
			((AProgressable)Encounter).uid = "ea696dc2-28cb-46c4-abfa-4193199b7e98";
		}

		public static void StartScoreAttack(float timeLimit)
		{
			Encounter.timeLimit = timeLimit;
			((Encounter)Encounter).ActivateEncounter();
		}
	}
	[BepInPlugin("ScoreAttackPlugin", "ScoreAttackPlugin", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ScoreAttackPlugin : BaseUnityPlugin
	{
		private const string CommonAPIGUID = "CommonAPI";

		public static ScoreAttackPlugin Instance { get; private set; }

		public string Directory => Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);

		private void Awake()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			Instance = this;
			new ScoreAttackSaveData();
			AppScoreAttackOffline.Initialize();
			AppScoreAttackStageSelect.Initialize();
			AppScoreAttack.Initialize();
			AppFPSLimit.Initialize();
			ScoreAttackManager.Initialize();
			AppMoveStyle.Initialize();
			Harmony val = new Harmony("ScoreAttackPlugin");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ScoreAttackPlugin is loaded!");
		}
	}
	public class ScoreAttackSaveData : CustomSaveData
	{
		public class PersonalBest
		{
			public Dictionary<float, float> PersonalBestByTimeLimit = new Dictionary<float, float>();

			public float GetPersonalBest(float timeLimit)
			{
				if (PersonalBestByTimeLimit.TryGetValue(timeLimit, out var value))
				{
					return value;
				}
				return -1f;
			}

			public void SetPersonalBest(float timeLimit, float best)
			{
				PersonalBestByTimeLimit[timeLimit] = best;
			}
		}

		private readonly Dictionary<Stage, RespawnPoint> respawnPoints = new Dictionary<Stage, RespawnPoint>();

		public Dictionary<Stage, PersonalBest> PersonalBestByStage = new Dictionary<Stage, PersonalBest>();

		public static ScoreAttackSaveData Instance { get; private set; }

		public int TargetFrameRate { get; set; }

		public PersonalBest GetOrCreatePersonalBest(Stage stage)
		{
			//IL_0007: 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)
			if (PersonalBestByStage.TryGetValue(stage, out var value))
			{
				return value;
			}
			value = new PersonalBest();
			PersonalBestByStage[stage] = value;
			return value;
		}

		public ScoreAttackSaveData()
			: base("ScoreAttackPlugin", "{0}.data")
		{
			Instance = this;
		}

		public void SetRespawnPoint(Stage stage, Vector3 position, Quaternion rotation, bool gear)
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			RespawnPoint value = new RespawnPoint(position, rotation, gear);
			respawnPoints[stage] = value;
			Core.Instance.SaveManager.SaveCurrentSaveSlot();
		}

		public RespawnPoint GetRespawnPoint(Stage stage)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if (respawnPoints.TryGetValue(stage, out var value))
			{
				return value;
			}
			return null;
		}

		public override void Initialize()
		{
			respawnPoints.Clear();
		}

		public override void Read(BinaryReader reader)
		{
			//IL_001d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			byte b = reader.ReadByte();
			int num = reader.ReadInt32();
			Vector3 position = default(Vector3);
			Quaternion rotation = default(Quaternion);
			for (int i = 0; i < num; i++)
			{
				Stage key = (Stage)reader.ReadInt32();
				float num2 = reader.ReadSingle();
				float num3 = reader.ReadSingle();
				float num4 = reader.ReadSingle();
				float num5 = reader.ReadSingle();
				float num6 = reader.ReadSingle();
				float num7 = reader.ReadSingle();
				float num8 = reader.ReadSingle();
				bool gear = reader.ReadBoolean();
				((Vector3)(ref position))..ctor(num2, num3, num4);
				((Quaternion)(ref rotation))..ctor(num5, num6, num7, num8);
				RespawnPoint value = new RespawnPoint(position, rotation, gear);
				respawnPoints[key] = value;
			}
			int num9 = reader.ReadInt32();
			for (int j = 0; j < num9; j++)
			{
				Stage key2 = (Stage)reader.ReadInt32();
				PersonalBest personalBest = new PersonalBest();
				int num10 = reader.ReadInt32();
				for (int k = 0; k < num10; k++)
				{
					float timeLimit = reader.ReadSingle();
					float best = reader.ReadSingle();
					personalBest.SetPersonalBest(timeLimit, best);
				}
				PersonalBestByStage[key2] = personalBest;
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				TargetFrameRate = reader.ReadInt32();
				if (TargetFrameRate != -1)
				{
					Application.targetFrameRate = TargetFrameRate;
				}
			}
			else
			{
				TargetFrameRate = 60;
				Application.targetFrameRate = TargetFrameRate;
			}
		}

		public override void Write(BinaryWriter writer)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected I4, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected I4, but got Unknown
			writer.Write((byte)0);
			writer.Write(respawnPoints.Count);
			foreach (KeyValuePair<Stage, RespawnPoint> respawnPoint in respawnPoints)
			{
				writer.Write((int)respawnPoint.Key);
				RespawnPoint value = respawnPoint.Value;
				writer.Write(value.Position.x);
				writer.Write(value.Position.y);
				writer.Write(value.Position.z);
				writer.Write(value.Rotation.x);
				writer.Write(value.Rotation.y);
				writer.Write(value.Rotation.z);
				writer.Write(value.Rotation.w);
				writer.Write(value.Gear);
			}
			writer.Write(PersonalBestByStage.Count);
			foreach (KeyValuePair<Stage, PersonalBest> item in PersonalBestByStage)
			{
				writer.Write((int)item.Key);
				PersonalBest value2 = item.Value;
				writer.Write(value2.PersonalBestByTimeLimit.Count);
				foreach (KeyValuePair<float, float> item2 in value2.PersonalBestByTimeLimit)
				{
					writer.Write(item2.Key);
					writer.Write(item2.Value);
				}
			}
			writer.Write(TargetFrameRate);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ScoreAttackPlugin";

		public const string PLUGIN_NAME = "ScoreAttackPlugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ScoreAttack.Patches
{
	[HarmonyPatch(typeof(Player))]
	internal static class CornerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("LandCombo")]
		private static void LandCombo_Prefix(Player __instance)
		{
			Encounter currentEncounter = WorldHandler.instance.currentEncounter;
			if (__instance.IsComboing() && (Object)(object)currentEncounter != (Object)null && currentEncounter is ScoreAttackEncounter)
			{
				__instance.ClearMultipliersDone();
			}
		}
	}
	[HarmonyPatch(typeof(NPC))]
	internal static class NPCPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("SetAvailable")]
		private static bool SetAvailable_Prefix(bool set, NPC __instance)
		{
			Encounter currentEncounter = WorldHandler.instance.currentEncounter;
			if (!set && (Object)(object)currentEncounter != (Object)null && currentEncounter is ScoreAttackEncounter && ((GameplayEvent)__instance).available)
			{
				((GameplayEvent)__instance).available = false;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Phone))]
	internal static class PhonePatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("PushNotification")]
		private static bool PushNotification_Prefix(App app)
		{
			Encounter currentEncounter = WorldHandler.instance.currentEncounter;
			if (((object)app).GetType().Name == "AppEncounters" && (Object)(object)currentEncounter != (Object)null && currentEncounter is ScoreAttackEncounter)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal static class PlayerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("EndGraffitiMode")]
		private static void EndGraffitiMode_Prefix(ref Encounter __state)
		{
			Encounter currentEncounter = WorldHandler.instance.currentEncounter;
			if (currentEncounter is ScoreAttackEncounter)
			{
				__state = currentEncounter;
				WorldHandler.instance.currentEncounter = null;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("EndGraffitiMode")]
		private static void EndGraffitiMode_Postfix(ref Encounter __state)
		{
			if ((Object)(object)__state != (Object)null)
			{
				WorldHandler.instance.currentEncounter = __state;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}