Decompiled source of ExtraDayStats v1.1.0

BepInEx/plugins/ExtraDayStats/ExtraDayStats.dll

Decompiled a day 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.Versioning;
using BepInEx;
using BepInEx.Logging;
using Extensions;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExtraDayStats")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+faa4a8108cf95328a58b1069690ad0b7aa00072e")]
[assembly: AssemblyProduct("ExtraDayStats")]
[assembly: AssemblyTitle("ExtraDayStats")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExtraDayStats
{
	internal static class DayStatsCalculator
	{
		public static List<PlayerDaySummary> CalculateAllPlayersStats(PayoutTracker tracker, List<PlayerProfile> players)
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerDaySummary> list = new List<PlayerDaySummary>();
			foreach (PlayerProfile player in players)
			{
				List<PayoutRecord> playerRecords = tracker.GetPlayerRecords(player);
				PlayerDaySummary playerDaySummary = new PlayerDaySummary
				{
					playerName = player.playerName
				};
				foreach (PayoutRecord item in playerRecords)
				{
					if (item.bet == 0L && item.payout == 0L)
					{
						continue;
					}
					playerDaySummary.totalBet += item.bet;
					playerDaySummary.totalPayout += item.payout;
					playerDaySummary.totalGames++;
					if (item.isWin)
					{
						playerDaySummary.wins++;
					}
					if (item.isLoss)
					{
						playerDaySummary.losses++;
					}
					if (!item.isWin && !item.isLoss)
					{
						playerDaySummary.pushes++;
					}
					if (!playerDaySummary.byGameType.ContainsKey(item.gameType))
					{
						playerDaySummary.byGameType[item.gameType] = new GameTypeStats();
					}
					GameTypeStats gameTypeStats = playerDaySummary.byGameType[item.gameType];
					gameTypeStats.totalBet += item.bet;
					gameTypeStats.totalPayout += item.payout;
					gameTypeStats.gameCount++;
					if (item.isWin)
					{
						gameTypeStats.winCount++;
						long num = item.payout - item.bet;
						if (num > gameTypeStats.biggestWin)
						{
							gameTypeStats.biggestWin = num;
						}
					}
				}
				list.Add(playerDaySummary);
			}
			return list.OrderByDescending((PlayerDaySummary s) => s.NetProfit).ToList();
		}
	}
	internal static class FakeTestData
	{
		internal static List<PlayerDaySummary> Get()
		{
			return new List<PlayerDaySummary>(4)
			{
				new PlayerDaySummary
				{
					playerName = "BigMoneyMike",
					totalGames = 34,
					wins = 21,
					losses = 11,
					pushes = 2,
					totalBet = 48000L,
					totalPayout = 61500L,
					byGameType = new Dictionary<CasinoGameType, GameTypeStats>
					{
						[(CasinoGameType)0] = new GameTypeStats
						{
							gameCount = 18,
							winCount = 12,
							totalBet = 24000L,
							totalPayout = 32000L,
							biggestWin = 5000L
						},
						[(CasinoGameType)11] = new GameTypeStats
						{
							gameCount = 10,
							winCount = 6,
							totalBet = 15000L,
							totalPayout = 20500L,
							biggestWin = 8800L
						},
						[(CasinoGameType)12] = new GameTypeStats
						{
							gameCount = 6,
							winCount = 3,
							totalBet = 9000L,
							totalPayout = 9000L,
							biggestWin = 2200L
						}
					}
				},
				new PlayerDaySummary
				{
					playerName = "LongNamedPerson",
					totalGames = 22,
					wins = 9,
					losses = 13,
					pushes = 0,
					totalBet = 31000L,
					totalPayout = 24000L,
					byGameType = new Dictionary<CasinoGameType, GameTypeStats>
					{
						[(CasinoGameType)1] = new GameTypeStats
						{
							gameCount = 12,
							winCount = 4,
							totalBet = 18000L,
							totalPayout = 12000L,
							biggestWin = 3100L
						},
						[(CasinoGameType)10] = new GameTypeStats
						{
							gameCount = 7,
							winCount = 3,
							totalBet = 9000L,
							totalPayout = 8500L,
							biggestWin = 1800L
						},
						[(CasinoGameType)15] = new GameTypeStats
						{
							gameCount = 3,
							winCount = 2,
							totalBet = 4000L,
							totalPayout = 3500L,
							biggestWin = 1500L
						}
					}
				},
				new PlayerDaySummary
				{
					playerName = "Jess",
					totalGames = 19,
					wins = 10,
					losses = 9,
					pushes = 0,
					totalBet = 22000L,
					totalPayout = 22500L,
					byGameType = new Dictionary<CasinoGameType, GameTypeStats>
					{
						[(CasinoGameType)0] = new GameTypeStats
						{
							gameCount = 8,
							winCount = 5,
							totalBet = 10000L,
							totalPayout = 11000L,
							biggestWin = 2000L
						},
						[(CasinoGameType)14] = new GameTypeStats
						{
							gameCount = 7,
							winCount = 3,
							totalBet = 8000L,
							totalPayout = 7500L,
							biggestWin = 2500L
						},
						[(CasinoGameType)9] = new GameTypeStats
						{
							gameCount = 4,
							winCount = 2,
							totalBet = 4000L,
							totalPayout = 4000L,
							biggestWin = 900L
						}
					}
				},
				new PlayerDaySummary
				{
					playerName = "Dan",
					totalGames = 11,
					wins = 2,
					losses = 9,
					pushes = 0,
					totalBet = 15000L,
					totalPayout = 7000L,
					byGameType = new Dictionary<CasinoGameType, GameTypeStats>
					{
						[(CasinoGameType)12] = new GameTypeStats
						{
							gameCount = 6,
							winCount = 1,
							totalBet = 9000L,
							totalPayout = 3500L,
							biggestWin = 1200L
						},
						[(CasinoGameType)11] = new GameTypeStats
						{
							gameCount = 5,
							winCount = 1,
							totalBet = 6000L,
							totalPayout = 3500L,
							biggestWin = 2000L
						}
					}
				}
			};
		}
	}
	internal static class GameTypePanel
	{
		private static readonly float[] ColX = new float[4] { -95f, -15f, 40f, 150f };

		private static readonly float[] ColW = new float[4] { 95f, 45f, 60f, 185f };

		internal static GameObject Build(Transform parent, List<PlayerDaySummary> stats, DaySummaryUI instance)
		{
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: 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_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: 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_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: 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_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			TMP_FontAsset font = PanelHelpers.GetFont(instance);
			Dictionary<CasinoGameType, (int, long, string, long)> dictionary = new Dictionary<CasinoGameType, (int, long, string, long)>();
			foreach (PlayerDaySummary stat in stats)
			{
				foreach (KeyValuePair<CasinoGameType, GameTypeStats> item in stat.byGameType)
				{
					if (!dictionary.ContainsKey(item.Key))
					{
						dictionary[item.Key] = (0, 0L, stat.playerName, long.MinValue);
					}
					(int, long, string, long) tuple = dictionary[item.Key];
					bool flag = item.Value.biggestWin > tuple.Item4;
					dictionary[item.Key] = (tuple.Item1 + item.Value.gameCount, tuple.Item2 + item.Value.NetProfit, flag ? stat.playerName : tuple.Item3, flag ? item.Value.biggestWin : tuple.Item4);
				}
			}
			List<KeyValuePair<CasinoGameType, (int, long, string, long)>> list = dictionary.OrderByDescending<KeyValuePair<CasinoGameType, (int, long, string, long)>, int>((KeyValuePair<CasinoGameType, (int plays, long groupNet, string biggestWinPlayer, long biggestWin)> kvp) => kvp.Value.plays).ToList();
			GameObject val = new GameObject("GWYF_GameTypePanel");
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0.08f, 0.83f);
			obj.anchorMax = new Vector2(0.08f, 0.83f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = Vector2.zero;
			obj.sizeDelta = new Vector2(530f, (float)list.Count * 26f + 40f);
			val.AddComponent<CanvasGroup>().alpha = 0f;
			val.transform.SetAsLastSibling();
			float num = -20f;
			PanelHelpers.AddRow(val.transform, num, new string[4] { "GAME", "# HANDS", "GROUP NET", "BIGGEST WIN" }, (Color[])(object)new Color[4]
			{
				Color.gray,
				Color.gray,
				Color.gray,
				Color.gray
			}, 11, font, ColX, ColW);
			for (int i = 0; i < list.Count; i++)
			{
				CasinoGameType key = list[i].Key;
				(int, long, string, long) value = list[i].Value;
				Color val2 = (Color)((value.Item2 > 0) ? new Color(0.4f, 1f, 0.4f) : ((value.Item2 < 0) ? new Color(1f, 0.4f, 0.4f) : Color.white));
				Color val3 = (Color)((value.Item4 > 0) ? new Color(0.4f, 1f, 0.4f) : ((value.Item4 < 0) ? new Color(1f, 0.4f, 0.4f) : Color.white));
				string text = ((value.Item3.Length > 12) ? (value.Item3.Substring(0, 11) + "…") : value.Item3);
				string text2 = ((value.Item4 == long.MinValue) ? "-" : (text + " (" + MoneyFormatter.FormatWithDollar(value.Item4) + ")"));
				PanelHelpers.AddRow(val.transform, num - 30f - (float)i * 26f, new string[4]
				{
					((object)(CasinoGameType)(ref key)).ToString(),
					value.Item1.ToString(),
					MoneyFormatter.FormatWithDollar(value.Item2),
					text2
				}, (Color[])(object)new Color[4]
				{
					Color.white,
					Color.white,
					val2,
					val3
				}, 15, font, ColX, ColW);
			}
			Canvas.ForceUpdateCanvases();
			return val;
		}
	}
	[Serializable]
	public class GameTypeStats
	{
		public long totalBet { get; set; }

		public long totalPayout { get; set; }

		public int gameCount { get; set; }

		public int winCount { get; set; }

		public long biggestWin { get; set; }

		public long NetProfit => totalPayout - totalBet;

		public float WinPercentage
		{
			get
			{
				if (gameCount <= 0)
				{
					return 0f;
				}
				return (float)winCount * 100f / (float)gameCount;
			}
		}
	}
	internal static class PanelHelpers
	{
		private static TMP_FontAsset? _font;

		internal static TMP_FontAsset? GetFont(DaySummaryUI instance)
		{
			if ((Object)(object)_font != (Object)null)
			{
				return _font;
			}
			object? obj = typeof(DaySummaryUI).GetField("titleText", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(instance);
			object? obj2 = ((obj is TextMeshProUGUI) ? obj : null);
			_font = ((obj2 != null) ? ((TMP_Text)obj2).font : null);
			if ((Object)(object)_font == (Object)null)
			{
				TextMeshProUGUI val = Object.FindFirstObjectByType<TextMeshProUGUI>();
				_font = ((val != null) ? ((TMP_Text)val).font : null);
				if ((Object)(object)_font != (Object)null)
				{
					Plugin.Log.LogInfo((object)("[CustomStats] Font borrowed from '" + ((Object)((Component)val).gameObject).name + "'"));
				}
			}
			if ((Object)(object)_font == (Object)null)
			{
				Plugin.Log.LogWarning((object)"[CustomStats] Could not find any TMP font — text will be invisible");
			}
			else
			{
				Plugin.Log.LogInfo((object)("[CustomStats] Font resolved: " + ((Object)_font).name));
			}
			return _font;
		}

		internal static void AddRow(Transform parent, float y, string[] vals, Color[] colors, int fontSize, TMP_FontAsset? font, float[] colX, float[] colW)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < vals.Length; i++)
			{
				GameObject val = new GameObject($"Cell_{y}_{i}");
				val.transform.SetParent(parent, false);
				TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
				if ((Object)(object)font != (Object)null)
				{
					((TMP_Text)val2).font = font;
				}
				((TMP_Text)val2).text = vals[i];
				((TMP_Text)val2).fontSize = fontSize;
				((Graphic)val2).color = colors[i];
				((TMP_Text)val2).alignment = (TextAlignmentOptions)((i == 0) ? 513 : 514);
				((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
				((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
				RectTransform component = val.GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0.5f, 1f);
				component.anchorMax = new Vector2(0.5f, 1f);
				component.pivot = new Vector2(0.5f, 1f);
				component.anchoredPosition = new Vector2(colX[i], y);
				component.sizeDelta = new Vector2(colW[i], 28f);
			}
		}
	}
	[Serializable]
	public class PlayerDaySummary
	{
		public string playerName { get; set; }

		public long totalBet { get; set; }

		public long totalPayout { get; set; }

		public int totalGames { get; set; }

		public int wins { get; set; }

		public int losses { get; set; }

		public int pushes { get; set; }

		public Dictionary<CasinoGameType, GameTypeStats> byGameType { get; set; }

		public long NetProfit => totalPayout - totalBet;

		public float WinPercentage
		{
			get
			{
				int num = wins + losses;
				if (num <= 0)
				{
					return 0f;
				}
				return (float)wins * 100f / (float)num;
			}
		}

		public PlayerDaySummary()
		{
			byGameType = new Dictionary<CasinoGameType, GameTypeStats>();
		}
	}
	internal static class PlayerStatsPanel
	{
		private static readonly float[] ColX = new float[5] { -88f, 5f, 55f, 113f, 183f };

		private static readonly float[] ColW = new float[5] { 110f, 42f, 48f, 60f, 72f };

		internal static GameObject Build(Transform parent, List<PlayerDaySummary> stats, DaySummaryUI instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			TMP_FontAsset font = PanelHelpers.GetFont(instance);
			GameObject val = new GameObject("GWYF_StatsPanel");
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = new Vector2(0.08f, 0.58f);
			val2.anchorMax = new Vector2(0.08f, 0.58f);
			val2.pivot = new Vector2(0.5f, 1f);
			val2.anchoredPosition = Vector2.zero;
			val2.sizeDelta = new Vector2(380f, (float)stats.Count * 36f + 40f);
			Plugin.Log.LogInfo((object)$"[CustomStats] PlayerStatsPanel size={val2.sizeDelta}");
			val.AddComponent<CanvasGroup>().alpha = 0f;
			val.transform.SetAsLastSibling();
			float num = -20f;
			PanelHelpers.AddRow(val.transform, num, new string[5] { "PLAYER", "# BETS", "WIN %", "NET", "TOTAL BET" }, (Color[])(object)new Color[5]
			{
				Color.gray,
				Color.gray,
				Color.gray,
				Color.gray,
				Color.gray
			}, 11, font, ColX, ColW);
			for (int i = 0; i < stats.Count; i++)
			{
				PlayerDaySummary playerDaySummary = stats[i];
				string text = MoneyFormatter.FormatWithDollar(Math.Abs(playerDaySummary.NetProfit));
				string text2 = ((playerDaySummary.NetProfit > 0) ? ("+" + text) : ((playerDaySummary.NetProfit < 0) ? ("-" + text) : "$0"));
				Color val3 = (Color)((playerDaySummary.NetProfit > 0) ? new Color(0.4f, 1f, 0.4f) : ((playerDaySummary.NetProfit < 0) ? new Color(1f, 0.4f, 0.4f) : Color.white));
				Color val4 = (Color)((playerDaySummary.WinPercentage > 50f) ? new Color(0.4f, 1f, 0.4f) : ((playerDaySummary.WinPercentage < 50f) ? new Color(1f, 0.4f, 0.4f) : Color.white));
				string text3 = ((playerDaySummary.playerName.Length > 12) ? (playerDaySummary.playerName.Substring(0, 11) + "…") : playerDaySummary.playerName);
				PanelHelpers.AddRow(val.transform, num - 36f - (float)i * 34f, new string[5]
				{
					text3,
					playerDaySummary.totalGames.ToString(),
					$"{playerDaySummary.WinPercentage:F1}%",
					text2,
					MoneyFormatter.FormatWithDollar(playerDaySummary.totalBet)
				}, (Color[])(object)new Color[5]
				{
					Color.white,
					Color.white,
					val4,
					val3,
					Color.white
				}, 15, font, ColX, ColW);
			}
			Canvas.ForceUpdateCanvases();
			return val;
		}
	}
	[BepInPlugin("com.npete.extradaystats", "ExtraDayStats", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private readonly Harmony _harmony = new Harmony("com.npete.extradaystats");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony.PatchAll();
			Log.LogInfo((object)"ExtraDayStats v0.1.0 loaded.");
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.npete.extradaystats";

		public const string PLUGIN_NAME = "ExtraDayStats";

		public const string PLUGIN_VERSION = "0.1.0";
	}
	[HarmonyPatch(typeof(DaySummaryUI), "Show")]
	internal static class Patch_DaySummaryUI_Show
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public CanvasGroup moneyGroup;

			internal bool <ShowStatsAfterGraph>b__0()
			{
				if ((Object)(object)moneyGroup != (Object)null)
				{
					return moneyGroup.alpha >= 0.9f;
				}
				return false;
			}

			internal bool <ShowStatsAfterGraph>b__4()
			{
				if (!((Object)(object)moneyGroup == (Object)null))
				{
					return moneyGroup.alpha < 0.1f;
				}
				return true;
			}
		}

		[CompilerGenerated]
		private sealed class <DebugShowStats>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DaySummaryUI instance;

			private CanvasGroup <cg>5__2;

			private float <elapsed>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DebugShowStats>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cg>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					PayoutTracker val = NetworkSingleton<PayoutTracker>.Instance;
					List<PlayerProfile> list = (from p in Object.FindObjectsByType<PlayerProfile>((FindObjectsSortMode)0)
						where (Object)(object)p != (Object)null && p.hasSynced && !string.IsNullOrEmpty(p.playerName)
						select p).ToList();
					List<PlayerDaySummary> list2;
					if ((Object)(object)val != (Object)null && list.Count > 0)
					{
						list2 = DayStatsCalculator.CalculateAllPlayersStats(val, list);
					}
					else
					{
						Plugin.Log.LogInfo((object)"[Debug] No PayoutTracker data — using fake stats for layout test");
						list2 = new List<PlayerDaySummary>();
					}
					Plugin.Log.LogInfo((object)$"[Debug] Showing stats for {list2.Count} players");
					GameObject val2 = PlayerStatsPanel.Build(((Component)instance).transform, list2, instance);
					<cg>5__2 = val2.GetComponent<CanvasGroup>();
					<elapsed>5__3 = 0f;
					break;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				if (<elapsed>5__3 < 0.5f)
				{
					<elapsed>5__3 += Time.deltaTime;
					<cg>5__2.alpha = Mathf.Clamp01(<elapsed>5__3 / 0.5f);
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<cg>5__2.alpha = 1f;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <ShowStatsAfterGraph>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public DaySummaryUI instance;

			private <>c__DisplayClass2_0 <>8__1;

			private GameObject <panel>5__2;

			private GameObject <gamePanel>5__3;

			private CanvasGroup <cg>5__4;

			private CanvasGroup <cgGame>5__5;

			private float <elapsed>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShowStatsAfterGraph>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<panel>5__2 = null;
				<gamePanel>5__3 = null;
				<cg>5__4 = null;
				<cgGame>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Expected O, but got Unknown
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e4: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass2_0();
					CanvasGroup[] field = GetField<CanvasGroup[]>(instance, "canvasGroups");
					if (field == null || field.Length < 4)
					{
						Plugin.Log.LogWarning((object)"[CustomStats] canvasGroups missing or too short");
						return false;
					}
					<>8__1.moneyGroup = field[3];
					Plugin.Log.LogInfo((object)"[CustomStats] Waiting for money group to fade in...");
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.moneyGroup != (Object)null && <>8__1.moneyGroup.alpha >= 0.9f));
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					Plugin.Log.LogInfo((object)"[CustomStats] Money group visible — building stats panel");
					PayoutTracker val = NetworkSingleton<PayoutTracker>.Instance;
					List<PlayerProfile> list = (from p in Object.FindObjectsByType<PlayerProfile>((FindObjectsSortMode)0)
						where (Object)(object)p != (Object)null && p.hasSynced && !string.IsNullOrEmpty(p.playerName)
						select p).ToList();
					List<PlayerDaySummary> list2 = ((!((Object)(object)val != (Object)null) || list.Count <= 0) ? list.Select((PlayerProfile p) => new PlayerDaySummary
					{
						playerName = p.playerName
					}).ToList() : DayStatsCalculator.CalculateAllPlayersStats(val, list));
					if (list2.Count == 0 || list2.All((PlayerDaySummary s) => s.totalGames == 0))
					{
						Plugin.Log.LogInfo((object)"[CustomStats] No game data — using fake stats for layout test");
					}
					Plugin.Log.LogInfo((object)$"[CustomStats] {list2.Count} player(s) to display");
					<panel>5__2 = PlayerStatsPanel.Build(((Component)instance).transform, list2, instance);
					<gamePanel>5__3 = GameTypePanel.Build(((Component)instance).transform, list2, instance);
					Plugin.Log.LogInfo((object)"[CustomStats] Panels built");
					<cg>5__4 = <panel>5__2.GetComponent<CanvasGroup>();
					<cgGame>5__5 = <gamePanel>5__3.GetComponent<CanvasGroup>();
					<elapsed>5__6 = 0f;
					goto IL_027f;
				}
				case 2:
					<>1__state = -1;
					goto IL_027f;
				case 3:
					{
						<>1__state = -1;
						if ((Object)(object)<panel>5__2 != (Object)null)
						{
							Object.Destroy((Object)(object)<panel>5__2);
						}
						if ((Object)(object)<gamePanel>5__3 != (Object)null)
						{
							Object.Destroy((Object)(object)<gamePanel>5__3);
						}
						return false;
					}
					IL_027f:
					if (<elapsed>5__6 < 0.5f)
					{
						<elapsed>5__6 += Time.deltaTime;
						float alpha = Mathf.Clamp01(<elapsed>5__6 / 0.5f);
						if ((Object)(object)<cg>5__4 != (Object)null)
						{
							<cg>5__4.alpha = alpha;
						}
						if ((Object)(object)<cgGame>5__5 != (Object)null)
						{
							<cgGame>5__5.alpha = alpha;
						}
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					if ((Object)(object)<cg>5__4 != (Object)null)
					{
						<cg>5__4.alpha = 1f;
					}
					if ((Object)(object)<cgGame>5__5 != (Object)null)
					{
						<cgGame>5__5.alpha = 1f;
					}
					<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.moneyGroup == (Object)null || <>8__1.moneyGroup.alpha < 0.1f));
					<>1__state = 3;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static void Postfix(DaySummaryUI __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(ShowStatsAfterGraph(__instance));
		}

		[IteratorStateMachine(typeof(<DebugShowStats>d__1))]
		public static IEnumerator DebugShowStats(DaySummaryUI instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DebugShowStats>d__1(0)
			{
				instance = instance
			};
		}

		[IteratorStateMachine(typeof(<ShowStatsAfterGraph>d__2))]
		private static IEnumerator ShowStatsAfterGraph(DaySummaryUI instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShowStatsAfterGraph>d__2(0)
			{
				instance = instance
			};
		}

		private static T GetField<T>(object obj, string name)
		{
			FieldInfo field = typeof(DaySummaryUI).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null)
			{
				return (T)field.GetValue(obj);
			}
			Plugin.Log.LogWarning((object)("[CustomStats] Field '" + name + "' not found"));
			return default(T);
		}
	}
}