Decompiled source of Sicklines v0.0.6

Sicklines/Sicklines.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CommonAPI;
using CommonAPI.Phone;
using EmailApi;
using HarmonyLib;
using MoveStyler;
using Reptile;
using Reptile.Phone;
using Sicklines.AiPaths;
using Sicklines.App;
using Sicklines.Asset;
using Sicklines.Properties;
using Sicklines.Utility;
using SicklinesMono;
using TMPro;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("Sicklines")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Sicklines - Create and complete sicklines")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Sicklines")]
[assembly: AssemblyTitle("Sicklines")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal static class JsonUtilityEx
{
	[Serializable]
	private class Wrapper<T>
	{
		public T[] array;
	}

	public static T[] getJsonArray<T>(string json)
	{
		return JsonUtility.FromJson<Wrapper<T>>("{ \"array\": " + json + "}").array;
	}

	public static string arrayToJson<T>(T[] array)
	{
		return JsonUtility.ToJson((object)new Wrapper<T>
		{
			array = array
		});
	}
}
namespace Sicklines
{
	[BepInPlugin("Ariki.Sicklines", "Sicklines", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string CharacterAPIGuid = "com.Viliger.CharacterAPI";

		private const string CommonAPIGUID = "CommonAPI";

		private const string EmailAPIGUID = "EmailApi";

		private const string MovestylerGUID = "Ariki.MoveStylers";

		public static bool MovestylerLoaded;

		private void Awake()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Sicklines v1.0.0 starting...");
			MovestylerLoaded = Chainloader.PluginInfos.ContainsKey("Ariki.MoveStylers");
			if (MovestylerLoaded)
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Found Movestyler");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Movestyler Not found...");
			}
			new Harmony("ariki.Sicklines").PatchAll();
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Init SaveManager");
			SickLines_SaveManager.Initialize();
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Init PathConstructor");
			PathConstructor.Initialize(((BaseUnityPlugin)this).Config);
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Init Phone App");
			SickLinesApp.Initialize();
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Init Emails");
			SickLine_Emails.Initialize();
		}

		private void Update()
		{
			_ = Time.deltaTime;
			if (PathConstructor.CurrentPath != null)
			{
				if (PathConstructor.newPath && PathConstructor._target.IsComboing())
				{
					PathConstructor.newPath = false;
					PathConstructor.startedCombo = true;
				}
				else if (PathConstructor.startedCombo && !PathConstructor._target.IsComboing())
				{
					ResetPosition(1f);
					PathConstructor.startedCombo = false;
				}
			}
		}

		public void ResetPosition(float delay)
		{
			((MonoBehaviour)this).StartCoroutine(DelayResetPosition(delay));
		}

		private IEnumerator DelayResetPosition(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			PathConstructor.endPath(returnToStart: true);
		}

		private IEnumerator LoopAddAirWaypoint(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			PathConstructor.endPath(returnToStart: true);
		}
	}
	internal class Sicklines_Encounter : ComboEncounter
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Sicklines_Encounter");

		public CustomAiPath Path;

		public void StartIntro()
		{
			ReadyPlayerOverride();
		}

		public override void StartMainEvent()
		{
			((Encounter)this).currentCheckpoint = 0;
			base.trackSetup.SetActive(true);
			StartPlayer();
			foreach (Collider checkpointTrigger in base.checkpointTriggers)
			{
				((Component)checkpointTrigger).gameObject.SetActive(true);
			}
		}

		public override void TriggerDetectPlayer(Collider trigger, Player player)
		{
			if (player.isAI || ((Encounter)this).currentCheckpoint >= base.checkpointTriggers.Count)
			{
				return;
			}
			bool flag = (Object)(object)base.checkpointTriggers[((Encounter)this).currentCheckpoint] == (Object)(object)trigger;
			SickLines_WaypointType component = ((Component)trigger).gameObject.GetComponent<SickLines_WaypointType>();
			if (!((Object)(object)component == (Object)null))
			{
				bool flag2 = IsDoingWaypointAction(component.WaypointType);
				if (flag && flag2)
				{
					((Encounter)this).currentCheckpoint = ((Encounter)this).currentCheckpoint + 1;
					PlayCollectSound();
					((Component)trigger).gameObject.SetActive(false);
					((ComboEncounter)this).TriggerDetectPlayer(trigger, player);
				}
			}
		}

		public override void EnterEncounterState(EncounterState setState)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((int)setState == 5)
			{
				PlaySuccessSound();
				successfulRun();
			}
			else if ((int)setState == 6)
			{
				PlayFailSound();
				FailedRun();
			}
			((Encounter)this).EnterEncounterState(setState);
		}

		private void PlayCollectSound()
		{
			Core.Instance.AudioManager.PlaySfxGameplay((SfxCollectionID)19, (AudioClipID)409, 0f);
		}

		private void PlaySuccessSound()
		{
			Core.Instance.AudioManager.PlaySfxGameplay((SfxCollectionID)19, (AudioClipID)680, 0f);
		}

		private void PlayFailSound()
		{
			Core.Instance.AudioManager.PlaySfxGameplay((SfxCollectionID)19, (AudioClipID)984, 0f);
		}

		public void ReadyPlayerOverride()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			if ((Object)(object)currentPlayer == (Object)null)
			{
				DebugLog.LogMessage((object)"currentPlayer == null");
			}
			currentPlayer.cam.ResetCameraPositionRotation();
			WorldHandler.instance.PlaceCurrentPlayerAt(base.playerSpawner, true);
			PlayerSpawner component = ((Component)base.playerSpawner).GetComponent<PlayerSpawner>();
			if ((Object)(object)component != (Object)null)
			{
				component.SetReached();
			}
			base.checkpointTriggersHit.Clear();
			currentPlayer.ClearMultipliersDone();
			currentPlayer.lastScore = 0f;
			currentPlayer.tricksInLastCombo = 0;
			currentPlayer.lastCornered = 0;
			currentPlayer.SetCurrentMoveStyleEquipped(Path.movestyleEquipped, true, true);
			currentPlayer.StopCurrentAbility();
			if (Path.startUsingMovestyle)
			{
				currentPlayer.SwitchToEquippedMovestyle(!currentPlayer.usingEquippedMovestyle, false, true, true);
			}
			else
			{
				currentPlayer.SwitchToEquippedMovestyle(false, false, true, false);
			}
			currentPlayer.userInputEnabled = false;
		}

		public void StartPlayer()
		{
			WorldHandler.instance.GetCurrentPlayer().userInputEnabled = true;
			base.playerInStartTriggerTimer = 3f;
		}

		public void FailedRun()
		{
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			if ((Object)(object)currentPlayer == (Object)null)
			{
				DebugLog.LogMessage((object)"currentPlayer == null");
			}
			currentPlayer.cam.ResetCameraPositionRotation();
			WorldHandler.instance.PlaceCurrentPlayerAt(base.playerSpawner, true);
			foreach (Collider checkpointTrigger in base.checkpointTriggers)
			{
				((Component)checkpointTrigger).gameObject.SetActive(false);
			}
			Path.triggerLine.GetComponent<SickLines_Trigger>().OnFailed();
		}

		public void successfulRun()
		{
			if (PathLoader.Instance.tryGetPathfileFromCustomPath(Path, out var pathfile))
			{
				SickLines_Save.Instance.setPathState(pathfile, state: true);
			}
			PathConstructor.setLineTriggerColour(Path.triggerLine, SickLines_Trigger.Linestate.Complete);
		}

		public bool IsDoingWaypointAction(WaypointType waypointType)
		{
			bool result = false;
			switch (waypointType)
			{
			default:
				result = true;
				break;
			case WaypointType.basic:
				result = true;
				break;
			case WaypointType.jump:
				result = true;
				break;
			case WaypointType.landing:
				result = true;
				break;
			case WaypointType.trick:
				result = ((Encounter)this).player.ability is GroundTrickAbility;
				break;
			case WaypointType.trickBoosted:
				result = ((Encounter)this).player.ability is GroundTrickAbility && (((Encounter)this).player.boostButtonHeld || ((Encounter)this).player.boostButtonNew);
				break;
			case WaypointType.slide:
				result = ((Encounter)this).player.ability is SlideAbility;
				break;
			case WaypointType.slideEnd:
				result = true;
				break;
			case WaypointType.wallrun:
				result = true;
				break;
			case WaypointType.wallrunLeft:
				result = true;
				break;
			case WaypointType.wallrunRight:
				result = true;
				break;
			case WaypointType.airtrick:
				result = ((Encounter)this).player.ability is AirTrickAbility;
				break;
			case WaypointType.airtrickBoosted:
				result = ((Encounter)this).player.ability is AirTrickAbility && (((Encounter)this).player.boostButtonHeld || ((Encounter)this).player.boostButtonNew);
				break;
			case WaypointType.airdash:
				result = ((Encounter)this).player.ability is AirDashAbility;
				break;
			case WaypointType.grind:
				result = true;
				break;
			case WaypointType.grindLeft:
				if (((Encounter)this).player.ability is GrindAbility)
				{
					Ability ability4 = ((Encounter)this).player.ability;
					result = ((GrindAbility)((ability4 is GrindAbility) ? ability4 : null)).cornerBoost > 0f;
				}
				break;
			case WaypointType.grindRight:
				if (((Encounter)this).player.ability is GrindAbility)
				{
					Ability ability3 = ((Encounter)this).player.ability;
					result = ((GrindAbility)((ability3 is GrindAbility) ? ability3 : null)).cornerBoost > 0f;
				}
				break;
			case WaypointType.grindTrick:
				if (((Encounter)this).player.ability is GrindAbility)
				{
					Ability ability2 = ((Encounter)this).player.ability;
					GrindAbility val2 = (GrindAbility)(object)((ability2 is GrindAbility) ? ability2 : null);
					result = val2.trickTimer > 0f && !val2.curTrickBoost;
				}
				break;
			case WaypointType.grindTrickBoosted:
				if (((Encounter)this).player.ability is GrindAbility)
				{
					Ability ability = ((Encounter)this).player.ability;
					GrindAbility val = (GrindAbility)(object)((ability is GrindAbility) ? ability : null);
					result = val.trickTimer > 0f && val.curTrickBoost;
				}
				break;
			case WaypointType.boost:
				result = ((Encounter)this).player.boosting;
				break;
			case WaypointType.boostEnd:
				result = !((Encounter)this).player.boosting;
				break;
			case WaypointType.movestyleSwitch:
				result = ((Encounter)this).player.ability is SwitchMoveStyleAbility;
				break;
			case WaypointType.dance:
				result = true;
				break;
			case WaypointType.hidden:
				result = true;
				break;
			}
			return result;
		}
	}
	public class SickLines_Trigger : CustomInteractable
	{
		public enum Linestate
		{
			local,
			unCompleted,
			Complete
		}

		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Player Patches");

		private int PathID;

		private Player aiPlayer;

		private CustomAiPath Path;

		private Sicklines_Encounter _Encounter;

		public void SickLinesTrigger_init(CustomAiPath _path)
		{
			Path = _path;
			SetupEncounter();
		}

		private void Awake()
		{
		}

		public override void Interact(Player player)
		{
			StartEncounter(2f);
		}

		public void TriggerLine()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (Path == null)
			{
				return;
			}
			Transform transform = ((Component)this).transform;
			if ((Object)(object)aiPlayer != (Object)null)
			{
				WorldHandler.instance.RemovePlayer(aiPlayer);
			}
			if ((int)Path.movestyleEquipped > 5)
			{
				if (Plugin.MovestylerLoaded)
				{
					if (!moveStyleDatabase.HasMovestyle(Path.movestyleEquipped))
					{
						Path.movestyleEquipped = (MoveStyle)2;
					}
				}
				else
				{
					Path.movestyleEquipped = (MoveStyle)2;
				}
			}
			Path.character = (Characters)(Path.character % 26);
			aiPlayer = WorldHandler.instance.SetupAIPlayerAt(transform, Path.character, (PlayerType)3, Path.outfit, Path.movestyleEquipped, (Crew)1);
			aiPlayer.AI.SetPath(Path.RuntimePath, true, true);
			aiPlayer.AI.state = (PlayerAIState)2;
			PathConstructor.setAiPlayerMaterial(aiPlayer, !Path.Loaded);
			aiPlayer.AI.alignToNPCWaitTimer = -66f;
		}

		private void SetupEncounter()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject($"ComboEncounter_{PathID}");
			GameObject val2 = new GameObject("trackObj");
			val2.transform.SetParent(val.transform, false);
			List<Collider> checkpointTriggers = new List<Collider>();
			_Encounter = val.AddComponent<Sicklines_Encounter>();
			_Encounter.Path = Path;
			((ComboEncounter)_Encounter).playerSpawner = ((Component)Path.RuntimePath.firstWaypoint).transform;
			((ComboEncounter)_Encounter).trackSetup = val2;
			((ComboEncounter)_Encounter).playerInStartTriggerTimer = 15f;
			((Encounter)_Encounter).OnIntro = new UnityEvent();
			((Encounter)_Encounter).OnStart = new UnityEvent();
			((Encounter)_Encounter).OnOutro = new UnityEvent();
			((Encounter)_Encounter).OnFailed = new UnityEvent();
			((Encounter)_Encounter).OnCompleted = new UnityEvent();
			((Encounter)_Encounter).makeUnavailableDuringEncounter = (GameObject[])(object)new GameObject[0];
			((AProgressable)_Encounter).OnRegisterToSceneObjectsRegister(WorldHandler.instance.sceneObjectsRegister);
			GameObject val3 = new GameObject("spawner");
			val3.transform.SetParent(val2.transform, false);
			val3.transform.position = ((Component)Path.RuntimePath.firstWaypoint).transform.position;
			val3.transform.rotation = ((Component)Path.RuntimePath.firstWaypoint).transform.rotation;
			foreach (PlayerAIWaypoint waypoint in Path.RuntimePath.waypoints)
			{
				string text = "checkpointTrigger";
				if ((Object)(object)waypoint == (Object)(object)Path.RuntimePath.lastWaypoint)
				{
					continue;
				}
				if ((Object)(object)waypoint == (Object)(object)Path.RuntimePath.waypoints[0])
				{
					text = "startTrigger";
				}
				CustomPlayerAiWaypoint customPlayerAiWaypoint = waypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint != (Object)null && (customPlayerAiWaypoint.noEncounter || customPlayerAiWaypoint.waypointType == WaypointType.hidden || customPlayerAiWaypoint.waypointType == WaypointType.airdash))
				{
					continue;
				}
				GameObject val4 = new GameObject(text);
				val4.transform.SetParent(val2.transform, false);
				SphereCollider obj = val4.AddComponent<SphereCollider>();
				((Collider)obj).isTrigger = true;
				obj.radius = 1.5f;
				val4.layer = 19;
				val4.tag = "Encounter";
				val4.transform.position = ((Component)waypoint).transform.position;
				val4.AddComponent<SickLines_WaypointType>().WaypointType = customPlayerAiWaypoint.waypointType;
				if (!((Object)(object)waypoint == (Object)(object)Path.RuntimePath.waypoints[0]))
				{
					GameObject val5 = null;
					Quaternion val6 = Quaternion.identity;
					Vector3 zero = Vector3.zero;
					switch (customPlayerAiWaypoint.waypointType)
					{
					case WaypointType.basic:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointRound, val4.transform, false);
						break;
					case WaypointType.jump:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointJump, val4.transform, false);
						((Vector3)(ref zero))..ctor(0f, -0.35f, 0f);
						break;
					case WaypointType.landing:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						break;
					case WaypointType.trick:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointCube, val4.transform, false);
						break;
					case WaypointType.trickBoosted:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointCubeSuper, val4.transform, false);
						break;
					case WaypointType.slide:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointSlide, val4.transform, false);
						break;
					case WaypointType.slideEnd:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						break;
					case WaypointType.wallrun:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						break;
					case WaypointType.wallrunLeft:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						val6 = Quaternion.Euler(0f, 0f, -90f);
						break;
					case WaypointType.wallrunRight:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						val6 = Quaternion.Euler(0f, 0f, 90f);
						break;
					case WaypointType.airtrick:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointAirTrick, val4.transform, false);
						break;
					case WaypointType.airtrickBoosted:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointAirTrickBoost, val4.transform, false);
						break;
					case WaypointType.airdash:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointAirdash, val4.transform, false);
						break;
					case WaypointType.grind:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						break;
					case WaypointType.grindLeft:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						val6 = Quaternion.Euler(0f, 0f, 45f);
						break;
					case WaypointType.grindRight:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						val6 = Quaternion.Euler(0f, 0f, -45f);
						break;
					case WaypointType.grindTrick:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointCube, val4.transform, false);
						val6 = Quaternion.Euler(0f, 0f, -45f);
						break;
					case WaypointType.grindTrickBoosted:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointCubeSuper, val4.transform, false);
						break;
					case WaypointType.boost:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointBoost, val4.transform, false);
						break;
					case WaypointType.boostEnd:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointBoost, val4.transform, false);
						break;
					case WaypointType.movestyleSwitch:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointPointer, val4.transform, false);
						break;
					case WaypointType.dance:
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointStar, val4.transform, false);
						((Vector3)(ref zero))..ctor(0f, 0.5f, 0f);
						break;
					}
					if ((Object)(object)val5 == (Object)null)
					{
						val5 = Object.Instantiate<GameObject>(PathConstructor.waypointRound, ((Component)waypoint).transform, false);
					}
					val6 *= Quaternion.Euler(0f, 0f, 90f);
					val5.transform.position = ((Component)waypoint).transform.position + new Vector3(0f, 0.35f, 0f) + zero;
					val5.transform.rotation = ((Component)waypoint).transform.rotation * val6;
					val5.transform.localScale = new Vector3(2.5f, 2.5f, 2.5f);
				}
			}
			((ComboEncounter)_Encounter).checkpointTriggers = checkpointTriggers;
			((GameplayEvent)_Encounter).InitSceneObject();
		}

		public void StartEncounter(float delay)
		{
			if (!((Object)(object)_Encounter == (Object)null))
			{
				((MonoBehaviour)this).StartCoroutine(DelayStartEncounter(delay));
			}
		}

		private IEnumerator DelayStartEncounter(float delay)
		{
			_Encounter.StartIntro();
			yield return (object)new WaitForSeconds(0.5f);
			TriggerLine();
			yield return (object)new WaitForSeconds(0.25f);
			((Encounter)_Encounter).ActivateEncounterInstantIntro();
		}

		public void OnFailed()
		{
			if ((Object)(object)aiPlayer != (Object)null && (Object)(object)WorldHandler.instance != (Object)null)
			{
				WorldHandler.instance.RemovePlayer(aiPlayer);
			}
			DebugLog.LogMessage((object)$"a {aiPlayer}");
			DebugLog.LogMessage((object)$"b {WorldHandler.instance}");
			DebugLog.LogMessage((object)$"c {((Component)aiPlayer).gameObject}");
			if ((Object)(object)aiPlayer != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)aiPlayer).gameObject);
			}
		}
	}
	public class SickLines_WaypointType : MonoBehaviour
	{
		public WaypointType WaypointType;
	}
	public static class SickLines_SaveManager
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines SickLines_SaveManager");

		private static readonly string ASSET_PATH = Path.Combine(Paths.PluginPath, "Sicklines");

		public static SickLines_Save save;

		public static void Initialize()
		{
			save = new SickLines_Save();
		}
	}
	public class SickLines_Save : CustomSaveData
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines MoveStylerEmailManager");

		private readonly Dictionary<string, bool> pathsCompleted;

		public bool hasReadData;

		public static SickLines_Save Instance { get; private set; }

		public SickLines_Save()
			: base("Sicklines", "{0}_paths.save", (SaveLocations)1)
		{
			Instance = this;
			pathsCompleted = new Dictionary<string, bool>();
		}

		public void setPathState(string fileName, bool state)
		{
			if (pathsCompleted.ContainsKey(fileName))
			{
				pathsCompleted[fileName] = state;
			}
			else
			{
				pathsCompleted.Add(fileName, state);
			}
		}

		public bool getPathState(string fileName)
		{
			if (pathsCompleted.ContainsKey(fileName))
			{
				return pathsCompleted[fileName];
			}
			return false;
		}

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

		public override void Read(BinaryReader reader)
		{
			reader.ReadByte();
			int num = reader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				string key = reader.ReadString();
				bool value = reader.ReadBoolean();
				if (!pathsCompleted.ContainsKey(key))
				{
					pathsCompleted.Add(key, value);
				}
			}
			hasReadData = true;
		}

		public override void Write(BinaryWriter writer)
		{
			writer.Write((byte)0);
			writer.Write(pathsCompleted.Count);
			foreach (KeyValuePair<string, bool> item in pathsCompleted)
			{
				writer.Write(item.Key);
				writer.Write(item.Value);
			}
		}

		public bool hasCompletedPath(string filePath)
		{
			if (pathsCompleted.ContainsKey(filePath))
			{
				return pathsCompleted[filePath];
			}
			return false;
		}

		public bool hasSave(string filePath)
		{
			if (pathsCompleted.ContainsKey(filePath))
			{
				return true;
			}
			return false;
		}
	}
	public static class SickLine_Emails
	{
		private static int msgSenderID = 9092;

		private static Color msgSenderColor = new Color(1f, 0.9f, 0.9f);

		public static CustomContact contact;

		public static string tutorialEmailID = "Sicklines_Tutorial";

		private static EmailMessage tutorialEmail;

		private static List<string> tutorialMessage = new List<string> { "Sicklines allows your to create & share combos (Lines)", "To create your own lines use the create button in the app", "It will record your line until your combo ends", "Saved lines will be loaded next time you open the game", "You can share your lines with others by sharing .path files", "they are found in the sicklines/config folder" };

		public static string MissingMovestyleID = "Sicklines_MSIDError";

		public static EmailMessage MissingMovestyleIDEmail;

		private static List<string> MissingMovestyleIDMessage = new List<string> { "One or more Paths use a Movestyles that was not found", "Install the correct Movestyle to play these paths" };

		public static void Initialize()
		{
			//IL_0017: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Texture2D textureFromBitmap = TextureUtil.GetTextureFromBitmap(Resources.SickLinesEmail, (FilterMode)0);
			contact = EmailManager.RegisterCustomContact("Sick Lines", msgSenderID, textureFromBitmap);
			tutorialEmail = EmailManager.CreateEmailMessage(tutorialEmailID, msgSenderID, "Tutorial", msgSenderColor, tutorialMessage);
			EmailManager.AddEmailMessage(tutorialEmail, true);
			MissingMovestyleIDEmail = EmailManager.CreateEmailMessage(MissingMovestyleID, msgSenderID, "Error", msgSenderColor, MissingMovestyleIDMessage);
		}

		public static void MissingMovestyleNotification()
		{
			if (!EmailManager._messagesIDDatabase.ContainsKey(MissingMovestyleID))
			{
				EmailManager.AddEmailMessage(MissingMovestyleIDEmail, false);
			}
			EmailManager.EmailNotification(MissingMovestyleID, true);
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal class PlayerEmailPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		public static void InitPatch(Player __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)WorldHandler.instance.currentPlayer) && !EmailSave.Instance.getMessageState(SickLine_Emails.tutorialEmailID))
			{
				EmailManager.EmailNotificationDelayed(SickLine_Emails.tutorialEmailID, true, 5f);
			}
		}
	}
	public static class LoadUtil
	{
		public static readonly BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		public static Assets GetAssets(CharacterLoader instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			return (Assets)(((object)instance).GetType().GetField("assets", BindingFlags)?.GetValue(instance));
		}

		public static MethodInfo GetMethod(this object instance, string name)
		{
			return instance.GetType().GetMethod(name, BindingFlags);
		}

		public static void InvokeMethod(this object instance, string name, params object[] parameters)
		{
			Traverse.Create(instance).Method(name, parameters).GetValue(parameters);
		}

		public static void InvokeMethod(this object instance, string name, Type[] types, params object[] parameters)
		{
			Traverse.Create(instance).Method(name, types, (object[])null).GetValue(parameters);
		}

		public static FieldInfo GetField(this object instance, string name)
		{
			return instance.GetType().GetField(name, BindingFlags);
		}

		public static T GetComponentValue<T>(this object instance, string name) where T : Component
		{
			object? value = instance.GetField(name).GetValue(instance);
			return (T)((value is T) ? value : null);
		}

		public static T GetFieldValue<T>(this object instance, string name) where T : class
		{
			return instance.GetField(name).GetValue(instance) as T;
		}

		public static void SetField(this object instance, string name, object value)
		{
			instance.GetField(name).SetValue(instance, value);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Sicklines";

		public const string PLUGIN_NAME = "Sicklines";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Sicklines.Utility
{
	public class TextureUtil
	{
		public static Texture2D GetTextureFromBitmap(Bitmap bitmap, FilterMode filterMode = 1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			byte[] array = (byte[])((TypeConverter)new ImageConverter()).ConvertTo((object?)bitmap, typeof(byte[]));
			Texture2D val = new Texture2D(((Image)bitmap).Width, ((Image)bitmap).Height);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = filterMode;
			val.Apply();
			return val;
		}
	}
}
namespace Sicklines.App
{
	public class SickLinesApp : CustomApp
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Player Patches");

		private static Sprite Icon = null;

		private static List<Player> SpawnedAi;

		private static PathLoader pathLoader;

		public static void Initialize()
		{
			Icon = TextureUtility.CreateSpriteFromTexture(TextureUtil.GetTextureFromBitmap(Resources.phoneAppIcon, (FilterMode)1));
			PhoneAPI.RegisterApp<SickLinesApp>("Sicklines", Icon);
			SpawnedAi = new List<Player>();
			pathLoader = new PathLoader();
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("Sicklines", Icon, 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Test AI");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				WorldHandler.instance.GetCurrentPlayer();
				PlayerSpawner defaultPlayerSpawnPoint = WorldHandler.instance.GetDefaultPlayerSpawnPoint();
				if ((Object)(object)defaultPlayerSpawnPoint == (Object)null)
				{
					DebugLog.LogMessage((object)"Spawner is Null");
				}
				Transform transform = ((Component)defaultPlayerSpawnPoint).gameObject.transform;
				GetAiPathCharacter(out var character, out var Outfit, out var moveStyle);
				Player val4 = WorldHandler.instance.SetupAIPlayerAt(transform, character, (PlayerType)3, Outfit, moveStyle, (Crew)1);
				SpawnedAi.Add(val4);
				SetAiPath(val4);
				val4.AI.state = (PlayerAIState)2;
				PathConstructor.setAiPlayerMaterial(val4, testPath: true);
				val4.AI.alignToNPCWaitTimer = -66f;
			});
			SimplePhoneButton btnStartPath = PhoneUIUtility.CreateSimpleButton("Create Line");
			SimplePhoneButton obj = btnStartPath;
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				if (!PathConstructor.isPlayerMakingPath(currentPlayer) && !PathConstructor.requestNewPath(currentPlayer))
				{
					((TMP_Text)btnStartPath.Label).fontStyle = (FontStyles)1;
					((TMP_Text)btnStartPath.Label).text = "Create Line";
				}
			});
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("Clear Ai");
			((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
			{
				if (SpawnedAi != null)
				{
					foreach (Player item in SpawnedAi)
					{
						WorldHandler.instance.RemovePlayer(item);
						if ((Object)(object)((Component)item.characterVisual).gameObject != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)item.characterVisual).gameObject);
						}
						if ((Object)(object)item != (Object)null)
						{
							Object.Destroy((Object)(object)item);
						}
					}
					SpawnedAi.Clear();
				}
			});
			SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Save Line");
			((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
			{
				int num = PathConstructor.CustomPathsList.Count - 1;
				if (num >= 0)
				{
					CustomAiPath customAiPath = PathConstructor.CustomPathsList[num];
					if (!customAiPath.Loaded)
					{
						customAiPath.pathToJson();
					}
				}
			});
			SimplePhoneButton obj2 = PhoneUIUtility.CreateSimpleButton("Load Line");
			((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
			{
				pathLoader.OnNewScene();
				DebugLog.LogMessage((object)$"path count {pathLoader.pathsToLoad.Count} ");
				if (pathLoader.pathsToLoad.Count > 0)
				{
					DebugLog.LogMessage((object)("Trying to load: " + pathLoader.pathsToLoad[0]));
					pathLoader.LoadPath(pathLoader.pathsToLoad[0]);
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)btnStartPath);
			base.ScrollView.AddButton((PhoneButton)(object)val);
			base.ScrollView.AddButton((PhoneButton)(object)val3);
			base.ScrollView.AddButton((PhoneButton)(object)val2);
		}

		public void SetAiPath(Player ai)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			_ = WorldHandler.instance.sceneObjectsRegister.paths;
			int num = PathConstructor.CustomPathsList.Count - 1;
			if (num >= 0)
			{
				ai.boostCharge = 80f;
				PlayerAIPath runtimePath = PathConstructor.CustomPathsList[num].RuntimePath;
				ai.AI.SetPath(runtimePath, true, true);
				((Component)ai).transform.position = runtimePath.firstWaypoint.position;
			}
		}

		public void GetAiPathCharacter(out Characters character, out int Outfit, out MoveStyle moveStyle)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected I4, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected I4, but got Unknown
			character = (Characters)3;
			Outfit = 0;
			moveStyle = (MoveStyle)2;
			_ = WorldHandler.instance.sceneObjectsRegister.paths;
			int num = PathConstructor.CustomPathsList.Count - 1;
			if (num >= 0)
			{
				CustomAiPath customAiPath = PathConstructor.CustomPathsList[num];
				character = (Characters)(int)customAiPath.character;
				Outfit = customAiPath.outfit;
				moveStyle = (MoveStyle)(int)customAiPath.movestyleEquipped;
			}
		}
	}
}
namespace Sicklines.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	public class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

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

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

		public static Bitmap phoneAppIcon => (Bitmap)ResourceManager.GetObject("phoneAppIcon", resourceCulture);

		public static Bitmap SickLinesEmail => (Bitmap)ResourceManager.GetObject("SickLinesEmail", resourceCulture);

		internal Resources()
		{
		}
	}
}
namespace Sicklines.AiPaths
{
	[HarmonyPatch(typeof(StageManager))]
	public class StageManagerPatches
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines StageManager");

		[HarmonyPostfix]
		[HarmonyPatch("SetupStage")]
		public static void SetupStagePatch()
		{
			PathConstructor.pathLoader.OnNewScene();
		}
	}
	[Serializable]
	public class CustomAiPath
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Custom Path");

		private static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "Sicklines");

		public GameObject rootObject;

		public GameObject triggerLine;

		public int pathID;

		public Characters character;

		public MoveStyle movestyleEquipped;

		public bool startUsingMovestyle;

		public int outfit;

		public Stage stage;

		public CustWaypointData[] pointData;

		public CustPathConfig pathConfig;

		public PlayerAIPath RuntimePath { get; }

		public bool Loaded { get; private set; }

		public CustomAiPath(GameObject Root, Player _target = null)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			RuntimePath = Root.AddComponent<PlayerAIPath>();
			GenerateNewPathID();
			rootObject = Root;
			RuntimePath.pathID = pathID;
			outfit = 0;
			Loaded = false;
			startUsingMovestyle = false;
			movestyleEquipped = (MoveStyle)0;
			if ((Object)(object)_target != (Object)null)
			{
				character = _target.character;
				movestyleEquipped = _target.moveStyleEquipped;
				outfit = Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress(character).outfit;
			}
			stage = Utility.GetCurrentStage();
		}

		public bool loadAiPathFromJsonFile(string filePath)
		{
			return Loaded = parseJsonPath(filePath);
		}

		public void pathToJson()
		{
			if (!Directory.Exists(CONFIG_PATH))
			{
				Directory.CreateDirectory(CONFIG_PATH);
			}
			generateWaypointData();
			try
			{
				string text = Path.Combine(CONFIG_PATH, generatePathFileName() + ".path");
				string text2 = JsonUtility.ToJson((object)this);
				CustWaypointData[] array = pointData;
				foreach (CustWaypointData custWaypointData in array)
				{
					pathConfig.pointArray.Add(JsonUtility.ToJson((object)custWaypointData));
				}
				text2 += "\n*\n";
				text2 += JsonUtility.ToJson((object)pathConfig);
				File.WriteAllText(text, text2);
				DebugLog.LogMessage((object)("Saved Path : " + text));
				PathConstructor.setLineTriggerColour(triggerLine, SickLines_Trigger.Linestate.unCompleted);
				Loaded = true;
			}
			catch
			{
				DebugLog.LogError((object)"Failed to Save path");
			}
		}

		public bool parseJsonPath(string filePath)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (!File.Exists(filePath))
			{
				DebugLog.LogError((object)("failed to find file: " + filePath));
				return false;
			}
			string[] array = File.ReadAllText(filePath).Split(new char[1] { '*' });
			if (array.Length != 2)
			{
				DebugLog.LogError((object)("failed to split text for: " + filePath));
				return false;
			}
			CustomAiPath customAiPath = JsonUtility.FromJson<CustomAiPath>(array[0]);
			character = customAiPath.character;
			movestyleEquipped = customAiPath.movestyleEquipped;
			outfit = customAiPath.outfit;
			stage = customAiPath.stage;
			pathID = customAiPath.pathID;
			startUsingMovestyle = customAiPath.startUsingMovestyle;
			if ((int)movestyleEquipped > 5)
			{
				if (!Plugin.MovestylerLoaded)
				{
					DebugLog.LogMessage((object)"Custom Movestyle No Movestyler installed");
					SickLine_Emails.MissingMovestyleNotification();
					return false;
				}
				if (!moveStyleDatabase.HasMovestyle(movestyleEquipped))
				{
					DebugLog.LogMessage((object)"Custom Movestyle Movestyle not found");
					SickLine_Emails.MissingMovestyleNotification();
					return false;
				}
			}
			pathConfig = JsonUtility.FromJson<CustPathConfig>(array[1]);
			RuntimePath.waypoints = new List<PlayerAIWaypoint>();
			foreach (string item in pathConfig.pointArray)
			{
				CustWaypointData custWaypointData = JsonUtility.FromJson<CustWaypointData>(item);
				RuntimePath.waypoints.Add(custWaypointData.dataToObject(this));
			}
			if (RuntimePath.waypoints.Count < 2)
			{
				DebugLog.LogError((object)"Not enough Waypoints constructed");
				return false;
			}
			RuntimePath.firstWaypoint = RuntimePath.waypoints[0];
			RuntimePath.lastWaypoint = RuntimePath.waypoints[RuntimePath.waypoints.Count - 1];
			pointData = null;
			pathConfig = null;
			return true;
		}

		public string generatePathFileName()
		{
			string text = SystemClock.now.Hour.ToString() + SystemClock.now.Minute + SystemClock.now.Second;
			string text2 = "";
			return text2 + ((object)(Stage)(ref stage)).ToString() + "_" + ((object)(Characters)(ref character)).ToString() + "_" + ((object)(MoveStyle)(ref movestyleEquipped)).ToString() + "_" + text + "." + ((object)(Stage)(ref stage)).ToString();
		}

		public bool generateWaypointData()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected I4, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected I4, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			List<CustWaypointData> list = new List<CustWaypointData>();
			foreach (PlayerAIWaypoint waypoint in RuntimePath.waypoints)
			{
				CustWaypointData custWaypointData = new CustWaypointData();
				if (waypoint is CustomPlayerAiWaypoint)
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint = waypoint as CustomPlayerAiWaypoint;
					custWaypointData.custom = true;
					custWaypointData.TrickId = customPlayerAiWaypoint.TrickId;
					custWaypointData.movestyle = (int)customPlayerAiWaypoint.movestyle;
					custWaypointData.fromJump = customPlayerAiWaypoint.fromJump;
					custWaypointData.end = customPlayerAiWaypoint.end;
					custWaypointData.dance = customPlayerAiWaypoint.dance;
					custWaypointData.waypointType = customPlayerAiWaypoint.waypointType;
				}
				custWaypointData.pos = ((Component)waypoint).transform.position;
				custWaypointData.rot = ((Component)waypoint).transform.rotation;
				custWaypointData.boost = waypoint.boost;
				custWaypointData.jumpPointBehavoir = (int)waypoint.jumpPointBehavoir;
				custWaypointData.autoTeleport = waypoint.autoTeleport;
				custWaypointData.grindTiltCorner = waypoint.grindTiltCorner;
				custWaypointData.trick = waypoint.trick;
				custWaypointData.slide = waypoint.slide;
				custWaypointData.unequipMovestyle = waypoint.unequipMovestyle;
				custWaypointData.walk = waypoint.walk;
				custWaypointData.wait = waypoint.wait;
				if (waypoint.IsJumper())
				{
					custWaypointData.jump = true;
					custWaypointData.jumpPos = waypoint.jumpPosition;
					custWaypointData.jumpPointScale = waypoint.jumpPointScale;
				}
				list.Add(custWaypointData);
			}
			pointData = list.ToArray();
			pathConfig = new CustPathConfig();
			pathConfig.pointArray = new List<string>();
			return list.Count > 0;
		}

		public int GenerateNewPathID()
		{
			return PathConstructor.PathIDOffset + PathConstructor.CustomPathsList.Count;
		}

		public void OnDestroy()
		{
			Object.Destroy((Object)(object)((Component)RuntimePath).gameObject);
			Object.Destroy((Object)(object)triggerLine);
			Object.Destroy((Object)(object)rootObject);
		}
	}
	[Serializable]
	public class CustWaypointData
	{
		public Vector3 pos = new Vector3(0f, 0f, 0f);

		public Quaternion rot;

		public bool boost;

		public int jumpPointBehavoir;

		public bool autoTeleport;

		public float grindTiltCorner;

		public bool trick;

		public bool slide;

		public bool unequipMovestyle;

		public bool walk;

		public float wait;

		public bool jump;

		public Vector3 jumpPos = new Vector3(0f, 0f, 0f);

		public float jumpPointScale = 0.5f;

		public bool custom;

		public int TrickId;

		public int movestyle;

		public bool fromJump;

		public int dance = -1;

		public bool end;

		public WaypointType waypointType = WaypointType.hidden;

		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines CustWaypointData");

		public PlayerAIWaypoint dataToObject(CustomAiPath Parent)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			PlayerAIWaypoint val2;
			if (custom)
			{
				val2 = (PlayerAIWaypoint)(object)val.AddComponent<CustomPlayerAiWaypoint>();
				CustomPlayerAiWaypoint obj = val2 as CustomPlayerAiWaypoint;
				obj.TrickId = TrickId;
				obj.movestyle = (MoveStyle)movestyle;
				obj.fromJump = fromJump;
				obj.dance = dance;
				obj.end = end;
				obj.waypointType = waypointType;
			}
			else
			{
				val2 = val.AddComponent<PlayerAIWaypoint>();
			}
			val2.boost = boost;
			val2.jumpPointBehavoir = (JumpPointBehavoir)jumpPointBehavoir;
			val2.autoTeleport = autoTeleport;
			val2.grindTiltCorner = grindTiltCorner;
			val2.trick = trick;
			val2.slide = slide;
			val2.unequipMovestyle = unequipMovestyle;
			val2.walk = walk;
			val2.wait = wait;
			((Component)val2).gameObject.transform.SetPositionAndRotation(pos, rot);
			if (jump)
			{
				GameObject val3 = new GameObject();
				val3.transform.SetParent(val.transform, true);
				val3.transform.position = jumpPos;
				val3.transform.localScale = new Vector3(jumpPointScale, 1f, 1f);
			}
			return val2;
		}
	}
	[Serializable]
	public class CustPathConfig
	{
		public List<string> pointArray;
	}
	public class CustomPlayerAiWaypoint : PlayerAIWaypoint
	{
		public int TrickId = 1;

		public bool TrickBoosted;

		public MoveStyle movestyle;

		public bool fromJump;

		public int dance = -1;

		public bool end;

		public bool noEncounter;

		public WaypointType waypointType;

		public bool inAir;
	}
	public enum TrickType
	{
		Normal,
		Boosted
	}
	public enum WaypointType
	{
		basic,
		landing,
		jump,
		trick,
		trickBoosted,
		airtrick,
		airtrickBoosted,
		airdash,
		grind,
		grindRight,
		grindLeft,
		grindTrick,
		grindTrickBoosted,
		wallrun,
		wallrunRight,
		wallrunLeft,
		boost,
		boostEnd,
		slide,
		slideEnd,
		movestyleSwitch,
		dance,
		end,
		hidden,
		max
	}
	[HarmonyPatch(typeof(Player))]
	internal class PlayerPatchPaths
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Player Patches");

		[HarmonyPostfix]
		[HarmonyPatch("Jump")]
		public static void JumpPatch(Player __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (PathConstructor.isPlayerMakingPath(__instance))
			{
				bool slide = false;
				bool boostButtonHeld = __instance.boostButtonHeld;
				bool unequipMovestyle = (int)__instance.moveStyle == 0;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide, unequipMovestyle, walk: false, 0f, skipIfCantReach: false, isJump: true);
				((Component)customPlayerAiWaypoint).transform.localScale = new Vector3(0.35f, 1f, 1f);
				customPlayerAiWaypoint.fromJump = true;
				customPlayerAiWaypoint.waypointType = WaypointType.jump;
				CustomPlayerAiWaypoint customPlayerAiWaypoint2 = (CustomPlayerAiWaypoint)(object)PathConstructor.PrevWaypoint;
				_ = customPlayerAiWaypoint2.waypointType;
				if (Vector3.Distance(((Component)customPlayerAiWaypoint2).transform.position, ((Component)customPlayerAiWaypoint).transform.position) < 0.25f)
				{
					customPlayerAiWaypoint2.waypointType = WaypointType.hidden;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnLanded")]
		public static void OnLandedPatch(Player __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_0096: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (PathConstructor.isPlayerMakingPath(__instance) && !((Object)(object)PathConstructor.CurrentWaypoint == (Object)null))
			{
				bool boostButtonHeld = __instance.boostButtonHeld;
				bool unequipMovestyle = (int)__instance.moveStyle == 0;
				bool slideButtonHeld = __instance.slideButtonHeld;
				bool flag = false;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.CurrentWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint != (Object)null)
				{
					flag = customPlayerAiWaypoint.fromJump && !((PlayerAIWaypoint)customPlayerAiWaypoint).IsJumper();
				}
				if (flag)
				{
					PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
				}
				CustomPlayerAiWaypoint customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
				((Component)PathConstructor.CurrentWaypoint).transform.localScale = new Vector3(1f, 1f, 1f);
				customPlayerAiWaypoint2.waypointType = WaypointType.landing;
				CustomPlayerAiWaypoint customPlayerAiWaypoint3 = (CustomPlayerAiWaypoint)(object)PathConstructor.PrevWaypoint;
				if (customPlayerAiWaypoint3.waypointType == WaypointType.slide && Vector3.Distance(((Component)customPlayerAiWaypoint3).transform.position, ((Component)customPlayerAiWaypoint2).transform.position) < 0.5f)
				{
					customPlayerAiWaypoint2.waypointType = WaypointType.hidden;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ActivateAbility")]
		public static void ActivateAbilityPatch(Player __instance, Ability a)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0713: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Invalid comparison between Unknown and I4
			//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b6: Invalid comparison between Unknown and I4
			//IL_0625: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0808: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			if (!PathConstructor.isPlayerMakingPath(__instance))
			{
				return;
			}
			bool flag = false;
			bool flag2 = PathConstructor.CurrentWaypoint.IsJumper();
			WaypointType waypointType = WaypointType.basic;
			CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.CurrentWaypoint as CustomPlayerAiWaypoint;
			if ((Object)(object)customPlayerAiWaypoint != (Object)null)
			{
				_ = customPlayerAiWaypoint.inAir;
				flag = customPlayerAiWaypoint.fromJump;
				waypointType = customPlayerAiWaypoint.waypointType;
			}
			bool unequipMovestyle = (int)__instance.moveStyle == 0;
			bool boostButtonHeld = __instance.boostButtonHeld;
			_ = __instance.slideButtonHeld;
			if (((object)a).GetType() == typeof(SlideAbility))
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint2 = null;
				if (PathConstructor.CurrentWaypoint.IsJumper())
				{
					customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: true, unequipMovestyle, walk: false, 0f);
				}
				else if (flag && !PathConstructor.CurrentWaypoint.IsJumper())
				{
					PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
					customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: true, unequipMovestyle, walk: false, 0f);
					if (waypointType == WaypointType.landing && Vector3.Distance(((Component)customPlayerAiWaypoint).transform.position, ((Component)customPlayerAiWaypoint2).transform.position) < 0.5f)
					{
						customPlayerAiWaypoint.waypointType = WaypointType.hidden;
					}
					else if (waypointType == WaypointType.trick && Vector3.Distance(((Component)customPlayerAiWaypoint).transform.position, ((Component)customPlayerAiWaypoint2).transform.position) < 5f)
					{
						customPlayerAiWaypoint2.waypointType = WaypointType.end;
					}
				}
				else
				{
					customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: true, unequipMovestyle, walk: false, 0f);
					if (waypointType == WaypointType.landing && Vector3.Distance(((Component)customPlayerAiWaypoint).transform.position, ((Component)customPlayerAiWaypoint2).transform.position) < 0.5f)
					{
						customPlayerAiWaypoint.waypointType = WaypointType.hidden;
					}
					else if (waypointType == WaypointType.trick && Vector3.Distance(((Component)customPlayerAiWaypoint).transform.position, ((Component)customPlayerAiWaypoint2).transform.position) < 5f)
					{
						customPlayerAiWaypoint2.waypointType = WaypointType.end;
					}
				}
				if ((Object)(object)customPlayerAiWaypoint2 != (Object)null)
				{
					((Component)customPlayerAiWaypoint2).transform.localScale = new Vector3(2f, 1f, 1f);
					customPlayerAiWaypoint2.waypointType = WaypointType.slide;
				}
			}
			else if (((object)a).GetType() == typeof(BoostAbility))
			{
				if (PathConstructor.CurrentWaypoint.IsJumper())
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint3 = PathConstructor.addCustomWaypointOnPlayer(boost: true, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
					((Component)customPlayerAiWaypoint3).transform.localScale = new Vector3(1f, 1f, 1f);
					customPlayerAiWaypoint3.waypointType = WaypointType.boost;
					Vector3 jumpPosition = PathConstructor.PrevWaypoint.jumpPosition;
					jumpPosition = Vector3.Lerp(jumpPosition, ((Component)customPlayerAiWaypoint3).transform.position, 0.25f);
					((Component)customPlayerAiWaypoint3).transform.position = jumpPosition + Vector3.up * 0.35f;
					((Component)PathConstructor.addJumpWaypoint((JumpPointBehavoir)3)).transform.localScale = new Vector3(1.5f, 1f, 1f);
					customPlayerAiWaypoint3.inAir = true;
				}
				else if (!__instance.IsGrounded())
				{
					if (flag)
					{
						((Component)PathConstructor.addJumpWaypoint((JumpPointBehavoir)3)).transform.localScale = new Vector3(1.5f, 1f, 1f);
					}
					CustomPlayerAiWaypoint customPlayerAiWaypoint4 = PathConstructor.addCustomWaypointOnPlayer(boost: true, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
					((Component)customPlayerAiWaypoint4).transform.localScale = new Vector3(1f, 1f, 1f);
					customPlayerAiWaypoint4.inAir = true;
					customPlayerAiWaypoint4.waypointType = WaypointType.boost;
				}
				else
				{
					PathConstructor.addCustomWaypointOnPlayer(boost: true, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f).waypointType = WaypointType.boost;
				}
			}
			else if (((object)a).GetType() == typeof(GrindAbility))
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint5 = PathConstructor.CurrentWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint5 != (Object)null && customPlayerAiWaypoint5.fromJump && !((PlayerAIWaypoint)customPlayerAiWaypoint5).IsJumper())
				{
					PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
				}
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f).waypointType = WaypointType.grind;
			}
			else if (((object)a).GetType() == typeof(AirDashAbility))
			{
				if (flag && !flag2)
				{
					((Component)PathConstructor.addJumpWaypoint((JumpPointBehavoir)3)).transform.localScale = new Vector3(1f, 0.3f, 0.3f);
				}
				CustomPlayerAiWaypoint customPlayerAiWaypoint6 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)1, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
				customPlayerAiWaypoint6.waypointType = WaypointType.airdash;
				((Component)PathConstructor.addJumpWaypoint((JumpPointBehavoir)1)).transform.localScale = new Vector3(1f, 0.3f, 0.3f);
				((Component)customPlayerAiWaypoint6).transform.localScale = new Vector3(1f, 0.3f, 0.3f);
				Vector3 velocity = __instance.GetVelocity();
				Vector3 normalized = ((Vector3)(ref velocity)).normalized;
				normalized.y = 0f;
				CustomPlayerAiWaypoint customPlayerAiWaypoint7 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle: false, walk: false, 0f, skipIfCantReach: false, isJump: false, noEncounter: true);
				customPlayerAiWaypoint7.waypointType = WaypointType.hidden;
				Transform transform = ((Component)customPlayerAiWaypoint7).transform;
				transform.position += ((Vector3)(ref normalized)).normalized * 1.5f;
				((Component)customPlayerAiWaypoint7).transform.localScale = new Vector3(1.25f, 0f, 0f);
			}
			else if (((object)a).GetType() == typeof(AirTrickAbility))
			{
				if (flag && !PathConstructor.CurrentWaypoint.IsJumper())
				{
					PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
				}
				CustomPlayerAiWaypoint customPlayerAiWaypoint8 = (CustomPlayerAiWaypoint)(object)PathConstructor.PrevWaypoint;
				CustomPlayerAiWaypoint customPlayerAiWaypoint9 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)2, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
				CustomPlayerAiWaypoint customPlayerAiWaypoint10 = (CustomPlayerAiWaypoint)(object)PathConstructor.PrevWaypoint;
				if (__instance.boostButtonHeld && PathConstructor.PrevWaypoint is CustomPlayerAiWaypoint)
				{
					if ((customPlayerAiWaypoint10.waypointType == WaypointType.boostEnd || customPlayerAiWaypoint10.waypointType == WaypointType.boost) && Vector3.Distance(((Component)customPlayerAiWaypoint10).transform.position, ((Component)customPlayerAiWaypoint9).transform.position) < 1f)
					{
						customPlayerAiWaypoint10.waypointType = WaypointType.hidden;
					}
					if ((Object)(object)customPlayerAiWaypoint8 != (Object)null && customPlayerAiWaypoint8.waypointType == WaypointType.boost && Vector3.Distance(((PlayerAIWaypoint)customPlayerAiWaypoint8).position, ((Component)customPlayerAiWaypoint9).transform.position) < 1f)
					{
						customPlayerAiWaypoint8.waypointType = WaypointType.hidden;
					}
				}
				((Component)customPlayerAiWaypoint9).transform.localScale = new Vector3(1.5f, 1f, 1f);
				if (__instance.boostButtonHeld || __instance.boostButtonNew)
				{
					customPlayerAiWaypoint9.waypointType = WaypointType.airtrickBoosted;
				}
				else
				{
					customPlayerAiWaypoint9.waypointType = WaypointType.airtrick;
				}
				((Component)PathConstructor.addJumpWaypoint((JumpPointBehavoir)2)).transform.localScale = new Vector3(2f, 1f, 1f);
				customPlayerAiWaypoint9.TrickBoosted = __instance.boostButtonHeld;
			}
			else if (((object)a).GetType() == typeof(GroundTrickAbility))
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint11 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: true, slide: false, unequipMovestyle, walk: false, 0f);
				customPlayerAiWaypoint11.TrickBoosted = boostButtonHeld;
				if (boostButtonHeld)
				{
					customPlayerAiWaypoint11.waypointType = WaypointType.trickBoosted;
				}
				else
				{
					customPlayerAiWaypoint11.waypointType = WaypointType.trick;
				}
			}
			else if (((object)a).GetType() == typeof(WallrunLineAbility))
			{
				WallrunLineAbility val = (WallrunLineAbility)(object)((a is WallrunLineAbility) ? a : null);
				Vector3 val2 = val.wallrunFaceNormal * -1f * 0.75f;
				DebugLog.LogMessage((object)"Wallrun ");
				if ((Object)(object)customPlayerAiWaypoint != (Object)null)
				{
					DebugLog.LogMessage((object)$"Cust Not Null | from {customPlayerAiWaypoint.fromJump} | Is jumper {((PlayerAIWaypoint)customPlayerAiWaypoint).IsJumper()}");
					if (customPlayerAiWaypoint.fromJump && !((PlayerAIWaypoint)customPlayerAiWaypoint).IsJumper())
					{
						PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
						DebugLog.LogMessage((object)"Wallrun add Jump Point ");
					}
				}
				CustomPlayerAiWaypoint customPlayerAiWaypoint12 = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
				if ((int)val.animSide == 2)
				{
					customPlayerAiWaypoint12.waypointType = WaypointType.wallrunRight;
				}
				else if ((int)val.animSide == 6)
				{
					customPlayerAiWaypoint12.waypointType = WaypointType.wallrunLeft;
				}
				else
				{
					customPlayerAiWaypoint12.waypointType = WaypointType.wallrun;
				}
				if ((Object)(object)customPlayerAiWaypoint12 != (Object)null)
				{
					((Component)customPlayerAiWaypoint12).transform.localScale = new Vector3(0.75f, 0.3f, 0.3f);
					Transform transform2 = ((Component)customPlayerAiWaypoint12).transform;
					transform2.position += val2;
				}
			}
			else if (((object)a).GetType() == typeof(SwitchMoveStyleAbility))
			{
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f).waypointType = WaypointType.movestyleSwitch;
			}
			else if (((object)a).GetType() == typeof(SpecialAirAbility))
			{
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f, skipIfCantReach: false, isJump: true).waypointType = WaypointType.airtrickBoosted;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("StopCurrentAbility")]
		public static void StopAbilityPatch(Player __instance, Ability ___preAbility, Ability ___ability)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			if (!PathConstructor.isPlayerMakingPath(__instance) || ___preAbility == null)
			{
				return;
			}
			bool unequipMovestyle = (int)__instance.moveStyle == 0;
			bool boostButtonHeld = __instance.boostButtonHeld;
			bool slideButtonHeld = __instance.slideButtonHeld;
			bool jumpRequested = __instance.jumpRequested;
			if (jumpRequested)
			{
				DebugLog.LogMessage((object)"Is Jump Early out");
				return;
			}
			bool flag = false;
			CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.CurrentWaypoint as CustomPlayerAiWaypoint;
			if ((Object)(object)customPlayerAiWaypoint != (Object)null)
			{
				flag = customPlayerAiWaypoint.fromJump;
				_ = customPlayerAiWaypoint.TrickBoosted;
			}
			if (!PathConstructor.CurrentWaypoint.IsJumper() && flag)
			{
				PathConstructor.addJumpWaypoint((JumpPointBehavoir)3);
			}
			if (((object)___preAbility).GetType() == typeof(SlideAbility))
			{
				if (!(___ability != null || jumpRequested))
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
					customPlayerAiWaypoint2.waypointType = WaypointType.hidden;
					((Component)customPlayerAiWaypoint2).transform.localScale = new Vector3(1.5f, 1f, 1f);
				}
			}
			else if (((object)___preAbility).GetType() == typeof(BoostAbility))
			{
				if (!(___ability != null || jumpRequested))
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint3 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
					customPlayerAiWaypoint3.waypointType = WaypointType.boostEnd;
					((Component)customPlayerAiWaypoint3).transform.localScale = new Vector3(1.5f, 1f, 1f);
				}
			}
			else if (((object)___preAbility).GetType() == typeof(GroundTrickAbility))
			{
				if (___ability == null)
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint4 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
					customPlayerAiWaypoint4.waypointType = WaypointType.hidden;
					((Component)customPlayerAiWaypoint4).transform.localScale = new Vector3(1.5f, 1f, 1f);
				}
			}
			else if (((object)___preAbility).GetType() == typeof(GrindAbility) && ___ability == null)
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint5 = PathConstructor.addCustomWaypointOnPlayer(boostButtonHeld, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
				customPlayerAiWaypoint5.waypointType = WaypointType.hidden;
				((Component)customPlayerAiWaypoint5).transform.localScale = new Vector3(1.5f, 1f, 1f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("CheckBoostTrick")]
		public static void CheckBoostTrickPatch(Player __instance, ref bool __result)
		{
			if (__instance.isAI)
			{
				bool flag = false;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = __instance.AI.comingFromWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint != (Object)null)
				{
					flag = customPlayerAiWaypoint.TrickBoosted;
				}
				__result = __instance.boostButtonHeld || (flag && !((Ability)__instance.boostAbility).locked);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("HardCornerGrindLine")]
		public static void HardCornerGrindLinePatch(Player __instance, GrindNode node)
		{
			if (PathConstructor.isPlayerMakingPath(__instance))
			{
				PathConstructor.CurrentWaypoint.grindTiltCorner = __instance.grindAbility.grindTilt.x;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle: false, walk: false, 0f);
				if (__instance.grindAbility.grindTilt.x > 0f)
				{
					customPlayerAiWaypoint.waypointType = WaypointType.grindLeft;
				}
				else
				{
					customPlayerAiWaypoint.waypointType = WaypointType.grindRight;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetMoveStyle")]
		public static void SetMoveStylePatch(Player __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if ((Object)(object)__instance.AI != (Object)null)
			{
				MovementStats val = new MovementStats();
				val.runSpeed = __instance.stats.runSpeed;
				val.walkSpeed = __instance.stats.walkSpeed;
				val.groundAcc = __instance.stats.groundAcc;
				val.airAcc = __instance.stats.airAcc;
				val.groundDecc = __instance.stats.groundDecc;
				val.airDecc = __instance.stats.airDecc;
				val.rotSpeedAtStill = __instance.stats.rotSpeedAtStill;
				val.rotSpeedAtMaxSpeed = __instance.stats.rotSpeedAtMaxSpeed;
				val.rotSpeedInAir = __instance.stats.rotSpeedInAir;
				val.grindSpeed = __instance.stats.grindSpeed;
				val.slideDeccHighSpeed = __instance.stats.slideDeccHighSpeed;
				val.slideDeccLowSpeed = __instance.stats.slideDeccLowSpeed;
				val.rotSpeedAtMaxSpeed *= 2.5f;
				val.rotSpeedInAir *= 2.5f;
				__instance.stats = val;
			}
		}
	}
	[HarmonyPatch(typeof(GrindAbility))]
	internal class GrindAbilityPatch
	{
		private static bool boostToggle;

		[HarmonyPostfix]
		[HarmonyPatch("JumpOut")]
		public static void JumpOutPatch(GrindAbility __instance, Player ___p)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (PathConstructor.isPlayerMakingPath(___p))
			{
				bool slideButtonHeld = ___p.slideButtonHeld;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle: false, walk: false, 0f, skipIfCantReach: false, isJump: true);
				((Component)customPlayerAiWaypoint).transform.localScale = new Vector3(0.2f, 0.2f, 0.1f);
				customPlayerAiWaypoint.waypointType = WaypointType.jump;
				if ((Object)(object)PathConstructor.PrevWaypoint != (Object)null)
				{
					PathConstructor.PrevWaypoint.slide = slideButtonHeld;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("StartGrindTrick")]
		public static void StartGrindTrickPatch(GrindAbility __instance, bool first)
		{
			if (!(!PathConstructor.isPlayerMakingPath(((Ability)__instance).p) || first))
			{
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: true, slide: false, unequipMovestyle: false, walk: false, 0f).waypointType = (__instance.curTrickBoost ? WaypointType.grindTrickBoosted : WaypointType.grindTrick);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UpdateTricks")]
		public static void UpdateTricksPatch(GrindAbility __instance)
		{
			if (PathConstructor.isPlayerMakingPath(((Ability)__instance).p) && __instance.trickTimer > 0f && __instance.trickTimer - Core.dt < 0f)
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle: false, walk: false, 0f);
				customPlayerAiWaypoint.waypointType = WaypointType.hidden;
				customPlayerAiWaypoint.noEncounter = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("FixedUpdateAbility")]
		public static void FixedUpdateAbilityPatch(GrindAbility __instance)
		{
			if (PathConstructor.isPlayerMakingPath(((Ability)__instance).p))
			{
				if (((Ability)__instance).p.inputBuffer.boostButtonNew)
				{
					PathConstructor.addCustomWaypointOnPlayer(boost: true, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle: false, walk: false, 0f).waypointType = WaypointType.boost;
					boostToggle = true;
				}
				else if (boostToggle && !((Ability)__instance).p.inputBuffer.boostButtonHeld)
				{
					PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle: false, walk: false, 0f).waypointType = WaypointType.boostEnd;
					boostToggle = false;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnStopAbility")]
		public static void OnStopAbilityPatch(GrindAbility __instance)
		{
			boostToggle = false;
		}
	}
	[HarmonyPatch(typeof(WallrunLineAbility))]
	internal class WallrunAbilityPatch
	{
		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Wallrun Ability Patches");

		[HarmonyPostfix]
		[HarmonyPatch("Jump")]
		public static void JumpPatch(WallrunLineAbility __instance, Player ___p)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			if (PathConstructor.isPlayerMakingPath(___p))
			{
				bool unequipMovestyle = (int)___p.moveStyle == 0;
				bool slideButtonHeld = ___p.slideButtonHeld;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f, skipIfCantReach: false, isJump: true);
				((Component)customPlayerAiWaypoint).transform.localScale = new Vector3(0.5f, 1f, 1f);
				customPlayerAiWaypoint.waypointType = WaypointType.jump;
				Vector3 val = __instance.wallrunFaceNormal * -1f * 0.25f;
				Transform transform = ((Component)customPlayerAiWaypoint).transform;
				transform.position += val;
				Transform transform2 = ((Component)customPlayerAiWaypoint).transform;
				transform2.localPosition -= new Vector3(0.5f, 0f, 0f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("RunOff")]
		public static void RunOffPatch(WallrunLineAbility __instance, Player ___p)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Invalid comparison between Unknown and I4
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Invalid comparison between Unknown and I4
			if (PathConstructor.isPlayerMakingPath(___p))
			{
				bool unequipMovestyle = (int)___p.moveStyle == 0;
				bool slideButtonHeld = ___p.slideButtonHeld;
				CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(___p.boosting, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
				((Component)customPlayerAiWaypoint).transform.localScale = new Vector3(0.5f, 1f, 1f);
				customPlayerAiWaypoint.waypointType = WaypointType.wallrun;
				if ((int)__instance.animSide == 2)
				{
					customPlayerAiWaypoint.waypointType = WaypointType.wallrunRight;
				}
				else if ((int)__instance.animSide == 6)
				{
					customPlayerAiWaypoint.waypointType = WaypointType.wallrunLeft;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetNewNodes")]
		public static void SetNewNodesPatch(WallrunLineAbility __instance, Player ___p)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			if (!PathConstructor.isPlayerMakingPath(___p))
			{
				return;
			}
			CustomPlayerAiWaypoint customPlayerAiWaypoint = (CustomPlayerAiWaypoint)(object)PathConstructor.CurrentWaypoint;
			if (customPlayerAiWaypoint.waypointType == WaypointType.wallrun || customPlayerAiWaypoint.waypointType == WaypointType.wallrunLeft || customPlayerAiWaypoint.waypointType == WaypointType.wallrunRight)
			{
				bool unequipMovestyle = (int)___p.moveStyle == 0;
				bool slideButtonHeld = ___p.slideButtonHeld;
				CustomPlayerAiWaypoint customPlayerAiWaypoint2 = PathConstructor.addCustomWaypointOnPlayer(___p.boosting, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slideButtonHeld, unequipMovestyle, walk: false, 0f);
				((Component)customPlayerAiWaypoint2).transform.localScale = new Vector3(0.5f, 1f, 1f);
				customPlayerAiWaypoint2.waypointType = WaypointType.wallrun;
				if ((int)__instance.animSide == 2)
				{
					customPlayerAiWaypoint2.waypointType = WaypointType.wallrunRight;
				}
				else if ((int)__instance.animSide == 6)
				{
					customPlayerAiWaypoint2.waypointType = WaypointType.wallrunLeft;
				}
			}
		}
	}
	[HarmonyPatch(typeof(GroundTrickAbility))]
	internal class GroundTrickAbilityPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("OnStopAbility")]
		public static void OnStopAbility(GroundTrickAbility __instance, Player ___p)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if (PathConstructor.isPlayerMakingPath(___p))
			{
				bool unequipMovestyle = (int)___p.moveStyle == 0;
				_ = ___p.slideButtonHeld;
				if (((object)___p.ability).GetType() == typeof(GroundTrickAbility))
				{
					CustomPlayerAiWaypoint customPlayerAiWaypoint = PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, 0f);
					customPlayerAiWaypoint.noEncounter = true;
					customPlayerAiWaypoint.waypointType = WaypointType.hidden;
				}
			}
		}
	}
	[HarmonyPatch(typeof(DanceAbility))]
	internal class DanceAbilityPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnStartAbility")]
		public static bool OnStartAbilityPatch(DanceAbility __instance)
		{
			if (((Ability)__instance).p.isAI)
			{
				__instance.danceNumber = 0;
				((Ability)__instance).p.SwitchToEquippedMovestyle(false, false, true, true);
				((Ability)__instance).p.PlayAnim(((Ability)__instance).p.characterVisual.bounceAnimHash, false, false, -1f);
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnStopAbility")]
		public static bool OnStopAbilityPatch(DanceAbility __instance)
		{
			if (((Ability)__instance).p.isAI)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HandplantAbility))]
	internal class HandplantAbilityPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetToPole")]
		[HarmonyPatch(new Type[]
		{
			typeof(Vector3),
			typeof(SkateboardScrewPole)
		})]
		public static void SetToPolePatch(HandplantAbility __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			if (PathConstructor.isPlayerMakingPath(((Ability)__instance).p))
			{
				bool unequipMovestyle = (int)((Ability)__instance).p.moveStyle == 0;
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, (float)DateTime.Now.TimeOfDay.TotalSeconds).waypointType = WaypointType.basic;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetToPole")]
		[HarmonyPatch(new Type[] { typeof(Vector3) })]
		public static void SetToPolePatch_b(HandplantAbility __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			if (PathConstructor.isPlayerMakingPath(((Ability)__instance).p))
			{
				bool unequipMovestyle = (int)((Ability)__instance).p.moveStyle == 0;
				PathConstructor.addCustomWaypointOnPlayer(boost: false, (JumpPointBehavoir)3, autoTeleport: false, 0f, trick: false, slide: false, unequipMovestyle, walk: false, (float)DateTime.Now.TimeOfDay.TotalSeconds).waypointType = WaypointType.basic;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnStopAbility")]
		public static void OnStopAbilityPatch(HandplantAbility __instance)
		{
			if (PathConstructor.isPlayerMakingPath(((Ability)__instance).p))
			{
				float wait = PathConstructor.CurrentWaypoint.wait;
				wait = (float)DateTime.Now.TimeOfDay.TotalSeconds - wait;
				PathConstructor.CurrentWaypoint.wait = wait;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("FixedUpdateAbility")]
		public static bool FixedUpdateAbilityPatch(HandplantAbility __instance)
		{
			if (((Ability)__instance).p.isAI && ((Ability)__instance).p.AI.waitTimer < ((Ability)__instance).p.AI.comingFromWaypoint.wait)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(AirTrickAbility))]
	internal class AirTrickAbilityPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetupBoostTrick")]
		public static void SetupBoostTrickPatch(AirTrickAbility __instance)
		{
			if (((Ability)__instance).p.isAI)
			{
				((Ability)__instance).p.SetForwardSpeed(((Ability)__instance).p.boostSpeed);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAI))]
	internal class PlayerAIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetPath")]
		public static void SetPathPatch(PlayerAI __instance, PlayerAIPath p, bool setWaypointAlso, bool teleport)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (setWaypointAlso)
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint = __instance.path.firstWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint != (Object)null)
				{
					__instance.self.SetCurrentMoveStyleEquipped(customPlayerAiWaypoint.movestyle, true, true);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UpdateJumping")]
		public static void UpdateJumpingPatch(PlayerAI __instance)
		{
			if (__instance.preparingToJump)
			{
				__instance.input.boostButtonHeld = __instance.comingFromWaypoint.boost;
				__instance.input.slideButtonHeld = __instance.comingFromWaypoint.slide;
			}
			else
			{
				__instance.input.boostButtonHeld = __instance.comingFromWaypoint.boost;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetNextWaypoint")]
		public static void SetNextWaypointPatch(PlayerAI __instance, Player ___self)
		{
			if (__instance.comingFromWaypoint.IsJumper())
			{
				bool flag = false;
				if (___self.ability != null)
				{
					flag = ((object)___self.ability).GetType() == typeof(GrindAbility);
					flag |= ((object)___self.ability).GetType() == typeof(WallrunLineAbility);
					flag |= ((object)___self.ability).GetType() == typeof(FlipOutJumpAbility);
					flag |= ((object)___self.ability).GetType() == typeof(HandplantAbility);
					flag |= ((object)___self.ability).GetType() == typeof(GroundTrickAbility);
				}
				if (!___self.IsGrounded() && !flag)
				{
					__instance.preparingToJump = false;
				}
			}
			if ((Object)(object)__instance.nextWaypoint == (Object)null)
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint = __instance.comingFromWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint != (Object)null && customPlayerAiWaypoint.end)
				{
					WorldHandler.instance.RemovePlayer(__instance.self);
					Object.Destroy((Object)(object)((Component)__instance.self).gameObject);
				}
			}
			else
			{
				CustomPlayerAiWaypoint customPlayerAiWaypoint2 = __instance.comingFromWaypoint as CustomPlayerAiWaypoint;
				if ((Object)(object)customPlayerAiWaypoint2 != (Object)null && customPlayerAiWaypoint2.dance >= 0)
				{
					__instance.self.ActivateAbility((Ability)(object)__instance.self.danceAbility);
					__instance.self.PlayAnim(__instance.self.characterVisual.bounceAnimHash, false, false, -1f);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateNormalMove")]
		public static void UpdateNormalMovePatch(PlayerAI __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance.comingFromWaypoint) && __instance.comingFromWaypoint.wait < __instance.waitTimer && __instance.AbilityIs((Ability)(object)__instance.self.danceAbility))
			{
				__instance.self.StopCurrentAbility();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("Rubberbanding")]
		public static bool RubberbandingPatch(PlayerAI __instance)
		{
			if (__instance.alignToNPCWaitTimer == -66f)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Encounter))]
	internal class EncounterPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("WriteToData")]
		public static bool WriteToDataPatch(Encounter __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if ((int)(EncounterProgress)((AProgressable)__instance).progressableData == 0)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(ComboEncounter))]
	internal class ComboEncounterPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ReadyPlayer")]
		public static void ReadyPlayerPatch(ComboEncounter __instance, ref float ___playerInStartTriggerTimer)
		{
			___playerInStartTriggerTimer = 15f;
		}
	}
	public static class PathConstructor
	{
		private static bool _debug = false;

		private static ManualLogSource DebugLog = Logger.CreateLogSource("Sicklines Player Patches");

		private static readonly string ASSET_PATH = Path.Combine(Paths.PluginPath, "Sicklines");

		public static CustomAiPath CurrentPath;

		public static CustomAiPath LastPath;

		public static PathLoader pathLoader;

		public static bool newPath = false;

		public static bool startedCombo = false;

		private static Material holoMaterial;

		private static GameObject triggerLine;

		public static GameObject waypointVisual;

		public static GameObject waypointRound;

		public static GameObject waypointPointer;

		public static GameObject waypointCube;

		public static GameObject waypointCubeSuper;

		public static GameObject waypointStar;

		public static GameObject waypointSlide;

		public static GameObject waypointBoost;

		public static GameObject waypointAirTrick;

		public static GameObject waypointAirTrickBoost;

		public static GameObject waypointAirdash;

		public static GameObject waypointJump;

		public static GameObject rootObject;

		public static PlayerAIWaypoint StartingWaypoint;

		public static PlayerAIWaypoint CurrentWaypoint;

		public static PlayerAIWaypoint PrevWaypoint;

		public static List<CustomAiPath> CustomPathsList;

		public static Shader playerShader;

		public static int PathIDOffset = 300;

		public static Player _target { get; private set; }

		public static void Initialize(ConfigFile config)
		{
			CustomPathsList = new List<CustomAiPath>();
			pathLoader = new PathLoader();
			if (BundleLoader.LoadBundle(ASSET_PATH + "\\sicklines.assets", out var gameObjects))
			{
				GameObject[] array = gameObjects;
				foreach (GameObject val in array)
				{
					DebugLog.LogMessage((object)((Object)val).name);
					SickLines_Mono component = val.GetComponent<SickLines_Mono>();
					if ((Object)(object)component != (Object)null)
					{
						holoMaterial = component.HoloMat;
						break;
					}
				}
				array = gameObjects;
				foreach (GameObject val2 in array)
				{
					if (((Object)val2).name == "SickLineTrigger")
					{
						triggerLine = val2;
						break;
					}
				}
				array = gameObjects;
				foreach (GameObject val3 in array)
				{
					if (!(((Object)val3).name == "Waypoints"))
					{
						continue;
					}
					waypointVisual = val3;
					Transform[] allChildren = TransformExtentions.GetAllChildren(val3.transform);
					foreach (Transform val4 in allChildren)
					{
						if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Round")
						{
							waypointRound = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Pyramid")
						{
							waypointPointer = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Cube")
						{
							waypointCube = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Cube_Super")
						{
							waypointCubeSuper = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Star")
						{
							waypointStar = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Slide")
						{
							waypointSlide = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Boost")
						{
							waypointBoost = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_AirTrick")
						{
							waypointAirTrick = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_AirTrick_Boost")
						{
							waypointAirTrickBoost = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Airdash")
						{
							waypointAirdash = ((Component)val4).gameObject;
						}
						else if (((Object)((Component)val4).gameObject).name == "SickLinesWaypoint_Jump")
						{
							waypointJump = ((Component)val4).gameObject;
						}
					}
					break;
				}
			}
			else
			{
				DebugLog.LogMessage((object)"Failed to find the Asset bundle please reinstall the mod");
			}
		}

		public static bool requestNewPath(Player target)
		{
			bool num = CurrentPath == null;
			if (num)
			{
				startNewPath(target);
				newPath = true;
				if (LastPath != null && !LastPath.Loaded)
				{
					CustomPathsList.Remove(LastPath);
					LastPath.OnDestroy();
				}
				setAiPlayerMaterial(target, testPath: true, localPlayer: true);
			}
			return num;
		}

		public static void startNewPath(Player target)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Invalid comparison between Unknown and I4
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			CurrentPath = new CustomAiPath(new GameObject($"CustomPath_{CustomPathsList.Count}"), target);
			_target = target;
			StartingWaypoint = makeWaypointFromPlayerPos(target, custom: true);
			if ((Object)(object)StartingWaypoint == (Object)null)
			{
				DebugLog.LogError((object)"Failed to make Waypoint");
				return;
			}
			CustomPlayerAiWaypoint customPlayerAiWaypoint = StartingWaypoint as CustomPlayerAiWaypoint;
			if ((Object)(object)customPlayerAiWaypoint != (Object)null)
			{
				customPlayerAiWaypoint.movestyle = _target.moveStyleEquipped;
			}
			if (target.ability != nul

Sicklines/SicklinesMono.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("SicklinesMono")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("SicklinesMono")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SicklinesMono")]
[assembly: AssemblyTitle("SicklinesMono")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SicklinesMono;

public class SickLines_Mono : MonoBehaviour
{
	public Material HoloMat;
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SicklinesMono";

	public const string PLUGIN_NAME = "SicklinesMono";

	public const string PLUGIN_VERSION = "1.0.0";
}