From e8ba5ec57469e3624ef2c08b9e5775625c6084dd Mon Sep 17 00:00:00 2001 From: Michael Bond Date: Tue, 17 Dec 2024 18:57:19 -0500 Subject: [PATCH] Add EXP to next level --- .../Components/EditForms/Tabs/MainTab.razor | 23 +++++++++++++++---- .../EditForms/Tabs/MainTab.razor.cs | 13 +++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor b/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor index f3e65c8a..4ea9d983 100644 --- a/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor +++ b/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor @@ -92,17 +92,30 @@ } + + - + + + @{ + var levelProgress = Experience.GetEXPToLevelUpPercentage(Pokemon.CurrentLevel, Pokemon.EXP, Pokemon.PersonalInfo.EXPGrowth); + + } @if (saveGeneration >= 3) { diff --git a/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor.cs b/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor.cs index 640572ba..27b53680 100644 --- a/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor.cs +++ b/Pkmds.Web/Components/EditForms/Tabs/MainTab.razor.cs @@ -124,4 +124,17 @@ private void SetPokemonPid(string newPidHex) } private readonly PatternMask hexMask = new("########") { MaskChars = [new('#', "[0-9a-fA-F]")] }; + + // ReSharper disable once InconsistentNaming + private double GetEXPToLevelUp() + { + if (Pokemon is not { CurrentLevel: var level and < 100, EXP: var exp, PersonalInfo.EXPGrowth: var growth }) + { + return 0; + } + + var table = Experience.GetTable(growth); + var next = Experience.GetEXP(++level, table); + return next - exp; + } }