Decompiled source of BRCSTYLE v1.0.0

rewind.BRCStyleMeter.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BRCStyleMeter;
using BRCStyleMeter.Compat;
using BRCStyleMeter.Patches;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MovementPlus;
using Reptile;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("MovementPlus")]
[assembly: AssemblyCompany("[rewind]")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BRCStyleMeter")]
[assembly: AssemblyTitle("rewind.BRCStyleMeter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(GameplayUI))]
public class GameplayUIPatch
{
	[HarmonyPostfix]
	[HarmonyPatch("Init")]
	public static void Init(GameplayUI __instance)
	{
		Plugin.ui = __instance;
		((Component)__instance.gameplayScreen).gameObject.AddComponent<UI>();
	}
}
namespace BRCStyleMeter
{
	public class Config
	{
		public class GeneralSection
		{
			public enum AlignOptions
			{
				Left,
				Right,
				TopLeft,
				TopRight
			}

			public enum VisibilityOptions
			{
				[Description("Always meter & rank")]
				AlwaysVisible,
				[Description("Only during combo")]
				OnlyInCombo,
				[Description("Always meter, no rank")]
				AlwaysVisibleButRankHidden,
				[Description("meter only during combo, no rank.")]
				OnlyInComboButRankHidden
			}

			public ConfigEntry<AlignOptions> Align { get; } = config.Bind<AlignOptions>(category, "Alignment", AlignOptions.Left, "The position of the style meter on the screen. (Requires map restart)");


			public ConfigEntry<VisibilityOptions> Visibility { get; } = config.Bind<VisibilityOptions>(category, "Visibility", VisibilityOptions.OnlyInCombo, "When the style meter is visible.");


			public ConfigEntry<int> Displayed { get; } = config.Bind<int>(category, "Displayed Tricks", 6, "Number of recent tricks displayed in the style meter.");


			public ConfigEntry<bool> ReverseOrder { get; } = config.Bind<bool>(category, "Reverse Trick Order", false, "When enabled, newest tricks appear at the top instead of the bottom.");


			public ConfigEntry<float> MinAlpha { get; } = config.Bind<float>(category, "Minimum fade", 0.2f, new ConfigDescription("How transparent is the text at most?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));


			public GeneralSection(ConfigFile config, string category)
			{
			}//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown

		}

		public class FormattingSection
		{
			public ConfigEntry<string> Format { get; } = config.Bind<string>(category, "Trick Formatting", "+ {name}", "The text format for displaying a trick.\nAvailable variables:\n{name} — Trick name.");


			public ConfigEntry<string> FormatCons { get; } = config.Bind<string>(category, "Trick Formatting (Consecutive)", "+ {name} (x{amt})", "The format used when the same trick is performed consecutively.\nAvailable variables:\n{name} — Trick name\n{amt} — Number of consecutive times performed.");


			public FormattingSection(ConfigFile config, string category)
			{
			}
		}

		public class ColorsSection
		{
			public ConfigEntry<Color> CoreColor1 { get; } = config.Bind<Color>(category, "Primary Color", new Color(0.95686275f, 0.827451f, 22f / 85f, 1f), "The main color used for core elements. (Requires map restart)");


			public ConfigEntry<Color> CoreColor2 { get; } = config.Bind<Color>(category, "Secondary Color", new Color(2f / 15f, 9f / 85f, 0.050980393f, 1f), "The secondary accent color. (Requires map restart)");


			public ConfigEntry<Color> TextColor { get; } = config.Bind<Color>(category, "Text Color", new Color(1f, 1f, 1f, 1f), "The text color.");


			public ColorsSection(ConfigFile config, string category)
			{
			}//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)

		}

		public class ListsSection
		{
			public ConfigEntry<string> SettingsRanks { get; }

			public ConfigEntry<string> SettingsBL { get; }

			public List<RankEntry> Ranks { get; } = new List<RankEntry>();


			public HashSet<string> MoveBlacklist { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);


			public ListsSection(ConfigFile config, string category)
			{
				SettingsRanks = config.Bind<string>(category, "Ranks", "Crusty:-1,Bombastic:1500,Ace!:4000,Smokin':8000,Straight Stylin':20000,ALL CITY:50000", "Defines the ranks and their score thresholds.\nFormat: \"RankName:<score>,RankName2:5678,...\" (Requires full restart)");
				SettingsBL = config.Bind<string>(category, "Blacklist", "", "Blacklist of trick names separated by '|' (Requires full restart)");
				ParseRanks(SettingsRanks.Value);
				ParseBlacklist(SettingsBL.Value);
			}

			private void ParseBlacklist(string blString)
			{
				MoveBlacklist.Clear();
				if (!string.IsNullOrWhiteSpace(blString))
				{
					string[] array = blString.Split(new char[1] { '|' });
					foreach (string text in array)
					{
						MoveBlacklist.Add(text.Trim());
					}
				}
			}

			private void ParseRanks(string ranksString)
			{
				Ranks.Clear();
				string[] array = ranksString.Split(new char[1] { ',' });
				for (int i = 0; i < array.Length; i++)
				{
					string[] array2 = array[i].Split(new char[1] { ':' });
					if (array2.Length == 2)
					{
						string name = array2[0].Trim();
						if (float.TryParse(array2[1].Trim(), out var result))
						{
							Ranks.Add(new RankEntry(name, result));
						}
					}
				}
				Ranks.Sort((RankEntry a, RankEntry b) => a.Score.CompareTo(b.Score));
			}
		}

		public GeneralSection General = new GeneralSection(config, "General");

		public FormattingSection Formatting = new FormattingSection(config, "Formatting");

		public ColorsSection Colors = new ColorsSection(config, "Colors");

		public ListsSection Lists = new ListsSection(config, "Lists");

		public Config(ConfigFile config)
		{
		}
	}
	public struct RankEntry
	{
		public string Name;

		public float Score;

		public RankEntry(string name, float score)
		{
			Name = name;
			Score = score;
		}
	}
	[BepInPlugin("rewind.BRCStyleMeter", "BRCStyleMeter", "1.0.0")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public static Harmony HarmonyInstance { get; private set; }

		public static Config CFG { get; private set; }

		public static GameplayUI ui { get; set; }

		private void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			Instance = this;
			CFG = new Config(((BaseUnityPlugin)this).Config);
			HarmonyInstance = new Harmony("rewind.BRCStyleMeter");
			HarmonyInstance.PatchAll();
			if (MovementPlusCompat.Enabled)
			{
				MovementPlusCompat.ApplyPatches(HarmonyInstance);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"v1.0.0 loaded :3");
			foreach (RankEntry rank in CFG.Lists.Ranks)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"{rank.Name} requires {rank.Score} points");
			}
		}
	}
	public class Util
	{
		public static string CompleteTags(string input)
		{
			Stack<string> stack = new Stack<string>();
			StringBuilder stringBuilder = new StringBuilder(input);
			for (int i = 0; i < input.Length; i++)
			{
				if (input[i] == '<')
				{
					int num = input.IndexOf('>', i);
					if (num == -1)
					{
						break;
					}
					bool flag = input[i + 1] == '/';
					int num2 = i + ((!flag) ? 1 : 2);
					string text = input.Substring(num2, num - num2);
					int num3 = text.IndexOf('=');
					if (num3 != -1)
					{
						text = text.Substring(0, num3);
					}
					if (text.StartsWith("#"))
					{
						text = "color";
					}
					if (!flag)
					{
						stack.Push(text);
					}
					else if (stack.Count > 0 && stack.Peek().Equals(text, StringComparison.OrdinalIgnoreCase))
					{
						stack.Pop();
					}
					i = num;
				}
			}
			while (stack.Count > 0)
			{
				stringBuilder.Append("</" + stack.Pop() + ">");
			}
			return stringBuilder.ToString();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "rewind.BRCStyleMeter";

		public const string PLUGIN_NAME = "BRCStyleMeter";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BRCStyleMeter.Patches
{
	public class UI : MonoBehaviour
	{
		private static readonly Config ConfigSettings = Plugin.CFG;

		private TextMeshProUGUI rankLabel;

		private TextMeshProUGUI trickLogLabel;

		public static UI Instance { get; private set; } = null;


		public bool LogVisible { get; private set; } = true;


		public bool RankVisible { get; private set; } = true;


		private void Awake()
		{
			Instance = this;
			SetupStyleMeterUI();
		}

		private void SetupStyleMeterUI()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			GameplayUI value = Traverse.Create((object)Core.Instance.UIManager).Field<GameplayUI>("gameplay").Value;
			TextMeshProUGUI graffitiNewLabel = value.graffitiNewLabel;
			TextMeshProUGUI targetScoreLabel = value.targetScoreLabel;
			RectTransform component = ((Component)value.gameplayScreen).GetComponent<RectTransform>();
			GetAlignmentData(ConfigSettings.General.Align.Value, out var anchor, out var rankPivot, out var trickPivot, out var rankAlign, out var trickAlign, out var rankPos, out var trickPos);
			rankLabel = CreateLabel("StyleMeterRank", ((TMP_Text)targetScoreLabel).font, 48f, rankAlign, component, anchor, rankPivot, rankPos);
			((TMP_Text)rankLabel).faceColor = Color32.op_Implicit(ConfigSettings.Colors.CoreColor1.Value);
			((TMP_Text)rankLabel).outlineColor = Color32.op_Implicit(ConfigSettings.Colors.CoreColor2.Value);
			trickLogLabel = CreateLabel("StyleMeterTrickLog", ((TMP_Text)graffitiNewLabel).font, 28f, trickAlign, component, anchor, trickPivot, trickPos);
			((TMP_Text)trickLogLabel).fontMaterial = ((TMP_Text)graffitiNewLabel).fontMaterial;
		}

		private static TextMeshProUGUI CreateLabel(string name, TMP_FontAsset font, float fontSize, TextAlignmentOptions alignment, RectTransform parent, Vector2 anchor, Vector2 pivot, Vector2 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = new GameObject(name).AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj).font = font;
			((TMP_Text)obj).fontSize = fontSize;
			((TMP_Text)obj).alignment = alignment;
			((TMP_Text)obj).enableWordWrapping = false;
			((TMP_Text)obj).text = string.Empty;
			RectTransform rectTransform = ((TMP_Text)obj).rectTransform;
			((Transform)rectTransform).SetParent((Transform)(object)parent, false);
			rectTransform.anchorMin = anchor;
			rectTransform.anchorMax = anchor;
			rectTransform.pivot = pivot;
			rectTransform.anchoredPosition = position;
			return obj;
		}

		private static void GetAlignmentData(Config.GeneralSection.AlignOptions align, out Vector2 anchor, out Vector2 rankPivot, out Vector2 trickPivot, out TextAlignmentOptions rankAlign, out TextAlignmentOptions trickAlign, out Vector2 rankPos, out Vector2 trickPos)
		{
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00a2: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected I4, but got Unknown
			//IL_00e4: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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)
			//IL_0142: 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_0146: Expected I4, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			switch (align)
			{
			case Config.GeneralSection.AlignOptions.Right:
				anchor = new Vector2(1f, 0.5f);
				rankPivot = new Vector2(1f, 0f);
				trickPivot = new Vector2(1f, 1f);
				rankAlign = (TextAlignmentOptions)516;
				trickAlign = (TextAlignmentOptions)260;
				rankPos = new Vector2(-40f, 80f);
				trickPos = new Vector2(-40f, 60f);
				break;
			case Config.GeneralSection.AlignOptions.TopLeft:
			{
				anchor = new Vector2(0f, 1f);
				rankPivot = (trickPivot = new Vector2(0f, 1f));
				TextAlignmentOptions val = (TextAlignmentOptions)257;
				trickAlign = (TextAlignmentOptions)257;
				rankAlign = (TextAlignmentOptions)(int)val;
				rankPos = new Vector2(40f, -40f);
				trickPos = new Vector2(40f, -80f);
				break;
			}
			case Config.GeneralSection.AlignOptions.TopRight:
			{
				anchor = new Vector2(1f, 1f);
				rankPivot = (trickPivot = new Vector2(1f, 1f));
				TextAlignmentOptions val = (TextAlignmentOptions)260;
				trickAlign = (TextAlignmentOptions)260;
				rankAlign = (TextAlignmentOptions)(int)val;
				rankPos = new Vector2(-40f, -40f);
				trickPos = new Vector2(-40f, -80f);
				break;
			}
			default:
				anchor = new Vector2(0f, 0.5f);
				rankPivot = new Vector2(0f, 0f);
				trickPivot = new Vector2(0f, 1f);
				rankAlign = (TextAlignmentOptions)513;
				trickAlign = (TextAlignmentOptions)257;
				rankPos = new Vector2(40f, 80f);
				trickPos = new Vector2(40f, 60f);
				break;
			}
		}

		public void SetRank(string rank)
		{
			((TMP_Text)rankLabel).text = rank;
		}

		public void SetTrickLog(string tricks)
		{
			((TMP_Text)trickLogLabel).text = tricks;
		}

		public void SetVisible(bool logVisible, bool rankVisible)
		{
			LogVisible = logVisible;
			RankVisible = rankVisible;
			TextMeshProUGUI obj = rankLabel;
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(RankVisible);
			}
			TextMeshProUGUI obj2 = trickLogLabel;
			if (obj2 != null)
			{
				((Component)obj2).gameObject.SetActive(LogVisible);
			}
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal class PlayerPatch
	{
		private struct TrickEntry
		{
			public TrickType Type;

			public string Name;

			public int Number;

			public int Count;

			public TrickEntry(TrickType type, string name, int number, int count = 1)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				Type = type;
				Name = name;
				Number = number;
				Count = count;
			}
		}

		private static readonly Config ConfigSettings = Plugin.CFG;

		public static Player g_player = null;

		public static bool queuedel = false;

		private static readonly List<TrickEntry> TrickHistory = new List<TrickEntry>();

		private static string CurrentRank = "";

		[HarmonyPatch("UpdatePlayer")]
		[HarmonyPostfix]
		private static void Player_UpdatePlayer_Postfix(Player __instance)
		{
			switch (ConfigSettings.General.Visibility.Value)
			{
			case Config.GeneralSection.VisibilityOptions.AlwaysVisible:
				UI.Instance.SetVisible(logVisible: true, rankVisible: true);
				break;
			case Config.GeneralSection.VisibilityOptions.OnlyInCombo:
				UI.Instance.SetVisible(__instance.IsComboing(), __instance.IsComboing());
				break;
			case Config.GeneralSection.VisibilityOptions.AlwaysVisibleButRankHidden:
				UI.Instance.SetVisible(logVisible: true, rankVisible: false);
				break;
			case Config.GeneralSection.VisibilityOptions.OnlyInComboButRankHidden:
				UI.Instance.SetVisible(__instance.IsComboing(), rankVisible: false);
				break;
			}
		}

		[HarmonyPatch("Init")]
		[HarmonyPostfix]
		private static void Player_Init_Postfix(Player __instance)
		{
			if (!__instance.isAI)
			{
				g_player = __instance;
			}
		}

		[HarmonyPatch("DoTrick")]
		[HarmonyPostfix]
		private static void Player_DoTrick_Postfix(Player __instance, TrickType type, string trickName, int trickNum)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.isAI)
			{
				SharedDoTrick(__instance, type, trickName, trickNum);
			}
		}

		public static void SharedDoTrick(Player player, TrickType type, string trickName = "", int trickNum = -1)
		{
			//IL_00a0: 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_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)
			if (queuedel)
			{
				TrickHistory.Clear();
				queuedel = false;
			}
			if (ConfigSettings.Lists.MoveBlacklist.Contains(trickName))
			{
				return;
			}
			if (TrickHistory.Count > 0)
			{
				int index = TrickHistory.Count - 1;
				TrickEntry value = TrickHistory[index];
				if (value.Name == trickName && value.Type == type)
				{
					value.Count++;
					TrickHistory[index] = value;
				}
				else
				{
					TrickHistory.Add(new TrickEntry(type, trickName, trickNum));
				}
			}
			else
			{
				TrickHistory.Add(new TrickEntry(type, trickName, trickNum));
			}
			UpdateLog(player);
			UpdateRank(player);
		}

		[HarmonyPatch("DropCombo")]
		[HarmonyPatch("LandCombo")]
		[HarmonyPostfix]
		private static void Player_DropCombo_LandCombo_PostFix(Player __instance)
		{
			if (!g_player.IsComboing())
			{
				queuedel = true;
			}
		}

		public static void UpdateRank(Player player)
		{
			UI instance = UI.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				CurrentRank = GetRank(ConfigSettings.Lists.Ranks, player.baseScore * player.scoreMultiplier).Name;
				instance.SetRank(CurrentRank);
			}
		}

		public static void UpdateLog(Player player)
		{
			UI instance = UI.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			int value = ConfigSettings.General.Displayed.Value;
			int num = Mathf.Max(0, TrickHistory.Count - value);
			List<TrickEntry> range = TrickHistory.GetRange(num, TrickHistory.Count - num);
			bool value2 = ConfigSettings.General.ReverseOrder.Value;
			List<string> list = new List<string>(range.Count);
			int count = range.Count;
			for (int i = 0; i < count; i++)
			{
				TrickEntry trickEntry = range[i];
				string trickFormat = GetTrickFormat(trickEntry.Name, trickEntry.Count);
				int num2 = count - 1 - i;
				float alpha;
				if (count == 1)
				{
					alpha = 1f;
				}
				else
				{
					float num3 = (float)num2 / (float)(count - 1);
					alpha = Mathf.Lerp(1f, ConfigSettings.General.MinAlpha.Value, num3);
				}
				string item = WrapWithHexAlpha(trickFormat, alpha);
				list.Add(item);
			}
			if (value2)
			{
				list.Reverse();
			}
			instance.SetTrickLog(string.Join("\n", list));
		}

		private static string GetTrickFormat(string name, int count)
		{
			string obj = ((count > 1) ? ConfigSettings.Formatting.FormatCons.Value : ConfigSettings.Formatting.Format.Value);
			string newValue = Util.CompleteTags(name);
			return obj.Replace("{name}", newValue).Replace("{amt}", count.ToString());
		}

		private static string WrapWithHexAlpha(string text, float alpha)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			string text2 = Mathf.Clamp(Mathf.RoundToInt(alpha * 255f), 0, 255).ToString("X2");
			string text3 = ColorUtility.ToHtmlStringRGB(ConfigSettings.Colors.TextColor.Value);
			return "<color=#" + text3 + text2 + ">" + text + "</color>";
		}

		public static RankEntry GetRank(List<RankEntry> ranks, float score)
		{
			RankEntry result = new RankEntry("No Rank", -999f);
			foreach (RankEntry rank in ranks)
			{
				if (score >= rank.Score)
				{
					result = rank;
					continue;
				}
				break;
			}
			return result;
		}
	}
}
namespace BRCStyleMeter.Compat
{
	internal static class MovementPlusCompat
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.yuril.MovementPlus");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void ApplyPatches(Harmony harmony)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(MPTrickManager), "DoTrick", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(MovementPlusCompat), "MPTrickManager_PostFix_Dotrick", (Type[])null, (Type[])null);
			harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void MPTrickManager_PostFix_Dotrick(string name, int points)
		{
			if ((Object)(object)PlayerPatch.g_player == (Object)null)
			{
				return;
			}
			int num = name.LastIndexOf(" x ");
			if (num >= 0)
			{
				int num2 = num + 3;
				if (num2 < name.Length && int.TryParse(name.Substring(num2), out var _))
				{
					name = name.Substring(0, num).TrimEnd(Array.Empty<char>());
				}
			}
			PlayerPatch.SharedDoTrick(PlayerPatch.g_player, (TrickType)0, name);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}