Decompiled source of DamageTracker v1.2.1

DamageTracker.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using DamageTracker.MonoBehaviors;
using HarmonyLib;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Utils.UI;
using UnityEngine;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DamageTracker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DamageTracker")]
[assembly: AssemblyTitle("DamageTracker")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace DamageTracker
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.pudassassin.rounds.DamageTracker", "Damage Tracker", "1.2.1")]
	[BepInProcess("Rounds.exe")]
	public class DamageTracker : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__70_0;

			public static UnityAction <>9__70_1;

			public static UnityAction <>9__71_0;

			public static UnityAction <>9__71_1;

			public static UnityAction <>9__72_11;

			public static UnityAction <>9__72_12;

			public static UnityAction <>9__74_0;

			internal void <NewGUI>b__70_0()
			{
			}

			internal void <NewGUI>b__70_1()
			{
			}

			internal void <PresetsMenu>b__71_0()
			{
				damageDemoMode = false;
				SyncOptionsMenus();
			}

			internal void <PresetsMenu>b__71_1()
			{
				damageDemoMode = false;
				SyncOptionsMenus();
			}

			internal void <DamageTrackerSetting>b__72_11()
			{
				damageDemoMode = false;
				SyncOptionsMenus();
			}

			internal void <DamageTrackerSetting>b__72_12()
			{
				damageDemoMode = false;
				SyncOptionsMenus();
			}

			internal void <Start>b__74_0()
			{
			}
		}

		private const string ModId = "com.pudassassin.rounds.DamageTracker";

		private const string ModName = "Damage Tracker";

		private const string Version = "1.2.1";

		private const string CompatibilityModName = "DamageTracker";

		private static Color easyChangeColor = new Color(0.521f, 1f, 0.521f, 1f);

		private static Color hardChangeColor = new Color(1f, 0.521f, 0.521f, 1f);

		public const float RealtimeToRefresh = 0.05f;

		public static float RealtimeLastRefreshed;

		public static bool damageDemoMode = false;

		internal static Dictionary<string, List<Toggle>> TogglesToSync = new Dictionary<string, List<Toggle>>();

		internal static Dictionary<string, List<Slider>> SlidersToSync = new Dictionary<string, List<Slider>>();

		private static string demoNumberOneString = "1.234";

		private static string demoNumberTenString = "55.555";

		private static string demoNumberHundredString = "123.456";

		private static string demoNumberThousandString = "12345.678";

		private static string demoNumberMillionString = "1234567.899";

		private static string numberFormatStyleName = "#ERROR#";

		private static List<GameObject> demoNumberOneObjects = new List<GameObject>();

		private static List<GameObject> demoNumberTenObjects = new List<GameObject>();

		private static List<GameObject> demoNumberHundredObjects = new List<GameObject>();

		private static List<GameObject> demoNumberThousandObjects = new List<GameObject>();

		private static List<GameObject> demoNumberMillionObjects = new List<GameObject>();

		private static List<GameObject> numberFormatStyleObjects = new List<GameObject>();

		public static readonly AssetBundle MainAsset = AssetUtils.LoadAssetBundleFromResources("dmgtracker_asset", typeof(DamageTracker).Assembly);

		public static int NumberFormattingStyle
		{
			get
			{
				return GetInt("NumberFormattingStyle", 1);
			}
			set
			{
				SetInt("NumberFormattingStyle", value);
			}
		}

		public static bool UsePlayerColor
		{
			get
			{
				return GetBool("UsePlayerColor", defaultValue: true);
			}
			set
			{
				SetBool("UsePlayerColor", value);
			}
		}

		public static float MaxNumberToShowDecimal
		{
			get
			{
				return GetFloat("MaxNumberToShowDecimal", 25f);
			}
			set
			{
				SetFloat("MaxNumberToShowDecimal", value);
			}
		}

		public static float ScaleDecimalTextSize
		{
			get
			{
				return GetFloat("ScaleDecimalTextSize", 0.75f);
			}
			set
			{
				SetFloat("ScaleDecimalTextSize", value);
			}
		}

		public static bool HideAllDecimal
		{
			get
			{
				return GetBool("HideAllDecimal");
			}
			set
			{
				SetBool("HideAllDecimal", value);
			}
		}

		public static float NumberFontSize
		{
			get
			{
				return GetFloat("NumberFontSize", 24f);
			}
			set
			{
				SetFloat("NumberFontSize", value);
			}
		}

		public static float ScaleNumberSizeByValue
		{
			get
			{
				return GetFloat("ScaleNumberSizeByValue", 0.25f);
			}
			set
			{
				SetFloat("ScaleNumberSizeByValue", value);
			}
		}

		public static float NumberLifetime
		{
			get
			{
				return GetFloat("NumberLifetime", 2.25f);
			}
			set
			{
				SetFloat("NumberLifetime", value);
			}
		}

		public static float NumberOpaqueTime
		{
			get
			{
				return GetFloat("NumberOpaqueTime", 1.45f);
			}
			set
			{
				SetFloat("NumberOpaqueTime", value);
			}
		}

		public static float NumberSumTimeWindow
		{
			get
			{
				return GetFloat("NumberSumTimeWindow", 0.995f);
			}
			set
			{
				SetFloat("NumberSumTimeWindow", value);
			}
		}

		public static float NumberNewSumDelay
		{
			get
			{
				return GetFloat("NumberNewSumDelay", 0.35f);
			}
			set
			{
				SetFloat("NumberNewSumDelay", value);
			}
		}

		internal static string ConfigKey(string name)
		{
			return "DamageTracker_" + name.ToLower();
		}

		internal static bool GetBool(string name, bool defaultValue = false)
		{
			return PlayerPrefs.GetInt(ConfigKey(name), defaultValue ? 1 : 0) == 1;
		}

		internal static void SetBool(string name, bool value)
		{
			PlayerPrefs.SetInt(ConfigKey(name), value ? 1 : 0);
		}

		internal static int GetInt(string name, int defaultValue = 0)
		{
			return PlayerPrefs.GetInt(ConfigKey(name), defaultValue);
		}

		internal static void SetInt(string name, int value)
		{
			PlayerPrefs.SetInt(ConfigKey(name), value);
		}

		internal static float GetFloat(string name, float defaultValue = 0f)
		{
			return PlayerPrefs.GetFloat(ConfigKey(name), defaultValue);
		}

		internal static void SetFloat(string name, float value)
		{
			PlayerPrefs.SetFloat(ConfigKey(name), value);
		}

		private static void ClassicPlusPreset()
		{
			NumberFormattingStyle = 1;
			UsePlayerColor = false;
			MaxNumberToShowDecimal = 10f;
			ScaleDecimalTextSize = 0.75f;
			HideAllDecimal = false;
			NumberFontSize = 24f;
			ScaleNumberSizeByValue = 0.1f;
			NumberLifetime = 1.65f;
			NumberOpaqueTime = 1.15f;
			NumberSumTimeWindow = 1f;
			NumberNewSumDelay = 0.1f;
			PlayerDamageTracker.UpdateConfigs();
		}

		private static void DefaultPreset()
		{
			NumberFormattingStyle = 1;
			UsePlayerColor = true;
			MaxNumberToShowDecimal = 25f;
			ScaleDecimalTextSize = 0.75f;
			HideAllDecimal = false;
			NumberFontSize = 24f;
			ScaleNumberSizeByValue = 0.25f;
			NumberLifetime = 2.25f;
			NumberOpaqueTime = 1.45f;
			NumberSumTimeWindow = 0.995f;
			NumberNewSumDelay = 0.35f;
			PlayerDamageTracker.UpdateConfigs();
		}

		private static void BeegNumberPreset()
		{
			NumberFormattingStyle = 3;
			UsePlayerColor = false;
			MaxNumberToShowDecimal = 5f;
			ScaleDecimalTextSize = 0.85f;
			HideAllDecimal = false;
			NumberFontSize = 30f;
			ScaleNumberSizeByValue = 0.35f;
			NumberLifetime = 2.35f;
			NumberOpaqueTime = 1.65f;
			NumberSumTimeWindow = 1f;
			NumberNewSumDelay = 0.5f;
			PlayerDamageTracker.UpdateConfigs();
		}

		private static void InitializeOptionsDictionaries()
		{
			if (!SlidersToSync.Keys.Contains("NumberFormattingStyle"))
			{
				SlidersToSync["NumberFormattingStyle"] = new List<Slider>();
			}
			if (!TogglesToSync.Keys.Contains("UsePlayerColor"))
			{
				TogglesToSync["UsePlayerColor"] = new List<Toggle>();
			}
			if (!SlidersToSync.Keys.Contains("MaxNumberToShowDecimal"))
			{
				SlidersToSync["MaxNumberToShowDecimal"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("ScaleDecimalTextSize"))
			{
				SlidersToSync["ScaleDecimalTextSize"] = new List<Slider>();
			}
			if (!TogglesToSync.Keys.Contains("HideAllDecimal"))
			{
				TogglesToSync["HideAllDecimal"] = new List<Toggle>();
			}
			if (!SlidersToSync.Keys.Contains("NumberFontSize"))
			{
				SlidersToSync["NumberFontSize"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("ScaleNumberSizeByValue"))
			{
				SlidersToSync["ScaleNumberSizeByValue"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("NumberLifetime"))
			{
				SlidersToSync["NumberLifetime"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("NumberOpaqueTime"))
			{
				SlidersToSync["NumberOpaqueTime"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("NumberSumTimeWindow"))
			{
				SlidersToSync["NumberSumTimeWindow"] = new List<Slider>();
			}
			if (!SlidersToSync.Keys.Contains("NumberNewSumDelay"))
			{
				SlidersToSync["NumberNewSumDelay"] = new List<Slider>();
			}
		}

		private static void SyncOptionsMenus(int recurse = 3)
		{
			foreach (Slider item in SlidersToSync["NumberFormattingStyle"])
			{
				item.value = NumberFormattingStyle;
			}
			foreach (Toggle item2 in TogglesToSync["UsePlayerColor"])
			{
				item2.isOn = UsePlayerColor;
			}
			foreach (Slider item3 in SlidersToSync["MaxNumberToShowDecimal"])
			{
				item3.value = MaxNumberToShowDecimal;
			}
			foreach (Slider item4 in SlidersToSync["ScaleDecimalTextSize"])
			{
				item4.value = ScaleDecimalTextSize;
			}
			foreach (Toggle item5 in TogglesToSync["HideAllDecimal"])
			{
				item5.isOn = HideAllDecimal;
			}
			foreach (Slider item6 in SlidersToSync["NumberFontSize"])
			{
				item6.value = NumberFontSize;
			}
			foreach (Slider item7 in SlidersToSync["ScaleNumberSizeByValue"])
			{
				item7.value = ScaleNumberSizeByValue;
			}
			foreach (Slider item8 in SlidersToSync["NumberLifetime"])
			{
				item8.value = NumberLifetime;
			}
			foreach (Slider item9 in SlidersToSync["NumberOpaqueTime"])
			{
				item9.value = NumberOpaqueTime;
			}
			foreach (Slider item10 in SlidersToSync["NumberSumTimeWindow"])
			{
				item10.value = NumberSumTimeWindow;
			}
			foreach (Slider item11 in SlidersToSync["NumberNewSumDelay"])
			{
				item11.value = NumberNewSumDelay;
			}
			if (recurse > 0)
			{
				SyncOptionsMenus(recurse - 1);
			}
		}

		private static bool RefreshCheck()
		{
			if (Time.time > RealtimeLastRefreshed + 0.05f)
			{
				RealtimeLastRefreshed = Time.time;
				return true;
			}
			return false;
		}

		private static void UpdateAndRefreshPreviews()
		{
			//IL_02b4: 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_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			if (!RefreshCheck())
			{
				return;
			}
			SyncOptionsMenus();
			int num = Mathf.CeilToInt(PlayerDamageTracker.ScaleFontSizeByValue(1.234f));
			int num2 = Mathf.CeilToInt(PlayerDamageTracker.ScaleFontSizeByValue(55.555f));
			int num3 = Mathf.CeilToInt(PlayerDamageTracker.ScaleFontSizeByValue(123.456f));
			int num4 = Mathf.CeilToInt(PlayerDamageTracker.ScaleFontSizeByValue(12345.678f));
			int num5 = Mathf.CeilToInt(PlayerDamageTracker.ScaleFontSizeByValue(1234567.9f));
			demoNumberOneString = PlayerDamageTracker.FormatNumber(1.234f, (PlayerDamageTracker.NumberFormatting)NumberFormattingStyle);
			demoNumberTenString = PlayerDamageTracker.FormatNumber(55.555f, (PlayerDamageTracker.NumberFormatting)NumberFormattingStyle);
			demoNumberHundredString = PlayerDamageTracker.FormatNumber(123.456f, (PlayerDamageTracker.NumberFormatting)NumberFormattingStyle);
			demoNumberThousandString = PlayerDamageTracker.FormatNumber(12345.678f, (PlayerDamageTracker.NumberFormatting)NumberFormattingStyle);
			demoNumberMillionString = PlayerDamageTracker.FormatNumber(1234567.9f, (PlayerDamageTracker.NumberFormatting)NumberFormattingStyle);
			demoNumberOneString = PlayerDamageTracker.ResizeDecimals(demoNumberOneString, num);
			demoNumberTenString = PlayerDamageTracker.ResizeDecimals(demoNumberTenString, num2);
			demoNumberHundredString = PlayerDamageTracker.ResizeDecimals(demoNumberHundredString, num3);
			demoNumberThousandString = PlayerDamageTracker.ResizeDecimals(demoNumberThousandString, num4);
			demoNumberMillionString = PlayerDamageTracker.ResizeDecimals(demoNumberMillionString, num5);
			if (UsePlayerColor)
			{
				demoNumberOneString = "+ " + demoNumberOneString;
				demoNumberTenString = "- " + demoNumberTenString;
				demoNumberHundredString = "+ " + demoNumberHundredString;
				demoNumberThousandString = "- " + demoNumberThousandString + "*";
				demoNumberMillionString = "+ " + demoNumberMillionString;
			}
			switch ((PlayerDamageTracker.NumberFormatting)NumberFormattingStyle)
			{
			case PlayerDamageTracker.NumberFormatting.none:
				numberFormatStyleName = "Plain";
				break;
			case PlayerDamageTracker.NumberFormatting.spacing:
				numberFormatStyleName = "Spacing";
				break;
			case PlayerDamageTracker.NumberFormatting.writtenNum:
				numberFormatStyleName = "Commas";
				break;
			case PlayerDamageTracker.NumberFormatting.shortenNum:
				numberFormatStyleName = "Shorten";
				break;
			case PlayerDamageTracker.NumberFormatting.metric:
				numberFormatStyleName = "Metric";
				break;
			case PlayerDamageTracker.NumberFormatting.sciencific:
				numberFormatStyleName = "Science!";
				break;
			default:
				numberFormatStyleName = "##ERROR##";
				break;
			}
			if (demoNumberOneObjects.Count > 0)
			{
				foreach (GameObject demoNumberOneObject in demoNumberOneObjects)
				{
					((TMP_Text)demoNumberOneObject.GetComponentInChildren<TextMeshProUGUI>()).text = demoNumberOneString;
					((TMP_Text)demoNumberOneObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMin = num;
					((TMP_Text)demoNumberOneObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMax = num;
					if (UsePlayerColor)
					{
						((Graphic)demoNumberOneObject.GetComponentInChildren<TextMeshProUGUI>()).color = new Color(0.25f, 0.5625f, 1f);
					}
					else
					{
						((Graphic)demoNumberOneObject.GetComponentInChildren<TextMeshProUGUI>()).color = PlayerDamageTracker.colorHeal;
					}
				}
			}
			if (demoNumberTenObjects.Count > 0)
			{
				foreach (GameObject demoNumberTenObject in demoNumberTenObjects)
				{
					((TMP_Text)demoNumberTenObject.GetComponentInChildren<TextMeshProUGUI>()).text = demoNumberTenString;
					((TMP_Text)demoNumberTenObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMin = num2;
					((TMP_Text)demoNumberTenObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMax = num2;
					if (UsePlayerColor)
					{
						((Graphic)demoNumberTenObject.GetComponentInChildren<TextMeshProUGUI>()).color = new Color(0.25f, 0.5625f, 1f);
					}
					else
					{
						((Graphic)demoNumberTenObject.GetComponentInChildren<TextMeshProUGUI>()).color = PlayerDamageTracker.colorDamage;
					}
				}
			}
			if (demoNumberHundredObjects.Count > 0)
			{
				foreach (GameObject demoNumberHundredObject in demoNumberHundredObjects)
				{
					((TMP_Text)demoNumberHundredObject.GetComponentInChildren<TextMeshProUGUI>()).text = demoNumberHundredString;
					((TMP_Text)demoNumberHundredObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMin = num3;
					((TMP_Text)demoNumberHundredObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMax = num3;
					if (UsePlayerColor)
					{
						((Graphic)demoNumberHundredObject.GetComponentInChildren<TextMeshProUGUI>()).color = new Color(1f, 0.625f, 0.25f);
					}
					else
					{
						((Graphic)demoNumberHundredObject.GetComponentInChildren<TextMeshProUGUI>()).color = PlayerDamageTracker.colorHeal;
					}
				}
			}
			if (demoNumberThousandObjects.Count > 0)
			{
				foreach (GameObject demoNumberThousandObject in demoNumberThousandObjects)
				{
					((TMP_Text)demoNumberThousandObject.GetComponentInChildren<TextMeshProUGUI>()).text = demoNumberThousandString;
					((TMP_Text)demoNumberThousandObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMin = num4;
					((TMP_Text)demoNumberThousandObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMax = num4;
					if (UsePlayerColor)
					{
						((Graphic)demoNumberThousandObject.GetComponentInChildren<TextMeshProUGUI>()).color = new Color(1f, 0.625f, 0.25f);
					}
					else
					{
						((Graphic)demoNumberThousandObject.GetComponentInChildren<TextMeshProUGUI>()).color = PlayerDamageTracker.colorNegHeal;
					}
				}
			}
			if (demoNumberMillionObjects.Count > 0)
			{
				foreach (GameObject demoNumberMillionObject in demoNumberMillionObjects)
				{
					((TMP_Text)demoNumberMillionObject.GetComponentInChildren<TextMeshProUGUI>()).text = demoNumberMillionString;
					((TMP_Text)demoNumberMillionObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMin = num5;
					((TMP_Text)demoNumberMillionObject.GetComponentInChildren<TextMeshProUGUI>()).fontSizeMax = num5;
					if (UsePlayerColor)
					{
						((Graphic)demoNumberMillionObject.GetComponentInChildren<TextMeshProUGUI>()).color = new Color(0.25f, 0.5625f, 1f);
					}
					else
					{
						((Graphic)demoNumberMillionObject.GetComponentInChildren<TextMeshProUGUI>()).color = PlayerDamageTracker.colorHeal;
					}
				}
			}
			if (numberFormatStyleObjects.Count <= 0)
			{
				return;
			}
			foreach (GameObject numberFormatStyleObject in numberFormatStyleObjects)
			{
				((TMP_Text)numberFormatStyleObject.GetComponentInChildren<TextMeshProUGUI>()).text = numberFormatStyleName;
			}
		}

		private static void NewGUI(GameObject menu)
		{
			//IL_006c: 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_0077: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			InitializeOptionsDictionaries();
			TextMeshProUGUI val = default(TextMeshProUGUI);
			MenuHandler.CreateText("<b>Damage Tracker Options</b>", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			object obj = <>c.<>9__70_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
				};
				<>c.<>9__70_0 = val2;
				obj = (object)val2;
			}
			GameObject menu2 = MenuHandler.CreateMenu("Presets", (UnityAction)obj, menu, 60, true, true, ((Component)menu.transform.parent).gameObject, true, -1);
			PresetsMenu(menu2);
			object obj2 = <>c.<>9__70_1;
			if (obj2 == null)
			{
				UnityAction val3 = delegate
				{
				};
				<>c.<>9__70_1 = val3;
				obj2 = (object)val3;
			}
			GameObject menu3 = MenuHandler.CreateMenu("Setting", (UnityAction)obj2, menu, 60, true, true, ((Component)menu.transform.parent).gameObject, true, -1);
			DamageTrackerSetting(menu3);
			MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
		}

		private static void PresetsMenu(GameObject menu)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0088: 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_00aa: Expected O, but got Unknown
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			MenuHandler.CreateButton("Damage Indicator+", menu, new UnityAction(ClassicPlusPreset), 60, true, (Color?)easyChangeColor, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			TextMeshProUGUI val = default(TextMeshProUGUI);
			MenuHandler.CreateText("<i>a familiar classic</i>", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateButton("Default", menu, new UnityAction(DefaultPreset), 60, true, (Color?)easyChangeColor, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText("<i>recommended settings</i>", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateButton("BEEG NUMBERS", menu, new UnityAction(BeegNumberPreset), 60, true, (Color?)easyChangeColor, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText("<i>bigger number in a shorter format</i>", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			UnityEvent goBackEvent = menu.GetComponentInChildren<GoBack>(true).goBackEvent;
			object obj = <>c.<>9__71_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
					damageDemoMode = false;
					SyncOptionsMenus();
				};
				<>c.<>9__71_0 = val2;
				obj = (object)val2;
			}
			goBackEvent.AddListener((UnityAction)obj);
			ButtonClickedEvent onClick = ((Component)menu.transform.Find("Group/Back")).gameObject.GetComponent<Button>().onClick;
			object obj2 = <>c.<>9__71_1;
			if (obj2 == null)
			{
				UnityAction val3 = delegate
				{
					damageDemoMode = false;
					SyncOptionsMenus();
				};
				<>c.<>9__71_1 = val3;
				obj2 = (object)val3;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj2);
		}

		private static void DamageTrackerSetting(GameObject menu)
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Expected O, but got Unknown
			//IL_067e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Expected O, but got Unknown
			UpdateAndRefreshPreviews();
			TextMeshProUGUI val2 = default(TextMeshProUGUI);
			MenuHandler.CreateText("Number Formatting", menu, ref val2, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			demoNumberOneObjects.Add(MenuHandler.CreateText(demoNumberOneString, menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			demoNumberTenObjects.Add(MenuHandler.CreateText(demoNumberTenString, menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			demoNumberHundredObjects.Add(MenuHandler.CreateText(demoNumberHundredString, menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			demoNumberThousandObjects.Add(MenuHandler.CreateText(demoNumberThousandString, menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			demoNumberMillionObjects.Add(MenuHandler.CreateText(demoNumberMillionString, menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			List<GameObject> list = numberFormatStyleObjects;
			string text = numberFormatStyleName;
			float num = NumberFormattingStyle;
			UnityAction<float> obj = NumberFormatChanged;
			Color? val3 = Color.white;
			Slider item = default(Slider);
			list.Add(MenuHandler.CreateSlider(text, menu, 30, 0f, 5f, num, obj, ref item, true, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			Object.Destroy((Object)(object)((Component)numberFormatStyleObjects[numberFormatStyleObjects.Count - 1].GetComponentInChildren<TMP_InputField>()).gameObject);
			SlidersToSync["NumberFormattingStyle"].Add(item);
			MenuHandler.CreateToggle(UsePlayerColor, "Use Player's Color", menu, (UnityAction<bool>)UsePlayerColorToggled, 30, true, (Color?)easyChangeColor, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val2, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			UpdateAndRefreshPreviews();
			float maxNumberToShowDecimal = MaxNumberToShowDecimal;
			UnityAction<float> obj2 = MaxNumberToShowDecimalChanged;
			val3 = Color.white;
			Slider item2 = default(Slider);
			MenuHandler.CreateSlider("Max Number to Show Decimals", menu, 30, 0f, 1000f, maxNumberToShowDecimal, obj2, ref item2, true, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["MaxNumberToShowDecimal"].Add(item2);
			float scaleDecimalTextSize = ScaleDecimalTextSize;
			UnityAction<float> obj3 = ScaleDecimalTextSizeChanged;
			val3 = Color.white;
			Slider item3 = default(Slider);
			MenuHandler.CreateSlider("Decimal Text Scale", menu, 30, 0.1f, 1f, scaleDecimalTextSize, obj3, ref item3, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["ScaleDecimalTextSize"].Add(item3);
			MenuHandler.CreateToggle(HideAllDecimal, "Hide ALL Decimals", menu, (UnityAction<bool>)HideAllDecimalToggled, 30, true, (Color?)easyChangeColor, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			MenuHandler.CreateText(" ", menu, ref val2, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			float numberFontSize = NumberFontSize;
			UnityAction<float> obj4 = NumberFontSizeChanged;
			val3 = Color.white;
			Slider item4 = default(Slider);
			MenuHandler.CreateSlider("Number Base Size", menu, 30, 4f, 96f, numberFontSize, obj4, ref item4, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["NumberFontSize"].Add(item4);
			float scaleNumberSizeByValue = ScaleNumberSizeByValue;
			UnityAction<float> obj5 = ScaleNumberSizeByValueChanged;
			val3 = Color.white;
			Slider item5 = default(Slider);
			MenuHandler.CreateSlider("Value-to-Size Scaling", menu, 30, 0f, 1f, scaleNumberSizeByValue, obj5, ref item5, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["ScaleNumberSizeByValue"].Add(item5);
			MenuHandler.CreateText(" ", menu, ref val2, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			float numberLifetime = NumberLifetime;
			UnityAction<float> obj6 = NumberLifetimeChanged;
			val3 = Color.white;
			Slider item6 = default(Slider);
			MenuHandler.CreateSlider("Number Display Time", menu, 30, 0.5f, 5f, numberLifetime, obj6, ref item6, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["NumberLifetime"].Add(item6);
			float numberOpaqueTime = NumberOpaqueTime;
			UnityAction<float> obj7 = NumberOpaqueTimeChanged;
			val3 = Color.white;
			Slider item7 = default(Slider);
			MenuHandler.CreateSlider("Number Opaque Time", menu, 30, 0f, 5f, numberOpaqueTime, obj7, ref item7, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["NumberOpaqueTime"].Add(item7);
			float numberSumTimeWindow = NumberSumTimeWindow;
			UnityAction<float> obj8 = NumberSumTimeWindowChanged;
			val3 = hardChangeColor;
			Slider item8 = default(Slider);
			MenuHandler.CreateSlider("Number Sum Time Window", menu, 30, 0f, 5f, numberSumTimeWindow, obj8, ref item8, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["NumberSumTimeWindow"].Add(item8);
			float numberNewSumDelay = NumberNewSumDelay;
			UnityAction<float> obj9 = NumberNewSumDelayChanged;
			val3 = hardChangeColor;
			Slider item9 = default(Slider);
			MenuHandler.CreateSlider("New Number Sum Delay", menu, 30, 0f, 5f, numberNewSumDelay, obj9, ref item9, false, (Color?)null, (Direction)0, true, val3, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			SlidersToSync["NumberNewSumDelay"].Add(item9);
			MenuHandler.CreateText(" ", menu, ref val2, 20, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			UnityEvent goBackEvent = menu.GetComponentInChildren<GoBack>(true).goBackEvent;
			object obj10 = <>c.<>9__72_11;
			if (obj10 == null)
			{
				UnityAction val4 = delegate
				{
					damageDemoMode = false;
					SyncOptionsMenus();
				};
				<>c.<>9__72_11 = val4;
				obj10 = (object)val4;
			}
			goBackEvent.AddListener((UnityAction)obj10);
			ButtonClickedEvent onClick = ((Component)menu.transform.Find("Group/Back")).gameObject.GetComponent<Button>().onClick;
			object obj11 = <>c.<>9__72_12;
			if (obj11 == null)
			{
				UnityAction val5 = delegate
				{
					damageDemoMode = false;
					SyncOptionsMenus();
				};
				<>c.<>9__72_12 = val5;
				obj11 = (object)val5;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj11);
			static void HideAllDecimalToggled(bool val)
			{
				HideAllDecimal = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void MaxNumberToShowDecimalChanged(float val)
			{
				MaxNumberToShowDecimal = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void NumberFontSizeChanged(float val)
			{
				NumberFontSize = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void NumberFormatChanged(float val)
			{
				NumberFormattingStyle = (int)val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void NumberLifetimeChanged(float val)
			{
				NumberLifetime = val;
				PlayerDamageTracker.UpdateConfigs();
			}
			static void NumberNewSumDelayChanged(float val)
			{
				NumberNewSumDelay = Mathf.Min(val, NumberLifetime);
				PlayerDamageTracker.UpdateConfigs();
			}
			static void NumberOpaqueTimeChanged(float val)
			{
				NumberOpaqueTime = val;
				PlayerDamageTracker.UpdateConfigs();
			}
			static void NumberSumTimeWindowChanged(float val)
			{
				NumberSumTimeWindow = Mathf.Min(val, NumberLifetime);
				PlayerDamageTracker.UpdateConfigs();
			}
			static void ScaleDecimalTextSizeChanged(float val)
			{
				ScaleDecimalTextSize = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void ScaleNumberSizeByValueChanged(float val)
			{
				ScaleNumberSizeByValue = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
			static void UsePlayerColorToggled(bool val)
			{
				UsePlayerColor = val;
				PlayerDamageTracker.UpdateConfigs();
				UpdateAndRefreshPreviews();
			}
		}

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.pudassassin.rounds.DamageTracker");
			val.PatchAll();
		}

		private void Start()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			Unbound.RegisterClientSideMod("com.pudassassin.rounds.DamageTracker");
			Unbound.RegisterCredits("Damage Tracker", new string[3] { "Pudassassin, Creator of GearUp Cards", "[Root], UX feedback", "Digital-7 font by Sizenko Alexander" }, new string[1] { "github" }, new string[1] { "https://github.com/Pudassassin/CardMagnifier" });
			object obj = <>c.<>9__74_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__74_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("Damage Tracker", (UnityAction)obj, (Action<GameObject>)NewGUI, (GameObject)null, true);
			GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart);
			GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart);
			GameModeManager.AddHook("PointEnd", (Func<IGameModeHandler, IEnumerator>)OnPointEnd);
		}

		public void Update()
		{
		}

		private IEnumerator OnGameStart(IGameModeHandler gm)
		{
			PlayerDamageTracker.UpdateConfigs();
			foreach (Player player in PlayerManager.instance.players)
			{
				PlayerDamageTracker tracker = ((Component)player).gameObject.GetComponent<PlayerDamageTracker>();
				if ((Object)(object)tracker != (Object)null)
				{
					Object.Destroy((Object)(object)tracker);
				}
				((Component)player).gameObject.AddComponent<PlayerDamageTracker>();
			}
			yield break;
		}

		private IEnumerator OnPointStart(IGameModeHandler gm)
		{
			PlayerDamageTracker.stopTracking = false;
			yield break;
		}

		private IEnumerator OnPointEnd(IGameModeHandler gm)
		{
			PlayerDamageTracker.stopTracking = true;
			yield break;
		}
	}
}
namespace DamageTracker.Patches
{
	[HarmonyPatch(typeof(HealthHandler))]
	internal class HealthHandler_Patch
	{
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		[HarmonyPatch("Heal")]
		private static void RecordHeal(Player ___player, ref float healAmount)
		{
			if (!(___player.data.health >= ___player.data.maxHealth) || !(healAmount > 0f))
			{
				PlayerDamageTracker component = ((Component)___player).gameObject.GetComponent<PlayerDamageTracker>();
				if ((Object)(object)component == (Object)null)
				{
					((Component)___player).gameObject.AddComponent<PlayerDamageTracker>();
				}
				else if (healAmount > 0f)
				{
					component.TrackHeal(healAmount);
				}
				else if (healAmount < 0f)
				{
					component.TrackNegHeal(0f - healAmount);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPriority(0)]
		[HarmonyPatch("DoDamage")]
		private static void RecordDamage(HealthHandler __instance, ref Vector2 damage, Player ___player)
		{
			PlayerDamageTracker component = ((Component)___player).gameObject.GetComponent<PlayerDamageTracker>();
			if ((Object)(object)component == (Object)null)
			{
				((Component)___player).gameObject.AddComponent<PlayerDamageTracker>();
			}
			else
			{
				component.TrackDamage(((Vector2)(ref damage)).magnitude);
			}
		}
	}
}
namespace DamageTracker.MonoBehaviors
{
	public class PlayerDamageTracker : MonoBehaviour
	{
		public enum NumberFormatting
		{
			none,
			spacing,
			writtenNum,
			shortenNum,
			metric,
			sciencific
		}

		public static GameObject prefabNumberObject = DamageTracker.MainAsset.LoadAsset<GameObject>("DamageNumber");

		public static GameObject prefabNumberCanvas = DamageTracker.MainAsset.LoadAsset<GameObject>("DamageNumberCanvas");

		public static List<string> postfixIRL = new List<string>
		{
			"ki", "mil", "bil", "tri", "quad", "quin", "sext", "septi", "octil", "nonil",
			"decill"
		};

		public static List<string> postfixMetric = new List<string> { "ki", "Me", "Gi", "Te", "Pe", "Ex", "Ze", "Yo" };

		public static NumberFormatting formatSetting = NumberFormatting.spacing;

		public static bool usePlayerColor = true;

		public static float maxValueToShowDecimal = 25f;

		public static bool hideDecimalOveride = false;

		public static float scaleDecimalPart = 0.75f;

		public static float baseFontSize = 24f;

		public static float baseNumberScale = 1f;

		public static float logNumberScale = 0.25f;

		public static float logExponent = 100f;

		public static float damageNumberLifetime = 2.25f;

		public static float damageNumberFullOpaqueTime = 1.45f;

		public static float dpsMeasureWindow = 0.995f;

		public static float dpsMeasureIdleTime = 0.35f;

		public static Vector3 numberSpawnOffset = new Vector3(0f, 35f, 0f);

		public static Vector3 numberSpawnOffsetHeal = new Vector3(-10f, 5f, 0f);

		public static Vector3 numberObjectVelocity = new Vector3(0f, 35f, 0f);

		public static Color colorDamage = new Color(1f, 0.35f, 0.35f);

		public static Color colorHeal = new Color(0.35f, 1f, 0.35f);

		public static Color colorNegHeal = new Color(1f, 0.35f, 1f);

		public static Color colorUnclassified = new Color(0.75f, 0.75f, 0.75f);

		public static Color brightenPlayerColor = new Color(0.2f, 0.2f, 0.2f, 1f);

		public static Color darkenNumberOutline = new Color(0.5f, 0.5f, 0.5f, 0.45f);

		public static float fontWidthToHeightRatio = 0.5f;

		public static float textPadding = 15f;

		public static float textUnstackingSpeedMul = 6.5f;

		public static GameObject canvasObject = null;

		public static List<GameObject> numberObjects = new List<GameObject>();

		private GameObject focusNumDamage;

		private GameObject focusNumHeal;

		private GameObject focusNumNegHeal;

		private GameObject focusNumMisc;

		private float timerNumDamage;

		private float timerNumHeal;

		private float timerNumNegHeal;

		private float timerNumMisc;

		private float timerLastDamage;

		private float timerLastHeal;

		private float timerLastNegHeal;

		private float timerLastMisc;

		private CharacterData playerData;

		private Color playerColor = Color.black;

		public static bool stopTracking = false;

		public static void UpdateConfigs()
		{
			formatSetting = (NumberFormatting)DamageTracker.NumberFormattingStyle;
			usePlayerColor = DamageTracker.UsePlayerColor;
			maxValueToShowDecimal = DamageTracker.MaxNumberToShowDecimal;
			scaleDecimalPart = DamageTracker.ScaleDecimalTextSize;
			hideDecimalOveride = DamageTracker.HideAllDecimal;
			baseFontSize = DamageTracker.NumberFontSize;
			logNumberScale = DamageTracker.ScaleNumberSizeByValue;
			damageNumberLifetime = DamageTracker.NumberLifetime;
			damageNumberFullOpaqueTime = DamageTracker.NumberOpaqueTime;
			dpsMeasureWindow = DamageTracker.NumberSumTimeWindow;
			dpsMeasureIdleTime = DamageTracker.NumberNewSumDelay;
		}

		public void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			playerData = ((Component)this).GetComponent<CharacterData>();
			PlayerSkinParticle componentInChildren = ((Component)this).GetComponentInChildren<PlayerSkinParticle>();
			playerColor = Traverse.Create((object)componentInChildren).Field("startColor2").GetValue<Color>();
			if ((Object)(object)canvasObject == (Object)null)
			{
				canvasObject = Object.Instantiate<GameObject>(prefabNumberCanvas);
			}
		}

		public void Update()
		{
			if ((Object)(object)playerData == (Object)null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			if ((Object)(object)focusNumDamage != (Object)null)
			{
				if (timerNumDamage > dpsMeasureWindow || timerLastDamage > dpsMeasureIdleTime)
				{
					focusNumDamage = null;
					timerNumDamage = 0f;
					timerLastDamage = 0f;
				}
				else
				{
					timerLastDamage += TimeHandler.deltaTime;
					timerNumDamage += TimeHandler.deltaTime;
				}
			}
			if ((Object)(object)focusNumHeal != (Object)null)
			{
				if (timerNumHeal > dpsMeasureWindow || timerLastHeal > dpsMeasureIdleTime)
				{
					focusNumHeal = null;
					timerNumHeal = 0f;
					timerLastHeal = 0f;
				}
				else
				{
					timerLastHeal += TimeHandler.deltaTime;
					timerNumHeal += TimeHandler.deltaTime;
				}
			}
			if ((Object)(object)focusNumNegHeal != (Object)null)
			{
				if (timerNumNegHeal > dpsMeasureWindow || timerLastNegHeal > dpsMeasureIdleTime)
				{
					focusNumNegHeal = null;
					timerNumNegHeal = 0f;
					timerLastNegHeal = 0f;
				}
				else
				{
					timerLastNegHeal += TimeHandler.deltaTime;
					timerNumNegHeal += TimeHandler.deltaTime;
				}
			}
		}

		public static bool PlayerAlive(Player player)
		{
			return !player.data.dead;
		}

		public static bool PlayerSimulated(Player player)
		{
			return (bool)Traverse.Create((object)player.data.playerVel).Field("simulated").GetValue();
		}

		public static bool PlayerAliveAndSimulated(Player player)
		{
			if (PlayerAlive(player))
			{
				return PlayerSimulated(player);
			}
			return false;
		}

		public void TrackDamage(float number)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			if (number < 0f || stopTracking || !PlayerAliveAndSimulated(playerData.player) || playerData.healthHandler.isRespawning)
			{
				return;
			}
			DamageNumberMono damageNumberMono = null;
			if ((Object)(object)focusNumDamage != (Object)null)
			{
				damageNumberMono = focusNumDamage.GetComponent<DamageNumberMono>();
				timerLastDamage = 0f;
			}
			else
			{
				focusNumDamage = Object.Instantiate<GameObject>(prefabNumberObject, canvasObject.transform);
				Vector3 val = MainCam.instance.cam.WorldToScreenPoint(((Component)this).transform.position);
				focusNumDamage.transform.position = val + numberSpawnOffset;
				RemoveAfterSeconds val2 = focusNumDamage.AddComponent<RemoveAfterSeconds>();
				val2.seconds = damageNumberLifetime;
				val2.scaleWithScale = false;
				val2.shrink = false;
				damageNumberMono = focusNumDamage.AddComponent<DamageNumberMono>();
				damageNumberMono.type = DamageNumberMono.NumberType.damage;
				if (usePlayerColor)
				{
					damageNumberMono.textColor = playerColor + brightenPlayerColor;
					damageNumberMono.outlineColor = colorDamage - darkenNumberOutline;
				}
				else
				{
					damageNumberMono.textColor = colorDamage;
					damageNumberMono.outlineColor = Color.black;
				}
				damageNumberMono.lifetime = damageNumberLifetime;
				damageNumberMono.timeFullOpaque = damageNumberFullOpaqueTime;
				damageNumberMono.velocity = numberObjectVelocity;
				((Component)damageNumberMono).GetComponent<Text>().text = "";
			}
			damageNumberMono.value += number;
			damageNumberMono.display = FormatNumber(damageNumberMono.value, formatSetting);
			damageNumberMono.fontSize = ScaleFontSizeByValue(damageNumberMono.value);
			damageNumberMono.display = ResizeDecimals(damageNumberMono.display, damageNumberMono.fontSize);
			if (usePlayerColor)
			{
				damageNumberMono.display = "- " + damageNumberMono.display;
			}
		}

		public void TrackHeal(float number)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			if (number < 0f || stopTracking || !PlayerAliveAndSimulated(playerData.player) || playerData.healthHandler.isRespawning)
			{
				return;
			}
			DamageNumberMono damageNumberMono = null;
			if ((Object)(object)focusNumHeal != (Object)null)
			{
				damageNumberMono = focusNumHeal.GetComponent<DamageNumberMono>();
				timerLastHeal = 0f;
			}
			else
			{
				focusNumHeal = Object.Instantiate<GameObject>(prefabNumberObject, canvasObject.transform);
				Vector3 val = MainCam.instance.cam.WorldToScreenPoint(((Component)this).transform.position);
				focusNumHeal.transform.position = val + numberSpawnOffset + numberSpawnOffsetHeal;
				RemoveAfterSeconds val2 = focusNumHeal.AddComponent<RemoveAfterSeconds>();
				val2.seconds = damageNumberLifetime;
				val2.scaleWithScale = false;
				val2.shrink = false;
				damageNumberMono = focusNumHeal.AddComponent<DamageNumberMono>();
				damageNumberMono.type = DamageNumberMono.NumberType.heal;
				if (usePlayerColor)
				{
					damageNumberMono.textColor = playerColor + brightenPlayerColor;
					damageNumberMono.outlineColor = colorHeal - darkenNumberOutline;
				}
				else
				{
					damageNumberMono.textColor = colorHeal;
					damageNumberMono.outlineColor = Color.black;
				}
				damageNumberMono.lifetime = damageNumberLifetime;
				damageNumberMono.timeFullOpaque = damageNumberFullOpaqueTime;
				damageNumberMono.velocity = numberObjectVelocity;
				((Component)damageNumberMono).GetComponent<Text>().text = "";
			}
			damageNumberMono.value += number;
			damageNumberMono.display = FormatNumber(damageNumberMono.value, formatSetting);
			damageNumberMono.fontSize = ScaleFontSizeByValue(damageNumberMono.value);
			damageNumberMono.display = ResizeDecimals(damageNumberMono.display, damageNumberMono.fontSize);
			if (usePlayerColor)
			{
				damageNumberMono.display = "+ " + damageNumberMono.display;
			}
		}

		public void TrackNegHeal(float number)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			if (number < 0f || stopTracking || !PlayerAliveAndSimulated(playerData.player) || playerData.healthHandler.isRespawning)
			{
				return;
			}
			DamageNumberMono damageNumberMono = null;
			if ((Object)(object)focusNumNegHeal != (Object)null)
			{
				damageNumberMono = focusNumNegHeal.GetComponent<DamageNumberMono>();
				timerLastNegHeal = 0f;
			}
			else
			{
				focusNumNegHeal = Object.Instantiate<GameObject>(prefabNumberObject, canvasObject.transform);
				Vector3 val = MainCam.instance.cam.WorldToScreenPoint(((Component)this).transform.position);
				focusNumNegHeal.transform.position = val + numberSpawnOffset - numberSpawnOffsetHeal;
				RemoveAfterSeconds val2 = focusNumNegHeal.AddComponent<RemoveAfterSeconds>();
				val2.seconds = damageNumberLifetime;
				val2.scaleWithScale = false;
				val2.shrink = false;
				damageNumberMono = focusNumNegHeal.AddComponent<DamageNumberMono>();
				damageNumberMono.type = DamageNumberMono.NumberType.negHeal;
				if (usePlayerColor)
				{
					damageNumberMono.textColor = playerColor + brightenPlayerColor;
					damageNumberMono.outlineColor = colorNegHeal - darkenNumberOutline;
				}
				else
				{
					damageNumberMono.textColor = colorNegHeal;
					damageNumberMono.outlineColor = Color.black;
				}
				damageNumberMono.type = DamageNumberMono.NumberType.negHeal;
				damageNumberMono.lifetime = damageNumberLifetime;
				damageNumberMono.timeFullOpaque = damageNumberFullOpaqueTime;
				damageNumberMono.velocity = numberObjectVelocity;
				((Component)damageNumberMono).GetComponent<Text>().text = "";
			}
			damageNumberMono.value += number;
			damageNumberMono.display = FormatNumber(damageNumberMono.value, formatSetting);
			damageNumberMono.fontSize = ScaleFontSizeByValue(damageNumberMono.value);
			damageNumberMono.display = ResizeDecimals(damageNumberMono.display, damageNumberMono.fontSize);
			if (usePlayerColor)
			{
				damageNumberMono.display = "- " + damageNumberMono.display + "*";
			}
		}

		public static string FormatNumber(float number, NumberFormatting formatting)
		{
			string result = number.ToString();
			bool flag = number < maxValueToShowDecimal && !hideDecimalOveride;
			switch (formatting)
			{
			case NumberFormatting.none:
				result = ((!flag) ? number.ToString("F0") : number.ToString("F3"));
				break;
			case NumberFormatting.spacing:
				result = ((!flag) ? number.ToString("N0", CultureInfo.InvariantCulture).Replace(',', ' ') : number.ToString("N3", CultureInfo.InvariantCulture).Replace(',', ' '));
				break;
			case NumberFormatting.writtenNum:
				result = ((!flag) ? number.ToString("N0") : number.ToString("N3"));
				break;
			case NumberFormatting.shortenNum:
				result = FormatColloquialNumber(number);
				break;
			case NumberFormatting.metric:
				result = FormatMetricNumber(number);
				break;
			case NumberFormatting.sciencific:
				result = ((!(number <= 1000000f)) ? number.ToString("E2") : ((!flag) ? number.ToString("N0", CultureInfo.InvariantCulture).Replace(',', ' ') : number.ToString("N3", CultureInfo.InvariantCulture).Replace(',', ' ')));
				break;
			}
			return result;
		}

		public static void ExtractFloat(float number, out int exponent, out float mantissa, bool divThousand = true)
		{
			exponent = 0;
			if (divThousand)
			{
				while (number > 1000f)
				{
					number /= 1000f;
					exponent += 3;
				}
			}
			else
			{
				while (number > 10f)
				{
					number /= 10f;
					exponent++;
				}
			}
			mantissa = number;
		}

		public static string FormatColloquialNumber(float number)
		{
			string text = number.ToString("N3");
			bool flag = number < maxValueToShowDecimal && !hideDecimalOveride;
			if (number >= 1000f)
			{
				ExtractFloat(number, out var exponent, out var mantissa);
				int num = exponent / 3 - 1;
				if (num >= postfixIRL.Count)
				{
					num = postfixIRL.Count - 1;
					int num2 = (num + 1) * 3;
					mantissa = number / Mathf.Pow(10f, (float)num2);
				}
				if (!hideDecimalOveride)
				{
					return mantissa.ToString("N2") + " " + postfixIRL[num];
				}
				return mantissa.ToString("N0") + " " + postfixIRL[num];
			}
			if (flag)
			{
				return number.ToString("N3");
			}
			return number.ToString("N0");
		}

		public static string FormatMetricNumber(float number)
		{
			string text = number.ToString("F3");
			bool flag = number < maxValueToShowDecimal && !hideDecimalOveride;
			if (number >= 1000f)
			{
				ExtractFloat(number, out var exponent, out var mantissa);
				int num = exponent / 3 - 1;
				if (num >= postfixMetric.Count)
				{
					num = postfixMetric.Count - 1;
					int num2 = (num + 1) * 3;
					mantissa = number / Mathf.Pow(10f, (float)num2);
				}
				if (!hideDecimalOveride)
				{
					return mantissa.ToString("F3") + " " + postfixMetric[num];
				}
				return mantissa.ToString("F0") + " " + postfixMetric[num];
			}
			if (flag)
			{
				return number.ToString("F3");
			}
			return number.ToString("F0");
		}

		public static float ScaleFontSizeByValue(float value)
		{
			return baseFontSize * (baseNumberScale + (Mathf.Log(value, logExponent) - 1f) * logNumberScale);
		}

		public static string ResizeDecimals(string input, float currentSize)
		{
			string text = input;
			int num = Mathf.FloorToInt(currentSize * scaleDecimalPart);
			if (text.Contains("."))
			{
				int startIndex = text.IndexOf(".") + 1;
				text = text.Insert(startIndex, $"<size={num}>");
				int num2 = Mathf.Max(new int[3]
				{
					text.IndexOf(" ", startIndex),
					text.IndexOf("E+", startIndex),
					text.IndexOf("e+", startIndex)
				});
				text = ((num2 < 0) ? (text + "</size>") : text.Insert(num2, "</size>"));
			}
			return text;
		}
	}
	public class DamageNumberMono : MonoBehaviour
	{
		public enum NumberType
		{
			unclassified,
			damage,
			heal,
			negHeal
		}

		public static float realtimeToDestroyScale = 3.5f;

		public NumberType type;

		public Text text;

		public Outline textOutline;

		public float value;

		public string display;

		public float fontSize;

		public float lifetime = 3f;

		public float timeFullOpaque = 1.5f;

		public float timer = 0f;

		public float realTImer = 0f;

		public Vector2 textSize = Vector2.zero;

		public Vector3 velocity = new Vector3(0f, 1.5f, 0f);

		public bool isUnstacking = false;

		public Color textColor = Color.white;

		public Color outlineColor = Color.black;

		public void Awake()
		{
			text = ((Component)this).GetComponent<Text>();
			textOutline = ((Component)this).GetComponent<Outline>();
			PlayerDamageTracker.numberObjects.Add(((Component)this).gameObject);
		}

		public void Update()
		{
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: 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_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: 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)
			UpdateText();
			if (timer > lifetime)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else if (realTImer > lifetime * realtimeToDestroyScale)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else if (timer > timeFullOpaque)
			{
				float num = 1f - (timer - timeFullOpaque) / (lifetime - timeFullOpaque);
				((Graphic)text).color = new Color(((Graphic)text).color.r, ((Graphic)text).color.g, ((Graphic)text).color.b, num);
				((Shadow)textOutline).effectColor = new Color(((Shadow)textOutline).effectColor.r, ((Shadow)textOutline).effectColor.g, ((Shadow)textOutline).effectColor.b, num);
			}
			Transform transform = ((Component)this).transform;
			transform.localPosition += velocity * TimeHandler.deltaTime;
			isUnstacking = false;
			foreach (GameObject numberObject in PlayerDamageTracker.numberObjects)
			{
				if ((Object)(object)numberObject == (Object)null)
				{
					continue;
				}
				DamageNumberMono component = numberObject.GetComponent<DamageNumberMono>();
				if (!((Object)(object)component == (Object)null) && !((Object)(object)numberObject == (Object)(object)((Component)this).gameObject) && numberObject.transform.position.y <= ((Component)this).transform.position.y)
				{
					float num2 = Mathf.Abs(numberObject.transform.position.x - ((Component)this).transform.position.x);
					float num3 = Mathf.Abs(numberObject.transform.position.y - ((Component)this).transform.position.y);
					if (num3 < textSize.y / 2f && num2 < textSize.x / 2f)
					{
						isUnstacking = true;
						break;
					}
				}
			}
			if (isUnstacking)
			{
				Transform transform2 = ((Component)this).transform;
				transform2.localPosition += velocity * TimeHandler.deltaTime * PlayerDamageTracker.textUnstackingSpeedMul;
			}
			timer += TimeHandler.deltaTime;
			realTImer += Time.deltaTime;
		}

		private void OnDestroy()
		{
			PlayerDamageTracker.numberObjects.Remove(((Component)this).gameObject);
		}

		private void UpdateText()
		{
			//IL_0008: 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)
			((Graphic)text).color = textColor;
			((Shadow)textOutline).effectColor = outlineColor;
			text.text = display;
			text.fontSize = Mathf.CeilToInt(fontSize);
			textSize.y = fontSize + PlayerDamageTracker.textPadding * 2f;
			textSize.x = fontSize * PlayerDamageTracker.fontWidthToHeightRatio * (float)display.Length + PlayerDamageTracker.textPadding * 2f;
		}
	}
}