Decompiled source of Risky Stats v1.1.1

plugins/RiskyStats.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using On.RoR2.UI;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RiskyStats")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RiskyStats")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e2f06f9f-3a70-4624-ba24-44bb1f34c38f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RiskyStats;

public static class ProgressSettings
{
	public static KeyCode ToggleKey = (KeyCode)98;

	private static ConfigEntry<KeyCode> toggleKeyEntry;

	public static void Init(ConfigFile config)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		toggleKeyEntry = config.Bind<KeyCode>("General", "Progress Toggle Key", (KeyCode)98, "Key to hold to show the run progress panel");
		ToggleKey = toggleKeyEntry.Value;
	}
}
public static class RunProgressStats
{
	public static float TotalDamage;

	public static float TotalDamageTaken;

	public static float TotalHealing;

	public static float MaxSpeed;

	public static float BiggestHit;

	public static bool BiggestHitCrit;

	private static bool hooked;

	public static void Init()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		if (!hooked)
		{
			hooked = true;
			GlobalEventManager.onServerDamageDealt += OnDamageDealt;
			HealthComponent.TakeDamage += new hook_TakeDamage(OnDamageTaken);
			HealthComponent.Heal += new hook_Heal(OnHealing);
			Run.onRunStartGlobal += OnRunStart;
		}
	}

	private static void OnRunStart(Run run)
	{
		ResetStats();
	}

	public static void ResetStats()
	{
		TotalDamage = 0f;
		TotalDamageTaken = 0f;
		TotalHealing = 0f;
		MaxSpeed = 0f;
		BiggestHit = 0f;
		BiggestHitCrit = false;
	}

	private static void OnDamageDealt(DamageReport report)
	{
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if (!((Object)(object)val == (Object)null) && !((Object)(object)report.attackerBody != (Object)(object)val))
		{
			TotalDamage += report.damageDealt;
			if (report.damageDealt > BiggestHit)
			{
				BiggestHit = report.damageDealt;
				BiggestHitCrit = report.damageInfo.crit;
			}
		}
	}

	private static void OnDamageTaken(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
	{
		orig.Invoke(self, info);
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if (!((Object)(object)val == (Object)null) && !((Object)(object)self.body != (Object)(object)val))
		{
			TotalDamageTaken += info.damage;
		}
	}

	private static float OnHealing(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		float num = orig.Invoke(self, amount, procChainMask, nonRegen);
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if ((Object)(object)val != (Object)null && (Object)(object)self.body == (Object)(object)val)
		{
			TotalHealing += num;
		}
		return num;
	}

	public static void TrackSpeed(CharacterBody body)
	{
		if (!((Object)(object)body == (Object)null) && !((Object)(object)body.characterMotor == (Object)null))
		{
			float magnitude = ((Vector3)(ref body.characterMotor.velocity)).magnitude;
			if (magnitude > MaxSpeed)
			{
				MaxSpeed = magnitude;
			}
		}
	}

	public static string FormatNumber(float number)
	{
		if (number >= 1E+12f)
		{
			return (number / 1E+12f).ToString("0.0") + "t";
		}
		if (number >= 1E+09f)
		{
			return (number / 1E+09f).ToString("0.0") + "b";
		}
		if (number >= 1000000f)
		{
			return (number / 1000000f).ToString("0.0") + "m";
		}
		if (number >= 1000f)
		{
			return (number / 1000f).ToString("0.0") + "k";
		}
		return number.ToString("0");
	}
}
public class RunProgressUI : MonoBehaviour
{
	private GameObject panelObject;

	private TextMeshProUGUI damageText;

	private TextMeshProUGUI damageTakenText;

	private TextMeshProUGUI healingText;

	private TextMeshProUGUI maxSpeedText;

	private TextMeshProUGUI biggestHitText;

	private static readonly Color BackgroundColor = new Color(0.05f, 0.07f, 0.18f, 0.97f);

	private static readonly Color BorderColor = new Color(1f, 0.82f, 0.2f, 1f);

	private static readonly Color RowColor = new Color(0.09f, 0.11f, 0.24f, 1f);

	private static readonly Color RowColorAlt = new Color(0.11f, 0.13f, 0.27f, 1f);

	private static readonly Color AccentColor = new Color(1f, 0.82f, 0.2f, 1f);

	private static readonly Color SubTextColor = new Color(0.65f, 0.68f, 0.8f, 1f);

	private const float PanelWidth = 420f;

	private const float RowHeight = 34f;

	private const float RowSpacing = 6f;

	private void Awake()
	{
		RunProgressStats.Init();
	}

	private void Update()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		HUD val = Object.FindObjectOfType<HUD>();
		if (!((Object)(object)val == (Object)null))
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			CharacterBody body = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
			RunProgressStats.TrackSpeed(body);
			if ((Object)(object)panelObject == (Object)null)
			{
				CreatePanel(val);
			}
			bool key = UnityInput.Current.GetKey(ProgressSettings.ToggleKey);
			if (key != panelObject.activeSelf)
			{
				panelObject.SetActive(key);
			}
			if (key)
			{
				RefreshValues();
			}
		}
	}

	private void CreatePanel(HUD hud)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		panelObject = new GameObject("RiskyStatsProgressPanel");
		panelObject.transform.SetParent(hud.mainContainer.transform, false);
		RectTransform val = panelObject.AddComponent<RectTransform>();
		val.anchorMin = new Vector2(0.5f, 0.5f);
		val.anchorMax = new Vector2(0.5f, 0.5f);
		val.pivot = new Vector2(0.5f, 0.5f);
		val.anchoredPosition = Vector2.zero;
		val.sizeDelta = new Vector2(420f, 100f);
		Image val2 = panelObject.AddComponent<Image>();
		((Graphic)val2).color = BackgroundColor;
		Outline val3 = panelObject.AddComponent<Outline>();
		((Shadow)val3).effectColor = BorderColor;
		((Shadow)val3).effectDistance = new Vector2(2f, -2f);
		VerticalLayoutGroup val4 = panelObject.AddComponent<VerticalLayoutGroup>();
		((LayoutGroup)val4).padding = new RectOffset(18, 18, 18, 18);
		((HorizontalOrVerticalLayoutGroup)val4).spacing = 6f;
		((LayoutGroup)val4).childAlignment = (TextAnchor)1;
		((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
		ContentSizeFitter val5 = panelObject.AddComponent<ContentSizeFitter>();
		val5.horizontalFit = (FitMode)0;
		val5.verticalFit = (FitMode)2;
		CreateTitle(panelObject.transform);
		CreateDivider(panelObject.transform);
		damageText = CreateStatRow(panelObject.transform, "Total Damage", alt: false);
		damageTakenText = CreateStatRow(panelObject.transform, "Total Damage Taken", alt: true);
		healingText = CreateStatRow(panelObject.transform, "Total Healing", alt: false);
		maxSpeedText = CreateStatRow(panelObject.transform, "Max Speed Achieved", alt: true);
		biggestHitText = CreateStatRow(panelObject.transform, "Biggest Hit", alt: false);
		panelObject.SetActive(false);
	}

	private void CreateTitle(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Title");
		val.transform.SetParent(parent, false);
		TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val2).text = "RUN PROGRESS";
		((TMP_Text)val2).fontSize = 24f;
		((Graphic)val2).color = AccentColor;
		((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
		((TMP_Text)val2).fontStyle = (FontStyles)1;
		LayoutElement val3 = val.AddComponent<LayoutElement>();
		val3.minHeight = 30f;
		val3.preferredHeight = 30f;
		val3.flexibleWidth = 1f;
	}

	private void CreateDivider(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Divider");
		val.transform.SetParent(parent, false);
		Image val2 = val.AddComponent<Image>();
		((Graphic)val2).color = new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.35f);
		LayoutElement val3 = val.AddComponent<LayoutElement>();
		val3.minHeight = 2f;
		val3.preferredHeight = 2f;
		val3.flexibleWidth = 1f;
	}

	private TextMeshProUGUI CreateStatRow(Transform parent, string labelText, bool alt)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_0105: 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)
		//IL_013f: Expected O, but got Unknown
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Row_" + labelText.Replace(" ", ""));
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 34f;
		val2.preferredHeight = 34f;
		val2.flexibleWidth = 1f;
		HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
		((LayoutGroup)val3).padding = new RectOffset(12, 12, 4, 4);
		((LayoutGroup)val3).childAlignment = (TextAnchor)3;
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true;
		Image val4 = val.AddComponent<Image>();
		((Graphic)val4).color = (alt ? RowColorAlt : RowColor);
		GameObject val5 = new GameObject("Label");
		val5.transform.SetParent(val.transform, false);
		TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val6).text = labelText;
		((TMP_Text)val6).fontSize = 17f;
		((Graphic)val6).color = SubTextColor;
		((TMP_Text)val6).alignment = (TextAlignmentOptions)4097;
		LayoutElement val7 = val5.AddComponent<LayoutElement>();
		val7.flexibleWidth = 1f;
		GameObject val8 = new GameObject("Value");
		val8.transform.SetParent(val.transform, false);
		TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val9).text = "0";
		((TMP_Text)val9).fontSize = 17f;
		((Graphic)val9).color = Color.white;
		((TMP_Text)val9).alignment = (TextAlignmentOptions)4100;
		((TMP_Text)val9).fontStyle = (FontStyles)1;
		LayoutElement val10 = val8.AddComponent<LayoutElement>();
		val10.preferredWidth = 120f;
		val10.minWidth = 120f;
		val10.flexibleWidth = 0f;
		return val9;
	}

	private void RefreshValues()
	{
		((TMP_Text)damageText).text = "<color=#FFFFFF>" + RunProgressStats.FormatNumber(RunProgressStats.TotalDamage) + "</color>";
		((TMP_Text)damageTakenText).text = "<color=#8B0000>" + RunProgressStats.FormatNumber(RunProgressStats.TotalDamageTaken) + "</color>";
		((TMP_Text)healingText).text = "<color=#90EE90>" + RunProgressStats.FormatNumber(RunProgressStats.TotalHealing) + "</color>";
		((TMP_Text)maxSpeedText).text = $"<color=#00FFFF>{RunProgressStats.MaxSpeed:0.0} m/s</color>";
		string text = (RunProgressStats.BiggestHitCrit ? "FF0000" : "FFFFFF");
		((TMP_Text)biggestHitText).text = "<color=#" + text + ">" + RunProgressStats.FormatNumber(RunProgressStats.BiggestHit) + "</color>";
	}
}
public enum StatAlignment
{
	Horizontal,
	Vertical
}
public enum StatTextAlign
{
	Center,
	Left
}
public static class RSSettings
{
	public static Dictionary<string, bool> StatVisibility = new Dictionary<string, bool>
	{
		{ "AttackSpeed", true },
		{ "Armor", true },
		{ "Crit", true },
		{ "Healing", true },
		{ "Damage", true },
		{ "Streak", true },
		{ "DamageTaken", true },
		{ "DamageTakenStreak", true },
		{ "Speed", true }
	};

	public static float StatFontSize = 27f;

	public static float StatSpacing = 40f;

	public static StatAlignment Alignment = StatAlignment.Horizontal;

	public static StatTextAlign TextAlign = StatTextAlign.Center;

	private static ConfigEntry<StatTextAlign> textAlignEntry;

	public static bool PanelVisible = true;

	public static KeyCode ToggleKey = (KeyCode)118;

	private static ConfigFile config;

	private static Dictionary<string, ConfigEntry<bool>> visibilityEntries = new Dictionary<string, ConfigEntry<bool>>();

	private static ConfigEntry<float> fontSizeEntry;

	private static ConfigEntry<float> spacingEntry;

	private static ConfigEntry<StatAlignment> alignmentEntry;

	private static ConfigEntry<KeyCode> toggleKeyEntry;

	public static event Action OnSettingsChanged;

	public static void Init(ConfigFile cfg)
	{
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		config = cfg;
		foreach (string item in new List<string>(StatVisibility.Keys))
		{
			ConfigEntry<bool> val = config.Bind<bool>("Stats Visibility", item, true, "Show or hide the " + item + " stat");
			visibilityEntries[item] = val;
			StatVisibility[item] = val.Value;
		}
		fontSizeEntry = config.Bind<float>("Appearance", "Font Size", 27f, "Text size of each stat");
		spacingEntry = config.Bind<float>("Appearance", "Spacing", 40f, "Spacing between stats");
		alignmentEntry = config.Bind<StatAlignment>("Appearance", "Alignment", StatAlignment.Horizontal, "Horizontal or vertical layout");
		textAlignEntry = config.Bind<StatTextAlign>("Appearance", "Text Alignment", StatTextAlign.Center, "Text alignment when using vertical layout");
		toggleKeyEntry = config.Bind<KeyCode>("General", "Toggle Key", (KeyCode)118, "Key used to show/hide the stats panel");
		StatFontSize = fontSizeEntry.Value;
		StatSpacing = spacingEntry.Value;
		Alignment = alignmentEntry.Value;
		TextAlign = textAlignEntry.Value;
		ToggleKey = toggleKeyEntry.Value;
	}

	public static void SetVisibility(string key, bool value)
	{
		StatVisibility[key] = value;
		if (visibilityEntries.ContainsKey(key))
		{
			visibilityEntries[key].Value = value;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void SetFontSize(float value)
	{
		StatFontSize = value;
		if (fontSizeEntry != null)
		{
			fontSizeEntry.Value = value;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void SetSpacing(float value)
	{
		StatSpacing = value;
		if (spacingEntry != null)
		{
			spacingEntry.Value = value;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void SetAlignment(StatAlignment value)
	{
		Alignment = value;
		if (alignmentEntry != null)
		{
			alignmentEntry.Value = value;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void SetTextAlign(StatTextAlign value)
	{
		TextAlign = value;
		if (textAlignEntry != null)
		{
			textAlignEntry.Value = value;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void TogglePanelVisible()
	{
		PanelVisible = !PanelVisible;
		RSSettings.OnSettingsChanged?.Invoke();
	}

	public static void ResetToDefault()
	{
		foreach (string item in new List<string>(StatVisibility.Keys))
		{
			StatVisibility[item] = true;
			if (visibilityEntries.ContainsKey(item))
			{
				visibilityEntries[item].Value = true;
			}
		}
		StatFontSize = 27f;
		if (fontSizeEntry != null)
		{
			fontSizeEntry.Value = 27f;
		}
		StatSpacing = 40f;
		if (spacingEntry != null)
		{
			spacingEntry.Value = 40f;
		}
		Alignment = StatAlignment.Horizontal;
		if (alignmentEntry != null)
		{
			alignmentEntry.Value = StatAlignment.Horizontal;
		}
		Alignment = StatAlignment.Horizontal;
		if (alignmentEntry != null)
		{
			alignmentEntry.Value = StatAlignment.Horizontal;
		}
		TextAlign = StatTextAlign.Center;
		if (textAlignEntry != null)
		{
			textAlignEntry.Value = StatTextAlign.Center;
		}
		RSSettings.OnSettingsChanged?.Invoke();
	}
}
public class RSSettingsUI : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Func<HGButton, bool> <>9__17_0;

		public static Func<Transform, bool> <>9__17_2;

		public static UnityAction <>9__24_0;

		public static Action <>9__27_0;

		public static Action <>9__27_1;

		internal bool <CreateSettingsButton>b__17_0(HGButton b)
		{
			return ((Component)b).gameObject.activeInHierarchy;
		}

		internal bool <CreateSettingsButton>b__17_2(Transform t)
		{
			return ((Object)t).name.IndexOf("quit", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)t).name.IndexOf("exit", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		internal void <CreateAlignmentRow>b__24_0()
		{
			StatAlignment alignment = ((RSSettings.Alignment == StatAlignment.Horizontal) ? StatAlignment.Vertical : StatAlignment.Horizontal);
			RSSettings.SetAlignment(alignment);
			Transform parent = panelObject.transform.parent;
			Object.DestroyImmediate((Object)(object)panelObject);
			BuildPanel(parent);
		}

		internal void <CreateBottomButtonsRow>b__27_0()
		{
			RSSettings.ResetToDefault();
			Transform parent = panelObject.transform.parent;
			Object.DestroyImmediate((Object)(object)panelObject);
			BuildPanel(parent);
		}

		internal void <CreateBottomButtonsRow>b__27_1()
		{
			panelObject.SetActive(false);
		}
	}

	private static GameObject panelObject;

	private static readonly Color BackgroundColor = new Color(0.05f, 0.07f, 0.18f, 0.97f);

	private static readonly Color BorderColor = new Color(1f, 0.82f, 0.2f, 1f);

	private static readonly Color RowColor = new Color(0.09f, 0.11f, 0.24f, 1f);

	private static readonly Color RowColorAlt = new Color(0.11f, 0.13f, 0.27f, 1f);

	private static readonly Color AccentColor = new Color(1f, 0.82f, 0.2f, 1f);

	private static readonly Color OffColor = new Color(0.3f, 0.3f, 0.35f, 1f);

	private static readonly Color DarkTextColor = new Color(0.05f, 0.07f, 0.18f, 1f);

	private static readonly Color SubTextColor = new Color(0.65f, 0.68f, 0.8f, 1f);

	private const float PanelWidth = 480f;

	private const float RowHeight = 32f;

	private const float RowSpacing = 6f;

	private static readonly string[] StatOrder = new string[9] { "AttackSpeed", "Armor", "Crit", "Healing", "Damage", "Streak", "DamageTaken", "DamageTakenStreak", "Speed" };

	private static readonly Dictionary<string, string> StatLabels = new Dictionary<string, string>
	{
		{ "AttackSpeed", "Attack Speed" },
		{ "Armor", "Armor" },
		{ "Crit", "Crit" },
		{ "Healing", "Healing" },
		{ "Damage", "Damage" },
		{ "Streak", "Streak" },
		{ "DamageTaken", "Damage Taken" },
		{ "DamageTakenStreak", "Damage Taken Streak" },
		{ "Speed", "Speed" }
	};

	private static readonly Color ResetColor = new Color(0.4f, 0.4f, 0.45f, 1f);

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PauseScreenController.Awake += new hook_Awake(PauseScreenController_Awake);
	}

	private void OnDestroy()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PauseScreenController.Awake -= new hook_Awake(PauseScreenController_Awake);
	}

	private void PauseScreenController_Awake(orig_Awake orig, PauseScreenController self)
	{
		orig.Invoke(self);
		Debug.Log((object)"[RiskyStats] PauseScreenController_Awake fired");
		CreateSettingsButton(self);
	}

	private void CreateSettingsButton(PauseScreenController self)
	{
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Expected O, but got Unknown
		HGButton[] componentsInChildren = ((Component)self).GetComponentsInChildren<HGButton>(true);
		Debug.Log((object)$"[RiskyStats] Found {componentsInChildren.Length} buttons");
		HGButton[] array = componentsInChildren;
		foreach (HGButton val in array)
		{
			string[] obj = new string[7]
			{
				"[RiskyStats] Button: ",
				((Object)((Component)val).gameObject).name,
				" | Parent: ",
				null,
				null,
				null,
				null
			};
			Transform parent = ((Component)val).transform.parent;
			obj[3] = ((parent != null) ? ((Object)parent).name : null);
			obj[4] = " | ";
			obj[5] = $"Sibling: {((Component)val).transform.GetSiblingIndex()} | ";
			obj[6] = $"Active: {((Component)val).gameObject.activeInHierarchy}";
			Debug.Log((object)string.Concat(obj));
		}
		HGButton val2 = ((IEnumerable<HGButton>)componentsInChildren).FirstOrDefault((Func<HGButton, bool>)((HGButton b) => ((Component)b).gameObject.activeInHierarchy));
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		Transform parent2 = ((Component)val2).transform.parent;
		GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, parent2);
		((Object)val3).name = "RiskyStatsSettingsButton";
		HGButton component = val3.GetComponent<HGButton>();
		((Button)component).onClick = new ButtonClickedEvent();
		TextMeshProUGUI componentInChildren = val3.GetComponentInChildren<TextMeshProUGUI>();
		if ((Object)(object)componentInChildren != (Object)null)
		{
			((TMP_Text)componentInChildren).text = "Risky Stats";
			LanguageTextMeshController component2 = ((Component)componentInChildren).GetComponent<LanguageTextMeshController>();
			if ((Object)(object)component2 != (Object)null)
			{
				Object.Destroy((Object)(object)component2);
			}
			LanguageTextMeshController component3 = val3.GetComponent<LanguageTextMeshController>();
			if ((Object)(object)component3 != (Object)null)
			{
				Object.Destroy((Object)(object)component3);
			}
		}
		Canvas componentInParent = ((Component)self).GetComponentInParent<Canvas>();
		Transform canvasTransform = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).transform : ((Component)self).transform);
		((UnityEvent)((Button)component).onClick).AddListener((UnityAction)delegate
		{
			TogglePanel(canvasTransform);
			EventSystem.current.SetSelectedGameObject((GameObject)null);
		});
		Debug.Log((object)"========== CHILD ORDER ==========");
		for (int num = 0; num < parent2.childCount; num++)
		{
			Debug.Log((object)$"{num}: {((Object)parent2.GetChild(num)).name}");
		}
		Transform val4 = ((IEnumerable)parent2).Cast<Transform>().FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.IndexOf("quit", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)t).name.IndexOf("exit", StringComparison.OrdinalIgnoreCase) >= 0));
		if ((Object)(object)val4 != (Object)null)
		{
			Debug.Log((object)("[RiskyStats] Found quit button: " + ((Object)val4).name));
			val3.transform.SetSiblingIndex(val4.GetSiblingIndex());
			Debug.Log((object)$"[RiskyStats] Inserted at index {val3.transform.GetSiblingIndex()}");
		}
		else
		{
			Debug.LogWarning((object)"[RiskyStats] Could not find Quit/Exit button, putting at end.");
			val3.transform.SetAsLastSibling();
		}
	}

	private static void TogglePanel(Transform canvasTransform)
	{
		if ((Object)(object)panelObject == (Object)null)
		{
			BuildPanel(canvasTransform);
		}
		else
		{
			panelObject.SetActive(!panelObject.activeSelf);
		}
	}

	private static void BuildPanel(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: 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_00f3: Expected O, but got Unknown
		panelObject = new GameObject("RiskyStatsSettingsPanel");
		panelObject.transform.SetParent(parent, false);
		RectTransform val = panelObject.AddComponent<RectTransform>();
		val.anchorMin = new Vector2(0.5f, 0.5f);
		val.anchorMax = new Vector2(0.5f, 0.5f);
		val.pivot = new Vector2(0.5f, 0.5f);
		val.anchoredPosition = Vector2.zero;
		val.sizeDelta = new Vector2(480f, 100f);
		Image val2 = panelObject.AddComponent<Image>();
		((Graphic)val2).color = BackgroundColor;
		Outline val3 = panelObject.AddComponent<Outline>();
		((Shadow)val3).effectColor = BorderColor;
		((Shadow)val3).effectDistance = new Vector2(2f, -2f);
		VerticalLayoutGroup val4 = panelObject.AddComponent<VerticalLayoutGroup>();
		((LayoutGroup)val4).padding = new RectOffset(18, 18, 18, 18);
		((HorizontalOrVerticalLayoutGroup)val4).spacing = 6f;
		((LayoutGroup)val4).childAlignment = (TextAnchor)1;
		((HorizontalOrVerticalLayoutGroup)val4).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val4).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
		ContentSizeFitter val5 = panelObject.AddComponent<ContentSizeFitter>();
		val5.horizontalFit = (FitMode)0;
		val5.verticalFit = (FitMode)2;
		CreateTitle(panelObject.transform);
		CreateDivider(panelObject.transform);
		bool flag = false;
		string[] statOrder = StatOrder;
		foreach (string key in statOrder)
		{
			CreateToggleRow(panelObject.transform, key, StatLabels[key], flag);
			flag = !flag;
		}
		CreateDivider(panelObject.transform);
		CreateSliderRow(panelObject.transform, "Size", 14f, 48f, RSSettings.StatFontSize, RSSettings.SetFontSize);
		CreateSliderRow(panelObject.transform, "Spacing", 5f, 100f, RSSettings.StatSpacing, RSSettings.SetSpacing);
		CreateAlignmentRow(panelObject.transform);
		if (RSSettings.Alignment == StatAlignment.Vertical)
		{
			CreateTextAlignRow(panelObject.transform);
		}
		CreateBottomButtonsRow(panelObject.transform);
	}

	private static void CreateTitle(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Title");
		val.transform.SetParent(parent, false);
		TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val2).text = "RISKY STATS SETTINGS";
		((TMP_Text)val2).fontSize = 24f;
		((Graphic)val2).color = AccentColor;
		((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
		((TMP_Text)val2).fontStyle = (FontStyles)1;
		LayoutElement val3 = val.AddComponent<LayoutElement>();
		val3.minHeight = 30f;
		val3.preferredHeight = 30f;
		val3.flexibleWidth = 1f;
	}

	private static void CreateDivider(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Divider");
		val.transform.SetParent(parent, false);
		Image val2 = val.AddComponent<Image>();
		((Graphic)val2).color = new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.35f);
		LayoutElement val3 = val.AddComponent<LayoutElement>();
		val3.minHeight = 2f;
		val3.preferredHeight = 2f;
		val3.flexibleWidth = 1f;
	}

	private static void CreateToggleRow(Transform parent, string key, string labelText, bool alt)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Expected O, but got Unknown
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Expected O, but got Unknown
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Row_" + key);
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 32f;
		val2.preferredHeight = 32f;
		val2.flexibleWidth = 1f;
		HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
		((LayoutGroup)val3).padding = new RectOffset(12, 12, 4, 4);
		((LayoutGroup)val3).childAlignment = (TextAnchor)3;
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true;
		Image val4 = val.AddComponent<Image>();
		((Graphic)val4).color = (alt ? RowColorAlt : RowColor);
		GameObject val5 = new GameObject("Label");
		val5.transform.SetParent(val.transform, false);
		TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val6).text = labelText;
		((TMP_Text)val6).fontSize = 17f;
		((Graphic)val6).color = Color.white;
		((TMP_Text)val6).alignment = (TextAlignmentOptions)4097;
		LayoutElement val7 = val5.AddComponent<LayoutElement>();
		val7.flexibleWidth = 1f;
		GameObject val8 = new GameObject("Toggle");
		val8.transform.SetParent(val.transform, false);
		val8.AddComponent<RectTransform>();
		LayoutElement val9 = val8.AddComponent<LayoutElement>();
		val9.preferredWidth = 46f;
		val9.minWidth = 46f;
		val9.preferredHeight = 22f;
		val9.minHeight = 22f;
		val9.flexibleWidth = 0f;
		Image toggleBg = val8.AddComponent<Image>();
		bool flag = !RSSettings.StatVisibility.ContainsKey(key) || RSSettings.StatVisibility[key];
		((Graphic)toggleBg).color = (flag ? AccentColor : OffColor);
		Toggle val10 = val8.AddComponent<Toggle>();
		((Selectable)val10).targetGraphic = (Graphic)(object)toggleBg;
		val10.isOn = flag;
		((UnityEvent<bool>)(object)val10.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)toggleBg).color = (value ? AccentColor : OffColor);
			RSSettings.SetVisibility(key, value);
		});
	}

	private static void CreateSliderRow(Transform parent, string labelText, float min, float max, float startValue, Action<float> onChanged)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Expected O, but got Unknown
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Expected O, but got Unknown
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Expected O, but got Unknown
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Expected O, but got Unknown
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_033a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Expected O, but got Unknown
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Expected O, but got Unknown
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("SliderRow_" + labelText);
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 44f;
		val2.preferredHeight = 44f;
		val2.flexibleWidth = 1f;
		VerticalLayoutGroup val3 = val.AddComponent<VerticalLayoutGroup>();
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 4f;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false;
		GameObject val4 = new GameObject("Label");
		val4.transform.SetParent(val.transform, false);
		TextMeshProUGUI label = val4.AddComponent<TextMeshProUGUI>();
		((TMP_Text)label).text = labelText + ": " + startValue.ToString("0");
		((TMP_Text)label).fontSize = 15f;
		((Graphic)label).color = SubTextColor;
		((TMP_Text)label).alignment = (TextAlignmentOptions)4097;
		LayoutElement val5 = val4.AddComponent<LayoutElement>();
		val5.minHeight = 18f;
		val5.preferredHeight = 18f;
		GameObject val6 = new GameObject("Slider");
		val6.transform.SetParent(val.transform, false);
		LayoutElement val7 = val6.AddComponent<LayoutElement>();
		val7.minHeight = 20f;
		val7.preferredHeight = 20f;
		val6.AddComponent<RectTransform>();
		Slider val8 = val6.AddComponent<Slider>();
		val8.minValue = min;
		val8.maxValue = max;
		val8.direction = (Direction)0;
		GameObject val9 = new GameObject("Background");
		val9.transform.SetParent(val6.transform, false);
		RectTransform val10 = val9.AddComponent<RectTransform>();
		val10.anchorMin = new Vector2(0f, 0.25f);
		val10.anchorMax = new Vector2(1f, 0.75f);
		val10.offsetMin = Vector2.zero;
		val10.offsetMax = Vector2.zero;
		Image val11 = val9.AddComponent<Image>();
		((Graphic)val11).color = RowColor;
		GameObject val12 = new GameObject("Fill Area");
		val12.transform.SetParent(val6.transform, false);
		RectTransform val13 = val12.AddComponent<RectTransform>();
		val13.anchorMin = new Vector2(0f, 0.25f);
		val13.anchorMax = new Vector2(1f, 0.75f);
		val13.offsetMin = new Vector2(5f, 0f);
		val13.offsetMax = new Vector2(-5f, 0f);
		GameObject val14 = new GameObject("Fill");
		val14.transform.SetParent(val12.transform, false);
		RectTransform val15 = val14.AddComponent<RectTransform>();
		val15.anchorMin = new Vector2(0f, 0f);
		val15.anchorMax = new Vector2(0f, 1f);
		val15.sizeDelta = new Vector2(10f, 0f);
		Image val16 = val14.AddComponent<Image>();
		((Graphic)val16).color = AccentColor;
		val8.fillRect = val15;
		GameObject val17 = new GameObject("Handle Slide Area");
		val17.transform.SetParent(val6.transform, false);
		RectTransform val18 = val17.AddComponent<RectTransform>();
		val18.anchorMin = Vector2.zero;
		val18.anchorMax = Vector2.one;
		val18.offsetMin = Vector2.zero;
		val18.offsetMax = Vector2.zero;
		GameObject val19 = new GameObject("Handle");
		val19.transform.SetParent(val17.transform, false);
		RectTransform val20 = val19.AddComponent<RectTransform>();
		val20.sizeDelta = new Vector2(14f, 22f);
		Image val21 = val19.AddComponent<Image>();
		((Graphic)val21).color = Color.white;
		val8.handleRect = val20;
		((Selectable)val8).targetGraphic = (Graphic)(object)val21;
		val8.value = startValue;
		((UnityEvent<float>)(object)val8.onValueChanged).AddListener((UnityAction<float>)delegate(float value)
		{
			((TMP_Text)label).text = labelText + ": " + value.ToString("0");
			onChanged(value);
		});
	}

	private static void CreateAlignmentRow(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_009a: 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)
		//IL_00b1: Expected O, but got Unknown
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Expected O, but got Unknown
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Expected O, but got Unknown
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Expected O, but got Unknown
		GameObject val = new GameObject("AlignmentRow");
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 36f;
		val2.preferredHeight = 36f;
		val2.flexibleWidth = 1f;
		HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
		((LayoutGroup)val3).padding = new RectOffset(12, 12, 4, 4);
		((LayoutGroup)val3).childAlignment = (TextAnchor)3;
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true;
		Image val4 = val.AddComponent<Image>();
		((Graphic)val4).color = RowColor;
		GameObject val5 = new GameObject("Label");
		val5.transform.SetParent(val.transform, false);
		TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val6).text = "Alignment";
		((TMP_Text)val6).fontSize = 17f;
		((Graphic)val6).color = Color.white;
		((TMP_Text)val6).alignment = (TextAlignmentOptions)4097;
		LayoutElement val7 = val5.AddComponent<LayoutElement>();
		val7.flexibleWidth = 1f;
		GameObject val8 = new GameObject("AlignmentButton");
		val8.transform.SetParent(val.transform, false);
		val8.AddComponent<RectTransform>();
		LayoutElement val9 = val8.AddComponent<LayoutElement>();
		val9.preferredWidth = 130f;
		val9.minWidth = 130f;
		val9.preferredHeight = 26f;
		val9.minHeight = 26f;
		val9.flexibleWidth = 0f;
		Image val10 = val8.AddComponent<Image>();
		((Graphic)val10).color = AccentColor;
		Button val11 = val8.AddComponent<Button>();
		((Selectable)val11).targetGraphic = (Graphic)(object)val10;
		GameObject val12 = new GameObject("Label");
		val12.transform.SetParent(val8.transform, false);
		RectTransform val13 = val12.AddComponent<RectTransform>();
		val13.anchorMin = Vector2.zero;
		val13.anchorMax = Vector2.one;
		val13.offsetMin = Vector2.zero;
		val13.offsetMax = Vector2.zero;
		TextMeshProUGUI val14 = val12.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val14).alignment = (TextAlignmentOptions)514;
		((Graphic)val14).color = DarkTextColor;
		((TMP_Text)val14).fontSize = 15f;
		((TMP_Text)val14).fontStyle = (FontStyles)1;
		((TMP_Text)val14).text = ((RSSettings.Alignment == StatAlignment.Horizontal) ? "Horizontal" : "Vertical");
		ButtonClickedEvent onClick = val11.onClick;
		object obj = <>c.<>9__24_0;
		if (obj == null)
		{
			UnityAction val15 = delegate
			{
				StatAlignment alignment = ((RSSettings.Alignment == StatAlignment.Horizontal) ? StatAlignment.Vertical : StatAlignment.Horizontal);
				RSSettings.SetAlignment(alignment);
				Transform parent2 = panelObject.transform.parent;
				Object.DestroyImmediate((Object)(object)panelObject);
				BuildPanel(parent2);
			};
			<>c.<>9__24_0 = val15;
			obj = (object)val15;
		}
		((UnityEvent)onClick).AddListener((UnityAction)obj);
	}

	private static void CreateTextAlignRow(Transform parent)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected O, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Expected O, but got Unknown
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Expected O, but got Unknown
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Expected O, but got Unknown
		GameObject val = new GameObject("TextAlignRow");
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 36f;
		val2.preferredHeight = 36f;
		val2.flexibleWidth = 1f;
		HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
		((LayoutGroup)val3).padding = new RectOffset(12, 12, 4, 4);
		((LayoutGroup)val3).childAlignment = (TextAnchor)3;
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 10f;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = true;
		Image val4 = val.AddComponent<Image>();
		((Graphic)val4).color = RowColor;
		GameObject val5 = new GameObject("Label");
		val5.transform.SetParent(val.transform, false);
		TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val6).text = "Text Align";
		((TMP_Text)val6).fontSize = 17f;
		((Graphic)val6).color = Color.white;
		((TMP_Text)val6).alignment = (TextAlignmentOptions)4097;
		LayoutElement val7 = val5.AddComponent<LayoutElement>();
		val7.flexibleWidth = 1f;
		GameObject val8 = new GameObject("TextAlignButton");
		val8.transform.SetParent(val.transform, false);
		val8.AddComponent<RectTransform>();
		LayoutElement val9 = val8.AddComponent<LayoutElement>();
		val9.preferredWidth = 130f;
		val9.minWidth = 130f;
		val9.preferredHeight = 26f;
		val9.minHeight = 26f;
		val9.flexibleWidth = 0f;
		Image val10 = val8.AddComponent<Image>();
		((Graphic)val10).color = AccentColor;
		Button val11 = val8.AddComponent<Button>();
		((Selectable)val11).targetGraphic = (Graphic)(object)val10;
		GameObject val12 = new GameObject("Label");
		val12.transform.SetParent(val8.transform, false);
		RectTransform val13 = val12.AddComponent<RectTransform>();
		val13.anchorMin = Vector2.zero;
		val13.anchorMax = Vector2.one;
		val13.offsetMin = Vector2.zero;
		val13.offsetMax = Vector2.zero;
		TextMeshProUGUI buttonLabel = val12.AddComponent<TextMeshProUGUI>();
		((TMP_Text)buttonLabel).alignment = (TextAlignmentOptions)514;
		((Graphic)buttonLabel).color = DarkTextColor;
		((TMP_Text)buttonLabel).fontSize = 15f;
		((TMP_Text)buttonLabel).fontStyle = (FontStyles)1;
		((TMP_Text)buttonLabel).text = ((RSSettings.TextAlign == StatTextAlign.Center) ? "Center" : "Left");
		((UnityEvent)val11.onClick).AddListener((UnityAction)delegate
		{
			StatTextAlign statTextAlign = ((RSSettings.TextAlign == StatTextAlign.Center) ? StatTextAlign.Left : StatTextAlign.Center);
			RSSettings.SetTextAlign(statTextAlign);
			((TMP_Text)buttonLabel).text = ((statTextAlign == StatTextAlign.Center) ? "Center" : "Left");
		});
	}

	private static void CreateBottomButtonsRow(Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("BottomButtonsWrapper");
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.minHeight = 40f;
		val2.preferredHeight = 40f;
		val2.flexibleWidth = 1f;
		HorizontalLayoutGroup val3 = val.AddComponent<HorizontalLayoutGroup>();
		((HorizontalOrVerticalLayoutGroup)val3).spacing = 12f;
		((LayoutGroup)val3).childAlignment = (TextAnchor)4;
		((HorizontalOrVerticalLayoutGroup)val3).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)val3).childControlHeight = true;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandWidth = false;
		((HorizontalOrVerticalLayoutGroup)val3).childForceExpandHeight = false;
		CreateBottomButton(val.transform, "Reset to Default", ResetColor, Color.white, delegate
		{
			RSSettings.ResetToDefault();
			Transform parent2 = panelObject.transform.parent;
			Object.DestroyImmediate((Object)(object)panelObject);
			BuildPanel(parent2);
		});
		CreateBottomButton(val.transform, "Close", AccentColor, DarkTextColor, delegate
		{
			panelObject.SetActive(false);
		});
	}

	private static void CreateBottomButton(Transform parent, string text, Color bgColor, Color textColor, Action onClick)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0088: 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_00ac: Expected O, but got Unknown
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_00f2: 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_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Expected O, but got Unknown
		GameObject val = new GameObject(text.Replace(" ", "") + "Button");
		val.transform.SetParent(parent, false);
		LayoutElement val2 = val.AddComponent<LayoutElement>();
		val2.preferredHeight = 34f;
		val2.minHeight = 34f;
		val2.preferredWidth = 140f;
		val2.minWidth = 140f;
		val2.flexibleWidth = 0f;
		Image val3 = val.AddComponent<Image>();
		((Graphic)val3).color = bgColor;
		Button val4 = val.AddComponent<Button>();
		((Selectable)val4).targetGraphic = (Graphic)(object)val3;
		GameObject val5 = new GameObject("Label");
		val5.transform.SetParent(val.transform, false);
		RectTransform val6 = val5.AddComponent<RectTransform>();
		val6.anchorMin = Vector2.zero;
		val6.anchorMax = Vector2.one;
		val6.offsetMin = Vector2.zero;
		val6.offsetMax = Vector2.zero;
		TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val7).text = text;
		((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
		((Graphic)val7).color = textColor;
		((TMP_Text)val7).fontStyle = (FontStyles)1;
		((TMP_Text)val7).fontSize = 15f;
		((UnityEvent)val4.onClick).AddListener((UnityAction)delegate
		{
			onClick();
			EventSystem.current.SetSelectedGameObject((GameObject)null);
		});
	}
}
[BepInPlugin("com.shadowblade.riskystats", "Risky Stats", "1.1.1")]
public class RiskyStatsPlugin : BaseUnityPlugin
{
	private const string CurrentConfigVersion = "1.1.1";

	private GameObject statsObject;

	private HorizontalOrVerticalLayoutGroup mainLayoutGroup;

	private GameObject armorCritContainer;

	private readonly Dictionary<string, TextMeshProUGUI> statTexts = new Dictionary<string, TextMeshProUGUI>();

	private readonly Dictionary<string, GameObject> statObjects = new Dictionary<string, GameObject>();

	private readonly string[] statKeys = new string[9] { "AttackSpeed", "Armor", "Crit", "Healing", "Damage", "Streak", "DamageTaken", "DamageTakenStreak", "Speed" };

	private readonly string[] containerStats = new string[3] { "AttackSpeed", "Armor", "Crit" };

	private float lastDamage;

	private float lastDamageTaken;

	private float damageStreak;

	private float damageTakenStreak;

	private float healingStreak;

	private bool lastDamageCrit;

	private float lastDamageTime;

	private float lastTakenTime;

	private float lastHealingTime;

	private void Awake()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Risky Stats loaded!");
		MigrateConfigIfNeeded();
		RSSettings.Init(((BaseUnityPlugin)this).Config);
		((Component)this).gameObject.AddComponent<RSSettingsUI>();
		ProgressSettings.Init(((BaseUnityPlugin)this).Config);
		((Component)this).gameObject.AddComponent<RunProgressUI>();
		GlobalEventManager.onServerDamageDealt += DamageDealt;
		HealthComponent.TakeDamage += new hook_TakeDamage(DamageTaken);
		HealthComponent.Heal += new hook_Heal(Healing);
		RSSettings.OnSettingsChanged += RefreshUI;
	}

	private void MigrateConfigIfNeeded()
	{
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Invalid comparison between Unknown and I4
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Invalid comparison between Unknown and I4
		ConfigEntry<string> val = ((BaseUnityPlugin)this).Config.Bind<string>("Internal", "Config Version", "0.0.0", "Do not edit. Used internally to migrate settings between updates.");
		if (!(val.Value == "1.1.1"))
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[RiskyStats] Migrating config from " + val.Value + " to 1.1.1."));
			ConfigEntry<KeyCode> val2 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Toggle Key", (KeyCode)118, "Key used to show/hide the stats panel");
			ConfigEntry<KeyCode> val3 = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Progress Toggle Key", (KeyCode)98, "Key to hold to show the run progress panel");
			if ((int)val2.Value == 0)
			{
				val2.Value = (KeyCode)118;
			}
			if ((int)val3.Value == 0)
			{
				val3.Value = (KeyCode)98;
			}
			val.Value = "1.1.1";
			((BaseUnityPlugin)this).Config.Save();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[RiskyStats] Config migration complete.");
		}
	}

	private void OnDestroy()
	{
		RSSettings.OnSettingsChanged -= RefreshUI;
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (UnityInput.Current.GetKeyDown(RSSettings.ToggleKey) && (Object)(object)statsObject != (Object)null)
		{
			statsObject.SetActive(!statsObject.activeSelf);
		}
		if ((Object)(object)statsObject == (Object)null)
		{
			HUD val = Object.FindObjectOfType<HUD>();
			if ((Object)(object)val != (Object)null)
			{
				CreateUI(val);
			}
		}
		if ((Object)(object)statsObject != (Object)null && statsObject.activeSelf)
		{
			UpdateStats();
		}
	}

	private void CreateUI(HUD hud)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		statsObject = new GameObject("RiskyStatsPanel");
		statsObject.transform.SetParent(hud.mainContainer.transform, false);
		RectTransform val = statsObject.AddComponent<RectTransform>();
		val.anchorMin = new Vector2(0f, 1f);
		val.anchorMax = new Vector2(0f, 1f);
		val.pivot = new Vector2(0f, 1f);
		val.anchoredPosition = new Vector2(20f, -160f);
		val.sizeDelta = new Vector2(1700f, 130f);
		BuildUI();
		ApplySettings();
	}

	private void BuildUI()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Expected O, but got Unknown
		if ((Object)(object)mainLayoutGroup != (Object)null)
		{
			Object.DestroyImmediate((Object)(object)mainLayoutGroup);
			mainLayoutGroup = null;
		}
		List<Transform> list = new List<Transform>();
		foreach (Transform item2 in statsObject.transform)
		{
			Transform item = item2;
			list.Add(item);
		}
		foreach (Transform item3 in list)
		{
			Object.DestroyImmediate((Object)(object)((Component)item3).gameObject);
		}
		armorCritContainer = null;
		statTexts.Clear();
		statObjects.Clear();
		if (RSSettings.Alignment == StatAlignment.Horizontal)
		{
			mainLayoutGroup = (HorizontalOrVerticalLayoutGroup)(object)statsObject.AddComponent<HorizontalLayoutGroup>();
		}
		else
		{
			mainLayoutGroup = (HorizontalOrVerticalLayoutGroup)(object)statsObject.AddComponent<VerticalLayoutGroup>();
		}
		mainLayoutGroup.spacing = RSSettings.StatSpacing;
		((LayoutGroup)mainLayoutGroup).childAlignment = (TextAnchor)3;
		mainLayoutGroup.childControlWidth = true;
		mainLayoutGroup.childForceExpandWidth = false;
		mainLayoutGroup.childControlHeight = true;
		mainLayoutGroup.childForceExpandHeight = false;
		if (RSSettings.Alignment == StatAlignment.Horizontal)
		{
			armorCritContainer = new GameObject("ArmorCritContainer");
			armorCritContainer.transform.SetParent(statsObject.transform, false);
			VerticalLayoutGroup val = armorCritContainer.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val).spacing = 4f;
			((LayoutGroup)val).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)val).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)val).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
			LayoutElement val2 = armorCritContainer.AddComponent<LayoutElement>();
			val2.minWidth = 0f;
			val2.preferredWidth = -1f;
		}
		string[] array = statKeys;
		foreach (string key in array)
		{
			TextMeshProUGUI val3 = CreateText(parent: (RSSettings.Alignment != StatAlignment.Horizontal || !Array.Exists(containerStats, (string s) => s == key)) ? statsObject.transform : armorCritContainer.transform, initialText: GetStatLabel(key) + ": 0");
			statTexts[key] = val3;
			statObjects[key] = ((Component)val3).gameObject;
		}
		ContentSizeFitter val4 = statsObject.GetComponent<ContentSizeFitter>();
		if ((Object)(object)val4 == (Object)null)
		{
			val4 = statsObject.AddComponent<ContentSizeFitter>();
		}
		val4.horizontalFit = (FitMode)2;
		val4.verticalFit = (FitMode)2;
	}

	private TextMeshProUGUI CreateText(string initialText, Transform parent)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("StatText");
		val.transform.SetParent(parent, false);
		TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val2).text = initialText;
		((TMP_Text)val2).fontSize = RSSettings.StatFontSize;
		((Graphic)val2).color = Color.white;
		((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
		((TMP_Text)val2).enableWordWrapping = false;
		((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
		LayoutElement val3 = val.AddComponent<LayoutElement>();
		val3.minWidth = 0f;
		val3.preferredWidth = -1f;
		val3.flexibleWidth = 1f;
		return val2;
	}

	private void RefreshUI()
	{
		if (!((Object)(object)statsObject == (Object)null))
		{
			if ((RSSettings.Alignment == StatAlignment.Horizontal && mainLayoutGroup is VerticalLayoutGroup) || (RSSettings.Alignment == StatAlignment.Vertical && mainLayoutGroup is HorizontalLayoutGroup))
			{
				BuildUI();
			}
			else
			{
				mainLayoutGroup.spacing = RSSettings.StatSpacing;
			}
			ApplySettings();
		}
	}

	private void ApplySettings()
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		TextAlignmentOptions alignment = (TextAlignmentOptions)((RSSettings.Alignment == StatAlignment.Vertical && RSSettings.TextAlign == StatTextAlign.Left) ? 4097 : 514);
		foreach (KeyValuePair<string, TextMeshProUGUI> statText in statTexts)
		{
			((TMP_Text)statText.Value).fontSize = RSSettings.StatFontSize;
			((TMP_Text)statText.Value).alignment = alignment;
		}
		string[] array = statKeys;
		foreach (string key in array)
		{
			bool active = RSSettings.StatVisibility.ContainsKey(key) && RSSettings.StatVisibility[key];
			if (statObjects.TryGetValue(key, out var value))
			{
				value.SetActive(active);
			}
		}
	}

	private void UpdateStats()
	{
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if (!((Object)(object)val == (Object)null))
		{
			if (Time.time - lastDamageTime > 5f)
			{
				damageStreak = 0f;
			}
			if (Time.time - lastTakenTime > 5f)
			{
				damageTakenStreak = 0f;
			}
			if (Time.time - lastHealingTime > 3f)
			{
				healingStreak = 0f;
			}
			if (statObjects["Armor"].activeSelf)
			{
				((TMP_Text)statTexts["Armor"]).text = $"Armor: <color=#4A90E2>{val.armor:0}</color>";
			}
			if (statObjects["Healing"].activeSelf)
			{
				((TMP_Text)statTexts["Healing"]).text = "Healing: <color=#90EE90>" + FormatNumber(healingStreak) + "</color>";
			}
			if (statObjects["Damage"].activeSelf)
			{
				((TMP_Text)statTexts["Damage"]).text = "Damage: <color=#" + (lastDamageCrit ? "FF0000" : "FFFFFF") + ">" + FormatNumber(lastDamage) + "</color>";
			}
			if (statObjects["Streak"].activeSelf)
			{
				((TMP_Text)statTexts["Streak"]).text = "Streak: <color=#FFFF00>" + FormatNumber(damageStreak) + "</color>";
			}
			if (statObjects["DamageTaken"].activeSelf)
			{
				((TMP_Text)statTexts["DamageTaken"]).text = "Damage Taken: <color=#FF0000>" + FormatNumber(lastDamageTaken) + "</color>";
			}
			if (statObjects["DamageTakenStreak"].activeSelf)
			{
				((TMP_Text)statTexts["DamageTakenStreak"]).text = "Damage Taken Streak: <color=#FF0000>" + FormatNumber(damageTakenStreak) + "</color>";
			}
			if (statObjects["Speed"].activeSelf)
			{
				((TMP_Text)statTexts["Speed"]).text = $"Speed: <color=#00FFFF>{((Vector3)(ref val.characterMotor.velocity)).magnitude:0.0} m/s</color>";
			}
			if (statObjects["AttackSpeed"].activeSelf)
			{
				((TMP_Text)statTexts["AttackSpeed"]).text = $"Attack Speed: <color=#90EE90>{val.attackSpeed:0.0}</color>";
			}
			if (statObjects["Crit"].activeSelf)
			{
				((TMP_Text)statTexts["Crit"]).text = $"Crit: <color=#8B0000>{val.crit:0}%</color>";
			}
		}
	}

	private void DamageDealt(DamageReport report)
	{
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if (!((Object)(object)val == (Object)null) && !((Object)(object)report.attackerBody != (Object)(object)val))
		{
			lastDamage = report.damageDealt;
			lastDamageCrit = report.damageInfo.crit;
			damageStreak += report.damageDealt;
			lastDamageTime = Time.time;
		}
	}

	private void DamageTaken(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
	{
		orig.Invoke(self, info);
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if (!((Object)(object)val == (Object)null) && !((Object)(object)self.body != (Object)(object)val))
		{
			lastDamageTaken = info.damage;
			damageTakenStreak += info.damage;
			lastTakenTime = Time.time;
		}
	}

	private float Healing(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		float num = orig.Invoke(self, amount, procChainMask, nonRegen);
		LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
		CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null);
		if ((Object)(object)val != (Object)null && (Object)(object)self.body == (Object)(object)val)
		{
			healingStreak += num;
			lastHealingTime = Time.time;
		}
		return num;
	}

	private string FormatNumber(float number)
	{
		if (number >= 1E+12f)
		{
			return (number / 1E+12f).ToString("0.0") + "t";
		}
		if (number >= 1E+09f)
		{
			return (number / 1E+09f).ToString("0.0") + "b";
		}
		if (number >= 1000000f)
		{
			return (number / 1000000f).ToString("0.0") + "m";
		}
		if (number >= 1000f)
		{
			return (number / 1000f).ToString("0.0") + "k";
		}
		return number.ToString("0");
	}

	private string GetStatLabel(string key)
	{
		return key switch
		{
			"AttackSpeed" => "Attack Speed", 
			"DamageTaken" => "Damage Taken", 
			"DamageTakenStreak" => "Damage Taken Streak", 
			_ => key, 
		};
	}
}