(
title,
parameters: dialogParameters,
- options: new DialogOptions
- {
- CloseOnEscapeKey = true,
- BackdropClick = false,
- });
+ options: new() { CloseOnEscapeKey = true, BackdropClick = false, });
var result = await dialog.Result;
if (result is { Data: IBrowserFile selectedFile })
{
- var browserLoadPokemonFile = selectedFile;
- await LoadMysteryGiftFile(browserLoadPokemonFile, title);
+ await LoadMysteryGiftFile(selectedFile, title);
}
}
@@ -174,12 +153,6 @@ private async Task LoadPokemonFile(IBrowserFile browserLoadPokemonFile, string t
return;
}
- if (browserLoadPokemonFile is null)
- {
- await DialogService.ShowMessageBox("No file selected", "Please select a file to load.");
- return;
- }
-
AppState.ShowProgressIndicator = true;
try
@@ -247,12 +220,6 @@ private async Task LoadMysteryGiftFile(IBrowserFile browserLoadMysteryGiftFile,
return;
}
- if (browserLoadMysteryGiftFile is null)
- {
- await DialogService.ShowMessageBox("No file selected", "Please select a file to load.");
- return;
- }
-
AppState.ShowProgressIndicator = true;
try
@@ -262,7 +229,8 @@ private async Task LoadMysteryGiftFile(IBrowserFile browserLoadMysteryGiftFile,
await fileStream.CopyToAsync(memoryStream);
var data = memoryStream.ToArray();
- if (!FileUtil.TryGetMysteryGift(data, out var mysteryGift, Path.GetExtension(browserLoadMysteryGiftFile.Name)))
+ if (!FileUtil.TryGetMysteryGift(data, out var mysteryGift,
+ Path.GetExtension(browserLoadMysteryGiftFile.Name)))
{
await DialogService.ShowMessageBox("Error", "The file is not a supported Mystery Gift file.");
return;
@@ -349,7 +317,8 @@ private async Task WriteFile(byte[] data, string fileName, string fileTypeExtens
try
{
// Ensure that the FilePicker API is invoked correctly within a user gesture context
- await JSRuntime.InvokeVoidAsync("showFilePickerAndWrite", fileName, data, fileTypeExtension, fileTypeDescription);
+ await JSRuntime.InvokeVoidAsync("showFilePickerAndWrite", fileName, data, fileTypeExtension,
+ fileTypeDescription);
}
catch (JSException ex)
{
diff --git a/Pkmds.Web/Components/Layout/MainLayout.razor.css b/Pkmds.Web/Components/Layout/MainLayout.razor.css
index df8c10ff..0d26cfc2 100644
--- a/Pkmds.Web/Components/Layout/MainLayout.razor.css
+++ b/Pkmds.Web/Components/Layout/MainLayout.razor.css
@@ -10,9 +10,9 @@
z-index: 1000;
}
- #blazor-error-ui .dismiss {
- cursor: pointer;
- position: absolute;
- right: 0.75rem;
- top: 0.5rem;
- }
+#blazor-error-ui .dismiss {
+ cursor: pointer;
+ position: absolute;
+ right: 0.75rem;
+ top: 0.5rem;
+}
diff --git a/Pkmds.Web/Components/LetsGoBoxComponent.razor b/Pkmds.Web/Components/LetsGoBoxComponent.razor
index 38d449d8..dc800e4c 100644
--- a/Pkmds.Web/Components/LetsGoBoxComponent.razor
+++ b/Pkmds.Web/Components/LetsGoBoxComponent.razor
@@ -1,6 +1,6 @@
@inherits BasePkmdsComponent
-@if (AppState.SaveFile is SAV7b { } saveFile)
+@if (AppState.SaveFile is SAV7b)
{
diff --git a/Pkmds.Web/Components/LetsGoBoxComponent.razor.cs b/Pkmds.Web/Components/LetsGoBoxComponent.razor.cs
index 6dfc7857..d322fb5b 100644
--- a/Pkmds.Web/Components/LetsGoBoxComponent.razor.cs
+++ b/Pkmds.Web/Components/LetsGoBoxComponent.razor.cs
@@ -2,6 +2,7 @@ namespace Pkmds.Web.Components;
public partial class LetsGoBoxComponent : IDisposable
{
+ // ReSharper disable once UnusedAutoPropertyAccessor.Global
public BoxEdit? BoxEdit { get; set; }
protected override void OnInitialized()
@@ -33,7 +34,7 @@ private void ReloadBox()
return;
}
- BoxEdit = new BoxEdit(AppState.SaveFile);
+ BoxEdit = new(AppState.SaveFile);
RefreshService.Refresh();
}
}
diff --git a/Pkmds.Web/Components/LetsGoBoxGrid.razor b/Pkmds.Web/Components/LetsGoBoxGrid.razor
index fa2301af..4b95da0c 100644
--- a/Pkmds.Web/Components/LetsGoBoxGrid.razor
+++ b/Pkmds.Web/Components/LetsGoBoxGrid.razor
@@ -1,6 +1,6 @@
@inherits BasePkmdsComponent
-@if (AppState.SaveFile is SAV7b { } saveFile)
+@if (AppState.SaveFile is SAV7b saveFile)
{
Note: The box grid is scrollable.
diff --git a/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor b/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor
index 6eec0855..7ce1695c 100644
--- a/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor
+++ b/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor
@@ -43,9 +43,4 @@
}
break;
- case SAV1Stadium { Context: EntityContext.Gen1 }:
- case SAV1StadiumJ { Context: EntityContext.Gen1 }:
- case SAV2Stadium { Context: EntityContext.Gen2 }:
- default:
- break;
}
diff --git a/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor.cs b/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor.cs
index 4b038691..cac9ac6c 100644
--- a/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor.cs
+++ b/Pkmds.Web/Components/MainTabPages/BadgesComponent.razor.cs
@@ -1,8 +1,10 @@
+using System.Diagnostics.CodeAnalysis;
+
namespace Pkmds.Web.Components.MainTabPages;
public partial class BadgesComponent : IDisposable
{
- private const int badgesFlagStart = 124;
+ private const int BadgesFlagStart = 124;
protected override void OnInitialized() =>
RefreshService.OnAppStateChanged += StateHasChanged;
@@ -10,6 +12,7 @@ protected override void OnInitialized() =>
public void Dispose() =>
RefreshService.OnAppStateChanged -= StateHasChanged;
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
private List GetSaveFileBadgesValue()
{
List badgeFlags = [];
@@ -23,8 +26,9 @@ private List GetSaveFileBadgesValue()
{
for (var i = 0; i < 8; i++)
{
- badgeFlags.Add(sav8bs.FlagWork.GetSystemFlag(badgesFlagStart + i));
+ badgeFlags.Add(sav8bs.FlagWork.GetSystemFlag(BadgesFlagStart + i));
}
+
return badgeFlags;
}
@@ -74,7 +78,7 @@ private List GetSaveFileBadgesValue()
badgeFlagInt = sav6ao.Badges;
break;
- case EntityContext.Gen7b when saveFile is SAV7b sav7b:
+ case EntityContext.Gen7b when saveFile is SAV7b:
// TODO: Figure out why this isn't available
//badgeFlagInt = sav7b.Badges;
break;
@@ -83,7 +87,7 @@ private List GetSaveFileBadgesValue()
badgeFlagInt = sav8swsh.Badges;
break;
- case EntityContext.Gen9 when saveFile is SAV9SV sav9sv:
+ case EntityContext.Gen9 when saveFile is SAV9SV:
// TODO: Figure out why this isn't available
//badgeFlagInt = sav9sv.Badges;
break;
@@ -97,6 +101,7 @@ private List GetSaveFileBadgesValue()
return badgeFlags;
}
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
private void OnBadgeToggle(int badgeIndex)
{
if (AppState.SaveFile is not { } saveFile)
@@ -146,7 +151,7 @@ private void OnBadgeToggle(int badgeIndex)
sav6ao.Badges = ToggleBadge(sav6ao.Badges, badgeIndex);
break;
- case EntityContext.Gen7b when saveFile is SAV7b sav7b:
+ case EntityContext.Gen7b when saveFile is SAV7b:
// TODO: Figure out why this isn't available
//sav7b.Badges = ToggleBadge(sav7b.Badges, badgeIndex);
break;
@@ -156,16 +161,17 @@ private void OnBadgeToggle(int badgeIndex)
break;
case EntityContext.Gen8b when saveFile is SAV8BS sav8bs:
- sav8bs.FlagWork.SetSystemFlag(badgesFlagStart + badgeIndex, !sav8bs.FlagWork.GetSystemFlag(badgesFlagStart + badgeIndex));
+ sav8bs.FlagWork.SetSystemFlag(BadgesFlagStart + badgeIndex,
+ !sav8bs.FlagWork.GetSystemFlag(BadgesFlagStart + badgeIndex));
break;
- case EntityContext.Gen9 when saveFile is SAV9SV sav9sv:
+ case EntityContext.Gen9 when saveFile is SAV9SV:
// TODO: Figure out why this isn't available
//sav9sv.Badges = ToggleBadge(sav9sv.Badges, badgeIndex);
break;
- };
+ }
static int ToggleBadge(int badges, int badgeIndex) =>
- badges ^= (byte)(1 << badgeIndex);
+ badges ^ (byte)(1 << badgeIndex);
}
}
diff --git a/Pkmds.Web/Components/MainTabPages/BagTab.razor b/Pkmds.Web/Components/MainTabPages/BagTab.razor
index c8135455..5d9a9c1a 100644
--- a/Pkmds.Web/Components/MainTabPages/BagTab.razor
+++ b/Pkmds.Web/Components/MainTabPages/BagTab.razor
@@ -16,7 +16,7 @@
+ title="@tabText"/>
@if (string.Equals(PouchTabs?.ActivePanel?.ID?.ToString(), pouch.Type.ToString()))
{
@GetPouchName(pouch)
@@ -75,7 +75,7 @@
Value="@GetItem(context)"
ValueChanged="@(newItem => SetItem(context, newItem))"
SearchFunc="@((string searchString, CancellationToken _) => SearchItemNames(pouch, searchString))"
- ToStringFunc="@(item => { return ItemList[context.Item.Index]; })">
+ ToStringFunc="@(_ => ItemList[context.Item.Index])">
@if (item.Value != 0)
@@ -87,7 +87,8 @@
title="@item.Text">
+ title="@item.Text"
+ alt="@item.Text">
}
@@ -106,7 +107,8 @@
title="@itemText">
+ title="@itemText"
+ alt="@itemText">
}
@@ -118,7 +120,7 @@
+ @bind-Value="@context.Item.Count"/>
@if (HasFreeSpace)
@@ -129,7 +131,7 @@
{
+ ValueChanged="@((bool value) => freeSpaceItem.IsFreeSpace = value)"/>
}
@@ -142,7 +144,7 @@
{
+ @bind-Value="@freeSpaceIndexItem.FreeSpaceIndex"/>
}
@@ -155,7 +157,7 @@
{
+ ValueChanged="@((bool value) => favoriteItem.IsFavorite = value)"/>
}
@@ -168,7 +170,7 @@
{
+ ValueChanged="@((bool value) => newFlagItem.IsNew = value)"/>
}
@@ -179,7 +181,7 @@
ButtonType="@ButtonType.Button"
Color="@Color.Error"
Variant="@Variant.Filled"
- Icon="@Icons.Material.Filled.Delete" />
+ Icon="@Icons.Material.Filled.Delete"/>
diff --git a/Pkmds.Web/Components/MainTabPages/BagTab.razor.cs b/Pkmds.Web/Components/MainTabPages/BagTab.razor.cs
index b9639c38..bf03c1f2 100644
--- a/Pkmds.Web/Components/MainTabPages/BagTab.razor.cs
+++ b/Pkmds.Web/Components/MainTabPages/BagTab.razor.cs
@@ -2,8 +2,7 @@ namespace Pkmds.Web.Components.MainTabPages;
public partial class BagTab
{
- [Parameter, EditorRequired]
- public IReadOnlyList? Inventory { get; set; }
+ [Parameter, EditorRequired] public IReadOnlyList? Inventory { get; set; }
private MudTabs? PouchTabs { get; set; }
@@ -104,16 +103,23 @@ private void DeleteItem(CellContext context, InventoryPouch pouch
private string[] GetStringsForPouch(ReadOnlySpan items, bool sort = true)
{
- string[] res = new string[items.Length + 1];
- for (int i = 0; i < res.Length - 1; i++)
+ var res = new string[items.Length + 1];
+ for (var i = 0; i < res.Length - 1; i++)
+ {
res[i] = ItemList[items[i]];
+ }
+
res[items.Length] = ItemList[0];
if (sort)
+ {
Array.Sort(res);
+ }
+
return res;
}
- private void SortByName(InventoryPouch pouch) => pouch.SortByName(ItemList, reverse: IsSortedByName = !IsSortedByName);
+ private void SortByName(InventoryPouch pouch) =>
+ pouch.SortByName(ItemList, reverse: IsSortedByName = !IsSortedByName);
private void SortByCount(InventoryPouch pouch) => pouch.SortByCount(reverse: IsSortedByCount = !IsSortedByCount);
@@ -125,6 +131,7 @@ private Task> SearchItemNames(InventoryPouch pouch, strin
return Task.FromResult(ItemList
.Select((name, index) => new ComboItem(name, index))
- .Where(x => itemsToSearch.Contains(x.Text) && x.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase)));
+ .Where(x => itemsToSearch.Contains(x.Text) &&
+ x.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase)));
}
}
diff --git a/Pkmds.Web/Components/MainTabPages/MysteryGiftDatabaseTab.razor b/Pkmds.Web/Components/MainTabPages/MysteryGiftDatabaseTab.razor
index db97aa94..c26dbb26 100644
--- a/Pkmds.Web/Components/MainTabPages/MysteryGiftDatabaseTab.razor
+++ b/Pkmds.Web/Components/MainTabPages/MysteryGiftDatabaseTab.razor
@@ -1,17 +1,17 @@
@inherits BasePkmdsComponent
-@if (AppState is { SaveFile: { } saveFile } && MysteryGiftsList.Count > 0)
+@if (AppState is { SaveFile: not null } && mysteryGiftsList.Count > 0)
{
-
+ ShowNextButton/>
- @foreach (var pageSize in PagesSizes)
+ @foreach (var pageSize in pagesSizes)
{
@pageSize
@@ -22,7 +22,7 @@
- @foreach (var mysteryGift in PaginatedItems)
+ @foreach (var mysteryGift in paginatedItems)
{
MysteryGiftsList = [];
+ private List mysteryGiftsList = [];
- private List PaginatedItems = [];
- private int CurrentPage = 1;
- private int PageSize = 20; // Number of items per page
- private readonly int[] PagesSizes = [10, 20, 50, 100];
+ private List paginatedItems = [];
+ private int currentPage = 1;
+ private int pageSize = 20; // Number of items per page
+ private readonly int[] pagesSizes = [10, 20, 50, 100];
- private int TotalPages => (int)Math.Ceiling((double)MysteryGiftsList.Count / PageSize);
+ private int TotalPages => (int)Math.Ceiling((double)mysteryGiftsList.Count / pageSize);
protected override void OnInitialized()
{
@@ -43,28 +42,29 @@ private void LoadData()
};
}
- MysteryGiftsList = [.. encounterDatabase];
+ mysteryGiftsList = [.. encounterDatabase];
- foreach (var mysteryGift in MysteryGiftsList)
+ foreach (var mysteryGift in mysteryGiftsList)
{
mysteryGift.GiftUsed = false;
}
UpdatePaginatedItems();
- static Func IsPresent(TTable pt) where TTable : IPersonalTable => z => pt.IsPresentInGame(z.Species, z.Form);
+ static Func IsPresent(TTable pt) where TTable : IPersonalTable =>
+ z => pt.IsPresentInGame(z.Species, z.Form);
}
- private void UpdatePaginatedItems() => PaginatedItems = MysteryGiftsList
- .Skip((CurrentPage - 1) * PageSize)
- .Take(PageSize)
- .ToList();
+ private void UpdatePaginatedItems() => paginatedItems = mysteryGiftsList
+ .Skip((currentPage - 1) * pageSize)
+ .Take(pageSize)
+ .ToList();
private void GoToPage() => UpdatePaginatedItems();
private void OnPageSizeChange()
{
- CurrentPage = 1; // Reset to the first page
+ currentPage = 1; // Reset to the first page
UpdatePaginatedItems();
}
@@ -92,12 +92,12 @@ private async Task OnClickCopy(MysteryGift gift)
saveFile.AdaptPKM(pokemon);
AppState.CopiedPokemon = pokemon.Clone();
- Snackbar.Add("The selected Pokémon has been copied.");
+ Snackbar.Add("The selected Pokémon has been copied.");
}
private static string RenderListAsHtml(IReadOnlyList items, string tag = "p")
{
- if (items == null || items.Count == 0)
+ if (items.Count == 0)
{
return string.Empty;
}
@@ -107,6 +107,7 @@ private static string RenderListAsHtml(IReadOnlyList items, string tag =
{
builder.AppendFormat("<{0}>{1}{0}>", tag, WebUtility.HtmlEncode(item));
}
+
return builder.ToString();
}
}
diff --git a/Pkmds.Web/Components/MainTabPages/RecordsTab.razor b/Pkmds.Web/Components/MainTabPages/RecordsTab.razor
index f601b8c2..a1863824 100644
--- a/Pkmds.Web/Components/MainTabPages/RecordsTab.razor
+++ b/Pkmds.Web/Components/MainTabPages/RecordsTab.razor
@@ -18,10 +18,11 @@
+ @bind-Value:set="@SetCurrentRecordValue"/>
@if (HallOfFameIndexSelected)
{
@@ -33,25 +34,25 @@
Min="0"
Max="9999"
@bind-Value="@HallOfFameHours"
- @bind-Value:after="@ChangeFame" />
+ @bind-Value:after="@ChangeFame"/>
+ @bind-Value:after="@ChangeFame"/>
+ @bind-Value:after="@ChangeFame"/>
}
diff --git a/Pkmds.Web/Components/MainTabPages/RecordsTab.razor.cs b/Pkmds.Web/Components/MainTabPages/RecordsTab.razor.cs
index 98dc0111..cd2949c5 100644
--- a/Pkmds.Web/Components/MainTabPages/RecordsTab.razor.cs
+++ b/Pkmds.Web/Components/MainTabPages/RecordsTab.razor.cs
@@ -2,8 +2,7 @@ namespace Pkmds.Web.Components.MainTabPages;
public partial class RecordsTab
{
- [Parameter, EditorRequired]
- public SAV3? SaveFile { get; set; }
+ [Parameter, EditorRequired] public SAV3? SaveFile { get; set; }
private int CurrentRecordIndex { get; set; }
@@ -40,7 +39,7 @@ private void LoadRecords()
return;
}
- Records = new Record3(SaveFile);
+ Records = new(SaveFile);
RecordComboItems = Record3.GetItems(SaveFile);
GetRecord();
}
@@ -86,7 +85,7 @@ private void ChangeFame()
Records.SetRecord(1, (uint)(CurrentRecordValue = GetFameTime()));
}
- public uint GetFameTime()
+ private uint GetFameTime()
{
if (!HallOfFameIndexSelected || Records is null)
{
@@ -100,7 +99,7 @@ public uint GetFameTime()
return (hrs << 16) | ((uint)min << 8) | sec;
}
- public void SetFameTime(uint time)
+ private void SetFameTime(uint time)
{
if (!HallOfFameIndexSelected || Records is null)
{
diff --git a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor
index a5cf8d8b..174195fe 100644
--- a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor
+++ b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor
@@ -2,68 +2,69 @@
@@ -125,7 +126,7 @@
Min="0"
Max="59"
@bind-Value="@saveFile.PlayedMinutes"
- For="@(() => saveFile.PlayedMinutes)" />
+ For="@(() => saveFile.PlayedMinutes)"/>
@@ -135,7 +136,7 @@
Min="0"
Max="59"
@bind-Value="@saveFile.PlayedSeconds"
- For="@(() => saveFile.PlayedSeconds)" />
+ For="@(() => saveFile.PlayedSeconds)"/>
@if (saveGeneration >= 4)
@@ -145,7 +146,7 @@
@bind-Date="@GameStartedDate"
@bind-Date:after="@UpdateGameStarted"
Variant="@Variant.Outlined"
- PickerVariant="@PickerVariant.Inline" />
+ PickerVariant="@PickerVariant.Inline"/>
@@ -154,7 +155,7 @@
@bind-Time:after="@UpdateGameStarted"
TimeFormat="HH:mm:ss"
Variant="@Variant.Outlined"
- PickerVariant="@PickerVariant.Inline" />
+ PickerVariant="@PickerVariant.Inline"/>
@if (saveGeneration <= 7)
@@ -164,7 +165,7 @@
@bind-Date="@HallOfFameDate"
@bind-Date:after="@UpdateHallOfFame"
Variant="@Variant.Outlined"
- PickerVariant="@PickerVariant.Inline" />
+ PickerVariant="@PickerVariant.Inline"/>
@@ -173,7 +174,7 @@
@bind-Time:after="@UpdateHallOfFame"
TimeFormat="HH:mm:ss"
Variant="@Variant.Outlined"
- PickerVariant="@PickerVariant.Inline" />
+ PickerVariant="@PickerVariant.Inline"/>
}
}
@@ -185,17 +186,18 @@
Variant="@Variant.Outlined"
MaxLength="@sav1Rival.MaxStringLengthTrainer"
@bind-Value="@sav1Rival.Rival"
- For="@(() => sav1Rival.Rival)" />
+ For="@(() => sav1Rival.Rival)"/>
+ @* ReSharper disable once CSharpWarnings::CS8603 *@
SetGen1RivalStarter(sav1Rival, species))"
SearchFunc="@SearchPokemonNames"
- ToStringFunc="@(species => species?.Text)" />
+ ToStringFunc="@(species => species?.Text)"/>
}
@@ -206,7 +208,7 @@
Variant="@Variant.Outlined"
MaxLength="@sav2Rival.MaxStringLengthTrainer"
@bind-Value="@sav2Rival.Rival"
- For="@(() => sav2Rival.Rival)" />
+ For="@(() => sav2Rival.Rival)"/>
}
@@ -217,7 +219,7 @@
Variant="@Variant.Outlined"
MaxLength="@sav3FrLgRival.MaxStringLengthTrainer"
@bind-Value="@sav3FrLgRival.RivalName"
- For="@(() => sav3FrLgRival.RivalName)" />
+ For="@(() => sav3FrLgRival.RivalName)"/>
}
@@ -230,7 +232,7 @@
Min="0"
Max="@((uint)saveFile.MaxMoney)"
@bind-Value="@saveFile.Money"
- For="@(() => saveFile.Money)" />
+ For="@(() => saveFile.Money)"/>
@if (saveGeneration <= 4)
@@ -242,7 +244,7 @@
ValueChanged="@SetCoins"
Variant="@Variant.Outlined"
Min="0"
- Max="@((uint)saveFile.MaxCoins)" />
+ Max="@((uint)saveFile.MaxCoins)"/>
}
@@ -255,7 +257,7 @@
Min="0"
Max="9999"
@bind-Value="@sav3.BP"
- For="@(() => sav3.BP)" />
+ For="@(() => sav3.BP)"/>
@@ -265,23 +267,24 @@
Min="0"
Max="@uint.MaxValue"
@bind-Value="@sav3.BPEarned"
- For="@(() => sav3.BPEarned)" />
+ For="@(() => sav3.BPEarned)"/>
}
@if (saveFile is SAV3FRLG sav3FrLgTrainerCard)
{
- @for (int i = 0; i < 6; i++)
+ @for (var i = 0; i < 6; i++)
{
var localIndex = i;
+ @* ReSharper disable once CSharpWarnings::CS8603 *@
{ SetTrainerCardPokemon(sav3FrLgTrainerCard, localIndex, species); })"
SearchFunc="@SearchPokemonNames"
- ToStringFunc="@(species => species?.Text)" />
+ ToStringFunc="@(species => species?.Text)"/>
}
}
@@ -292,25 +295,25 @@
+ For="@(() => sav4Map.M)"/>
+ For="@(() => sav4Map.X)"/>
+ For="@(() => sav4Map.Z)"/>
+ For="@(() => sav4Map.Y)"/>
}
@@ -375,7 +378,7 @@
+ For="@(() => sav1Options.BattleEffects)"/>
}
@@ -456,10 +459,10 @@
+ For="@(() => sav2.BattleEffects)"/>
}
}
-
+
diff --git a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor.cs b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor.cs
index b1d25327..be097291 100644
--- a/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor.cs
+++ b/Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor.cs
@@ -174,7 +174,7 @@ private static void SetTrainerCardPokemon(SAV3FRLG sav, int index, ComboItem spe
break;
default:
return (null, null);
- };
+ }
return (date, time.TimeOfDay);
}
@@ -192,20 +192,24 @@ private void UpdateGameStarted()
switch (saveFile)
{
case SAV4 sav:
- sav.SecondsToStart = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToStart =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV5 sav:
- sav.SecondsToStart = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToStart =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV6 sav:
- sav.SecondsToStart = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToStart =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV7 sav:
- sav.SecondsToStart = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToStart =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
default:
return;
- };
+ }
}
private (DateTime? Date, TimeSpan? Time) GetHallOfFame()
@@ -234,7 +238,7 @@ private void UpdateGameStarted()
break;
default:
return (null, null);
- };
+ }
return (date, time.TimeOfDay);
}
@@ -252,20 +256,24 @@ private void UpdateHallOfFame()
switch (saveFile)
{
case SAV4 sav:
- sav.SecondsToFame = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToFame =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV5 sav:
- sav.SecondsToFame = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToFame =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV6 sav:
- sav.SecondsToFame = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToFame =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
case SAV7 sav:
- sav.SecondsToFame = (uint)DateUtil.GetSecondsFrom2000(date, new DateTime(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
+ sav.SecondsToFame =
+ (uint)DateUtil.GetSecondsFrom2000(date, new(2000, 1, 1, time.Hours, time.Minutes, time.Seconds));
break;
default:
return;
- };
+ }
}
private ComboItem GetGen1RivalStarter(SAV1 sav1)
diff --git a/Pkmds.Web/Components/MarkingComponent.razor.cs b/Pkmds.Web/Components/MarkingComponent.razor.cs
index 50fb2fcf..83617349 100644
--- a/Pkmds.Web/Components/MarkingComponent.razor.cs
+++ b/Pkmds.Web/Components/MarkingComponent.razor.cs
@@ -4,11 +4,9 @@ namespace Pkmds.Web.Components;
public partial class MarkingComponent
{
- [Parameter, EditorRequired]
- public PKM? Pokemon { get; set; }
+ [Parameter, EditorRequired] public PKM? Pokemon { get; set; }
- [Parameter, EditorRequired]
- public Markings Shape { get; set; }
+ [Parameter, EditorRequired] public Markings Shape { get; set; }
private string DisplayString => Shape switch
{
diff --git a/Pkmds.Web/Components/MarkingsContainer.razor b/Pkmds.Web/Components/MarkingsContainer.razor
index 297d593f..0b7a0184 100644
--- a/Pkmds.Web/Components/MarkingsContainer.razor
+++ b/Pkmds.Web/Components/MarkingsContainer.razor
@@ -1,25 +1,25 @@
-@if (Pokemon is { Generation: { } pokemonGeneration } && pokemonGeneration >= 3)
+@if (Pokemon is { Generation: var pokemonGeneration and >= 3 })
{
+ Shape="@MarkingsHelper.Markings.Circle"/>
+ Shape="@MarkingsHelper.Markings.Triangle"/>
+ Shape="@MarkingsHelper.Markings.Square"/>
+ Shape="@MarkingsHelper.Markings.Heart"/>
@if (pokemonGeneration >= 4)
{
+ Shape="@MarkingsHelper.Markings.Star"/>
+ Shape="@MarkingsHelper.Markings.Diamond"/>
}
}
diff --git a/Pkmds.Web/Components/MarkingsContainer.razor.cs b/Pkmds.Web/Components/MarkingsContainer.razor.cs
index 72ce4e37..d65116b2 100644
--- a/Pkmds.Web/Components/MarkingsContainer.razor.cs
+++ b/Pkmds.Web/Components/MarkingsContainer.razor.cs
@@ -2,8 +2,7 @@ namespace Pkmds.Web.Components;
public partial class MarkingsContainer : IDisposable
{
- [Parameter, EditorRequired]
- public PKM? Pokemon { get; set; }
+ [Parameter, EditorRequired] public PKM? Pokemon { get; set; }
private string ContainerClass => $"markings-container{(Pokemon is { Generation: 3 } ? " gen-3" : string.Empty)}";
diff --git a/Pkmds.Web/Components/MarkingsContainer.razor.css b/Pkmds.Web/Components/MarkingsContainer.razor.css
index 296950fa..472e192f 100644
--- a/Pkmds.Web/Components/MarkingsContainer.razor.css
+++ b/Pkmds.Web/Components/MarkingsContainer.razor.css
@@ -10,5 +10,5 @@
.gen-3 {
grid-template-columns: repeat(4, 1fr);
- grid-gap: 0px;
+ grid-gap: 0;
}
diff --git a/Pkmds.Web/Components/Pages/Home.razor.cs b/Pkmds.Web/Components/Pages/Home.razor.cs
index ad0eec0b..e20f7bc8 100644
--- a/Pkmds.Web/Components/Pages/Home.razor.cs
+++ b/Pkmds.Web/Components/Pages/Home.razor.cs
@@ -1,8 +1,9 @@
namespace Pkmds.Web.Components.Pages;
+// ReSharper disable once UnusedType.Global
public partial class Home : IDisposable
{
- private bool IsUpdateAvailable { get; set; } = false;
+ private bool IsUpdateAvailable { get; set; }
protected override void OnInitialized()
{
@@ -16,7 +17,7 @@ public void Dispose()
RefreshService.OnUpdateAvailable -= ShowUpdateMessage;
}
- public void ShowUpdateMessage()
+ private void ShowUpdateMessage()
{
// Display the alert when an update is available
IsUpdateAvailable = true;
diff --git a/Pkmds.Web/Components/PartyGrid.razor b/Pkmds.Web/Components/PartyGrid.razor
index 6f1ba3bd..7e8b7759 100644
--- a/Pkmds.Web/Components/PartyGrid.razor
+++ b/Pkmds.Web/Components/PartyGrid.razor
@@ -8,12 +8,12 @@
@for (var i = 0; i < 6; i++)
{
var slotNum = i;
- PKM? pkm = i < saveFile.PartyCount ? saveFile.PartyData[slotNum] : null;
+ var pkm = i < saveFile.PartyCount ? saveFile.PartyData[slotNum] : null;
+ GetStyleFunction="@(() => GetStyle(slotNum))"/>
}
diff --git a/Pkmds.Web/Components/PartyGrid.razor.cs b/Pkmds.Web/Components/PartyGrid.razor.cs
index c9cc2bbd..74b5ea2f 100644
--- a/Pkmds.Web/Components/PartyGrid.razor.cs
+++ b/Pkmds.Web/Components/PartyGrid.razor.cs
@@ -24,8 +24,5 @@ public void Dispose()
private void ExportAsShowdown() =>
DialogService.Show(
"Showdown Export",
- new DialogOptions
- {
- CloseOnEscapeKey = true
- });
+ new DialogOptions { CloseOnEscapeKey = true });
}
diff --git a/Pkmds.Web/Components/PokemonSlotComponent.razor b/Pkmds.Web/Components/PokemonSlotComponent.razor
index db9c695a..993b226b 100644
--- a/Pkmds.Web/Components/PokemonSlotComponent.razor
+++ b/Pkmds.Web/Components/PokemonSlotComponent.razor
@@ -1,5 +1,4 @@
@inherits BasePkmdsComponent
-@implements IDisposable
+ @{ var title = Pokemon is { Species: > 0 } ? AppService.GetPokemonSpeciesName(Pokemon.Species) : "Unknown"; }
diff --git a/Pkmds.Web/Components/PokemonSlotComponent.razor.cs b/Pkmds.Web/Components/PokemonSlotComponent.razor.cs
index d6b6c06c..4ae34592 100644
--- a/Pkmds.Web/Components/PokemonSlotComponent.razor.cs
+++ b/Pkmds.Web/Components/PokemonSlotComponent.razor.cs
@@ -2,17 +2,13 @@ namespace Pkmds.Web.Components;
public partial class PokemonSlotComponent : IDisposable
{
- [Parameter, EditorRequired]
- public int SlotNumber { get; set; }
+ [Parameter, EditorRequired] public int SlotNumber { get; set; }
- [Parameter, EditorRequired]
- public PKM? Pokemon { get; set; }
+ [Parameter, EditorRequired] public PKM? Pokemon { get; set; }
- [Parameter, EditorRequired]
- public EventCallback OnSlotClick { get; set; }
+ [Parameter, EditorRequired] public EventCallback OnSlotClick { get; set; }
- [Parameter, EditorRequired]
- public Func? GetStyleFunction { get; set; }
+ [Parameter, EditorRequired] public Func? GetStyleFunction { get; set; }
private async Task HandleClick() =>
await OnSlotClick.InvokeAsync();
diff --git a/Pkmds.Web/Components/PokemonStorageComponent.razor b/Pkmds.Web/Components/PokemonStorageComponent.razor
index 467194f2..fb453577 100644
--- a/Pkmds.Web/Components/PokemonStorageComponent.razor
+++ b/Pkmds.Web/Components/PokemonStorageComponent.razor
@@ -2,11 +2,11 @@
@if (AppState.SaveFile is { } saveFile)
{
-
+
@if (saveFile.Version is GameVersion.LG or GameVersion.GP or GameVersion.GE)
{
-
+
}
else
{
@@ -25,9 +25,10 @@
Class="box-select">
@for (var boxId = 0; boxId < saveFile.BoxCount; boxId++)
{
- var boxName = saveFile is IBoxDetailNameRead boxDetailNameRead ? boxDetailNameRead.GetBoxName(boxId) : string.Empty;
-
+ var localBoxId = boxId;
+ var boxName = saveFile is IBoxDetailNameRead boxDetailNameRead ? boxDetailNameRead.GetBoxName(localBoxId) : string.Empty;
+
@boxName
}
@@ -43,6 +44,6 @@
-
+
}
}
diff --git a/Pkmds.Web/Components/SaveFileComponent.razor b/Pkmds.Web/Components/SaveFileComponent.razor
index 1d671d37..edf02a12 100644
--- a/Pkmds.Web/Components/SaveFileComponent.razor
+++ b/Pkmds.Web/Components/SaveFileComponent.razor
@@ -6,15 +6,15 @@
{
-
+ Height="50px"/>
+
-
+ Height="50px"/>
+
+ Height="350px"/>
}
}
else
@@ -33,19 +33,19 @@ else
-
+
-
+
@@ -53,7 +53,7 @@ else
{
-
+
}
@@ -61,7 +61,7 @@ else
@if (saveFile.Generation == 3 && saveFile is SAV3 sav3)
{
-
+
}
diff --git a/Pkmds.Web/Components/SaveFileComponent.razor.cs b/Pkmds.Web/Components/SaveFileComponent.razor.cs
index a51a3151..dd1253fd 100644
--- a/Pkmds.Web/Components/SaveFileComponent.razor.cs
+++ b/Pkmds.Web/Components/SaveFileComponent.razor.cs
@@ -5,5 +5,4 @@ public partial class SaveFileComponent : IDisposable
protected override void OnInitialized() => RefreshService.OnAppStateChanged += StateHasChanged;
public void Dispose() => RefreshService.OnAppStateChanged -= StateHasChanged;
-
}
diff --git a/Pkmds.Web/Components/SaveFileNameDisplay.cs b/Pkmds.Web/Components/SaveFileNameDisplay.cs
index 54458e56..0ce54161 100644
--- a/Pkmds.Web/Components/SaveFileNameDisplay.cs
+++ b/Pkmds.Web/Components/SaveFileNameDisplay.cs
@@ -21,7 +21,9 @@ public static string SaveFileNameDisplayString(IAppState appState, IAppService a
if (saveFile.Context is not EntityContext.Gen1)
{
- var genderDisplay = saveFile.Gender == (byte)Gender.Male ? Constants.MaleGenderUnicode : Constants.FemaleGenderUnicode;
+ var genderDisplay = saveFile.Gender == (byte)Gender.Male
+ ? Constants.MaleGenderUnicode
+ : Constants.FemaleGenderUnicode;
sbTitle.Append($"{genderDisplay} ");
}
diff --git a/Pkmds.Web/Constants.cs b/Pkmds.Web/Constants.cs
index f4e571e5..c0bbef67 100644
--- a/Pkmds.Web/Constants.cs
+++ b/Pkmds.Web/Constants.cs
@@ -15,11 +15,21 @@ public static class Constants
public const string FemaleGenderUnicode = "♀";
public const string PokeDollarSvg = """
-
- """;
+
+ """;
public const string EmptyIndex = "---";
+
+ public const byte MaxDynamaxLevel = 10;
+
+ public const byte MinMinutes = 0;
+
+ public const byte MaxMinutes = 59;
+
+ public const byte MinSeconds = 0;
+
+ public const byte MaxSeconds = 59;
}
diff --git a/Pkmds.Web/Extensions/MoveExtension.cs b/Pkmds.Web/Extensions/MoveExtension.cs
deleted file mode 100644
index d7bebe34..00000000
--- a/Pkmds.Web/Extensions/MoveExtension.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Pkmds.Web.Extensions;
-
-public static class MoveExtension
-{
- public static bool IsValidMove(this Move move) => move is > Move.None and < Move.MAX_COUNT;
-
- public static bool IsValidMove(this ushort move) => IsValidMove((Move)move);
-}
diff --git a/Pkmds.Web/Extensions/PKMExtensions.cs b/Pkmds.Web/Extensions/PkmExtensions.cs
similarity index 78%
rename from Pkmds.Web/Extensions/PKMExtensions.cs
rename to Pkmds.Web/Extensions/PkmExtensions.cs
index 9ff4c29c..987f984b 100644
--- a/Pkmds.Web/Extensions/PKMExtensions.cs
+++ b/Pkmds.Web/Extensions/PkmExtensions.cs
@@ -1,6 +1,6 @@
namespace Pkmds.Web.Extensions;
-public static class PKMExtensions
+public static class PkmExtensions
{
public static uint? GetFormArgument(this PKM pkm, uint? valueIfNull = null) =>
(pkm as IFormArgument)?.FormArgument ?? valueIfNull;
@@ -15,7 +15,8 @@ public static (byte Type1, byte Type2) GetGenerationTypes(this PKM pkm)
? (ConvertGenerationType(type1, generation), ConvertGenerationType(type2, generation))
: (type1, type2);
- static byte ConvertGenerationType(byte type, byte generation) => (byte)((MoveType)type).GetMoveTypeGeneration(generation);
+ static byte ConvertGenerationType(byte type, byte generation) =>
+ (byte)((MoveType)type).GetMoveTypeGeneration(generation);
}
public static int GetMarking(this PKM pokemon, int index)
@@ -38,30 +39,28 @@ public static int GetMarking(this PKM pokemon, int index)
};
}
+ // ReSharper disable once InconsistentNaming
public static ReadOnlyCollection GetPP(this PKM pokemon) => new(
- [
- pokemon.Move1_PP,
- pokemon.Move2_PP,
- pokemon.Move3_PP,
- pokemon.Move4_PP
- ]);
-
+ [
+ pokemon.Move1_PP,
+ pokemon.Move2_PP,
+ pokemon.Move3_PP,
+ pokemon.Move4_PP
+ ]);
+
+ // ReSharper disable once InconsistentNaming
public static ReadOnlyCollection GetPPUps(this PKM pokemon) => new(
- [
- pokemon.Move1_PPUps,
- pokemon.Move2_PPUps,
- pokemon.Move3_PPUps,
- pokemon.Move4_PPUps
- ]);
-
+ [
+ pokemon.Move1_PPUps,
+ pokemon.Move2_PPUps,
+ pokemon.Move3_PPUps,
+ pokemon.Move4_PPUps
+ ]);
+
+ // ReSharper disable once InconsistentNaming
public static void SetPP(this PKM pokemon, int moveIndex, int pp)
{
- if (pokemon is null)
- {
- return;
- }
-
- if(pp < 0)
+ if (pp < 0)
{
pp = 0;
}
@@ -83,13 +82,9 @@ public static void SetPP(this PKM pokemon, int moveIndex, int pp)
}
}
+ // ReSharper disable once InconsistentNaming
public static void SetPPUps(this PKM pokemon, int moveIndex, int ppUps)
{
- if (pokemon is null)
- {
- return;
- }
-
if (ppUps < 0)
{
ppUps = 0;
@@ -112,9 +107,11 @@ public static void SetPPUps(this PKM pokemon, int moveIndex, int ppUps)
}
}
- public static int GetMaxPP(this PKM pokemon, int moveIndex)
+ // ReSharper disable once InconsistentNaming
+ public static int GetMaxPP(this PKM pokemon, int moveIndex)
{
var move = pokemon.GetMove(moveIndex);
+ // ReSharper disable once InconsistentNaming
var moveBasePP = MoveInfo.GetPP(pokemon.Context, move);
var ppUps = pokemon.GetPPUps()[moveIndex];
diff --git a/Pkmds.Web/Program.cs b/Pkmds.Web/Program.cs
index 986c15b9..223e39e8 100644
--- a/Pkmds.Web/Program.cs
+++ b/Pkmds.Web/Program.cs
@@ -5,14 +5,14 @@
builder.RootComponents.Add("head::after");
services
- .AddMudServices(config =>
+ .AddMudServices(config =>
{
config.SnackbarConfiguration.PreventDuplicates = false;
config.SnackbarConfiguration.ClearAfterNavigation = true;
});
services
- .AddSingleton(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) })
+ .AddSingleton(_ => new HttpClient { BaseAddress = new(builder.HostEnvironment.BaseAddress) })
.AddFileSystemAccessService()
.AddSingleton()
.AddSingleton()
diff --git a/Pkmds.Web/Services/AppService.cs b/Pkmds.Web/Services/AppService.cs
index af93cfd2..9b535588 100644
--- a/Pkmds.Web/Services/AppService.cs
+++ b/Pkmds.Web/Services/AppService.cs
@@ -47,38 +47,41 @@ public void ClearSelection()
public string GetPokemonSpeciesName(ushort speciesId) => GetSpeciesComboItem(speciesId).Text;
- public IEnumerable SearchPokemonNames(string searchString) => AppState.SaveFile is null || searchString is not { Length: > 0 }
- ? []
- : GameInfo.FilteredSources.Species
- .DistinctBy(species => species.Value)
- .Where(species => species.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
- .OrderBy(species => species.Text);
+ public IEnumerable SearchPokemonNames(string searchString) =>
+ AppState.SaveFile is null || searchString is not { Length: > 0 }
+ ? []
+ : GameInfo.FilteredSources.Species
+ .DistinctBy(species => species.Value)
+ .Where(species => species.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(species => species.Text);
public ComboItem GetSpeciesComboItem(ushort speciesId) => GameInfo.FilteredSources.Species
.DistinctBy(species => species.Value)
- .FirstOrDefault(species => species.Value == speciesId) ?? default!;
+ .FirstOrDefault(species => species.Value == speciesId) ?? null!;
- public IEnumerable SearchItemNames(string searchString) => AppState.SaveFile is null || searchString is not { Length: > 0 }
- ? []
- : GameInfo.FilteredSources.Items
- .DistinctBy(item => item.Value)
- .Where(item => item.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
- .OrderBy(item => item.Text);
+ public IEnumerable SearchItemNames(string searchString) =>
+ AppState.SaveFile is null || searchString is not { Length: > 0 }
+ ? []
+ : GameInfo.FilteredSources.Items
+ .DistinctBy(item => item.Value)
+ .Where(item => item.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(item => item.Text);
public ComboItem GetItemComboItem(int itemId) => GameInfo.FilteredSources.Items
.DistinctBy(item => item.Value)
- .FirstOrDefault(item => item.Value == itemId) ?? default!;
+ .FirstOrDefault(item => item.Value == itemId) ?? null!;
public ComboItem GetAbilityComboItem(int abilityId) => GameInfo.FilteredSources.Abilities
.DistinctBy(ability => ability.Value)
- .FirstOrDefault(ability => ability.Value == abilityId) ?? default!;
+ .FirstOrDefault(ability => ability.Value == abilityId) ?? null!;
- public IEnumerable SearchAbilityNames(string searchString) => AppState.SaveFile is null || searchString is not { Length: > 0 }
- ? []
- : GameInfo.FilteredSources.Abilities
- .DistinctBy(ability => ability.Value)
- .Where(ability => ability.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
- .OrderBy(ability => ability.Text);
+ public IEnumerable SearchAbilityNames(string searchString) =>
+ AppState.SaveFile is null || searchString is not { Length: > 0 }
+ ? []
+ : GameInfo.FilteredSources.Abilities
+ .DistinctBy(ability => ability.Value)
+ .Where(ability => ability.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(ability => ability.Text);
public string GetStatModifierString(Nature nature)
{
@@ -100,29 +103,33 @@ public void LoadPokemonStats(PKM? pokemon)
pokemon.SetStats(stats);
}
- public IEnumerable SearchMetLocations(string searchString, GameVersion gameVersion, EntityContext entityContext, bool isEggLocation = false) => AppState.SaveFile is null || searchString is not { Length: > 0 }
- ? []
- : GameInfo.GetLocationList(gameVersion, entityContext, isEggLocation)
- .DistinctBy(l => l.Value)
- .Where(metLocation => metLocation.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
- .OrderBy(metLocation => metLocation.Text);
-
- public ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion, EntityContext entityContext, bool isEggLocation = false) => AppState.SaveFile is null
- ? default!
+ public IEnumerable SearchMetLocations(string searchString, GameVersion gameVersion,
+ EntityContext entityContext, bool isEggLocation = false) =>
+ AppState.SaveFile is null || searchString is not { Length: > 0 }
+ ? []
+ : GameInfo.GetLocationList(gameVersion, entityContext, isEggLocation)
+ .DistinctBy(l => l.Value)
+ .Where(metLocation => metLocation.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(metLocation => metLocation.Text);
+
+ public ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion, EntityContext entityContext,
+ bool isEggLocation = false) => AppState.SaveFile is null
+ ? null!
: GameInfo.GetLocationList(gameVersion, entityContext, isEggLocation)
.DistinctBy(l => l.Value)
- .FirstOrDefault(metLocation => metLocation.Value == metLocationId) ?? default!;
+ .FirstOrDefault(metLocation => metLocation.Value == metLocationId) ?? null!;
- public IEnumerable SearchMoves(string searchString) => AppState.SaveFile is null || searchString is not { Length: > 0 }
- ? []
- : GameInfo.FilteredSources.Moves
- .DistinctBy(move => move.Value)
- .Where(move => move.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
- .OrderBy(move => move.Text);
+ public IEnumerable SearchMoves(string searchString) =>
+ AppState.SaveFile is null || searchString is not { Length: > 0 }
+ ? []
+ : GameInfo.FilteredSources.Moves
+ .DistinctBy(move => move.Value)
+ .Where(move => move.Text.Contains(searchString, StringComparison.OrdinalIgnoreCase))
+ .OrderBy(move => move.Text);
public ComboItem GetMoveComboItem(int moveId) => GameInfo.FilteredSources.Moves
.DistinctBy(move => move.Value)
- .FirstOrDefault(metLocation => metLocation.Value == moveId) ?? default!;
+ .FirstOrDefault(metLocation => metLocation.Value == moveId) ?? null!;
public void SavePokemon(PKM? pokemon)
{
@@ -146,10 +153,12 @@ public void SavePokemon(PKM? pokemon)
}
else if (AppState.SelectedBoxNumber is not null && AppState.SelectedBoxSlotNumber is not null)
{
- AppState.SaveFile.SetBoxSlotAtIndex(pokemon, AppState.SelectedBoxNumber.Value, AppState.SelectedBoxSlotNumber.Value);
+ AppState.SaveFile.SetBoxSlotAtIndex(pokemon, AppState.SelectedBoxNumber.Value,
+ AppState.SelectedBoxSlotNumber.Value);
RefreshService.RefreshBoxState();
}
- else if (AppState.SelectedBoxNumber is null && AppState.SelectedBoxSlotNumber is not null && AppState.SaveFile is SAV7b)
+ else if (AppState.SelectedBoxNumber is null && AppState.SelectedBoxSlotNumber is not null &&
+ AppState.SaveFile is SAV7b)
{
AppState.SaveFile.SetBoxSlotAtIndex(pokemon, AppState.SelectedBoxSlotNumber.Value);
RefreshService.RefreshBoxAndPartyState();
diff --git a/Pkmds.Web/Services/BlazorAesProvider.cs b/Pkmds.Web/Services/BlazorAesProvider.cs
index dbcfb543..13953f93 100644
--- a/Pkmds.Web/Services/BlazorAesProvider.cs
+++ b/Pkmds.Web/Services/BlazorAesProvider.cs
@@ -8,7 +8,7 @@ public IAesCryptographyProvider.IAes Create(byte[] key, CipherMode mode, Padding
#pragma warning disable CS9113 // Parameter is unread.
private class CryptoJsAes(JsService jsService, byte[] key, CipherMode mode, PaddingMode padding, byte[]? iv = null)
#pragma warning restore CS9113 // Parameter is unread.
- : IAesCryptographyProvider.IAes, IDisposable
+ : IAesCryptographyProvider.IAes
{
public void EncryptEcb(ReadOnlySpan plaintext, Span destination) =>
jsService.EncryptAes(plaintext, destination, key, CipherMode.ECB);
@@ -25,4 +25,3 @@ public void DecryptCbc(ReadOnlySpan ciphertext, Span destination) =>
public void Dispose() { }
}
}
-
diff --git a/Pkmds.Web/Services/IAppService.cs b/Pkmds.Web/Services/IAppService.cs
index 126c739a..941d47a4 100644
--- a/Pkmds.Web/Services/IAppService.cs
+++ b/Pkmds.Web/Services/IAppService.cs
@@ -2,8 +2,6 @@
public interface IAppService
{
- string[] NatureStatShortNames { get; }
-
PKM? EditFormPokemon { get; set; }
bool IsDrawerOpen { get; set; }
@@ -34,9 +32,11 @@ public interface IAppService
IEnumerable SearchAbilityNames(string searchString);
- IEnumerable SearchMetLocations(string searchString, GameVersion gameVersion, EntityContext entityContext, bool isEggLocation = false);
+ IEnumerable SearchMetLocations(string searchString, GameVersion gameVersion, EntityContext entityContext,
+ bool isEggLocation = false);
- ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion, EntityContext entityContext, bool isEggLocation = false);
+ ComboItem GetMetLocationComboItem(ushort metLocationId, GameVersion gameVersion, EntityContext entityContext,
+ bool isEggLocation = false);
IEnumerable SearchMoves(string searchString);
diff --git a/Pkmds.Web/Services/IRefreshService.cs b/Pkmds.Web/Services/IRefreshService.cs
index 43dbd164..e27f9c79 100644
--- a/Pkmds.Web/Services/IRefreshService.cs
+++ b/Pkmds.Web/Services/IRefreshService.cs
@@ -18,5 +18,6 @@ public interface IRefreshService
void RefreshBoxAndPartyState();
+ // ReSharper disable once UnusedMember.Global
void ShowUpdateMessage();
}
diff --git a/Pkmds.Web/Services/JsService.cs b/Pkmds.Web/Services/JsService.cs
index a40942be..81e2ddf0 100644
--- a/Pkmds.Web/Services/JsService.cs
+++ b/Pkmds.Web/Services/JsService.cs
@@ -3,8 +3,8 @@
public class JsService(IJSRuntime js)
{
private IJSInProcessRuntime SyncJs => js as IJSInProcessRuntime ??
- throw new NotSupportedException(
- "Requested an in process javascript interop, but none was found");
+ throw new NotSupportedException(
+ "Requested an in process javascript interop, but none was found");
public void EncryptAes(ReadOnlySpan origin, Span destination, ReadOnlySpan key, CipherMode mode)
{
diff --git a/Pkmds.Web/Services/RefreshService.cs b/Pkmds.Web/Services/RefreshService.cs
index a7e22800..abd49850 100644
--- a/Pkmds.Web/Services/RefreshService.cs
+++ b/Pkmds.Web/Services/RefreshService.cs
@@ -2,7 +2,7 @@
public class RefreshService : IRefreshService
{
- public static RefreshService? Instance { get; private set; }
+ private static RefreshService? Instance { get; set; }
public event Action? OnAppStateChanged;
public event Action? OnBoxStateChanged;
diff --git a/Pkmds.Web/SpriteHelper.cs b/Pkmds.Web/SpriteHelper.cs
index 5184bdb0..9e9f97d9 100644
--- a/Pkmds.Web/SpriteHelper.cs
+++ b/Pkmds.Web/SpriteHelper.cs
@@ -10,39 +10,44 @@ public static class SpriteHelper
public const string PokemonFallbackImageFileName = $"{SpritesRoot}a/a_unknown.png";
public static string GetMysteryGiftSpriteFileName(MysteryGift gift) => gift.IsItem
- ? GetItemSpriteFilename(gift.ItemID, gift.Context)
- : GetPokemonSpriteFilename(gift.Species, gift.Context, gift.IsEgg, gift.Form, 0, gift.Gender);
+ ? GetItemSpriteFilename(gift.ItemID, gift.Context)
+ : GetPokemonSpriteFilename(gift.Species, gift.Context, gift.IsEgg, gift.Form, 0, gift.Gender);
public static string GetPokemonSpriteFilename(PKM? pokemon) => pokemon is null
- ? PokemonFallbackImageFileName
- : GetPokemonSpriteFilename(pokemon.Species, pokemon.Context, pokemon.IsEgg, pokemon.Form, pokemon.GetFormArgument(0), pokemon.Gender);
+ ? PokemonFallbackImageFileName
+ : GetPokemonSpriteFilename(pokemon.Species, pokemon.Context, pokemon.IsEgg, pokemon.Form,
+ pokemon.GetFormArgument(0), pokemon.Gender);
- public static string GetPokemonSpriteFilename(ushort species, EntityContext context, bool isEgg, byte form, uint? formArg1, byte gender) =>
+ private static string GetPokemonSpriteFilename(ushort species, EntityContext context, bool isEgg, byte form,
+ uint? formArg1, byte gender) =>
new StringBuilder($"{SpritesRoot}a/a_")
- .Append((species, context, isEgg, form, formArg1, gender) switch
- {
- { context: EntityContext.Gen7b } and ({ species: (ushort)Species.Pikachu, form: PikachuStarterForm }
- or { species: (ushort)Species.Eevee, form: EeveeStarterForm }) => $"{species}-{form}p",
- { species: (ushort)Species.Manaphy, isEgg: true } => "490-e",
- { isEgg: true } => "egg",
- { species: (ushort)Species.Frillish or (ushort)Species.Jellicent, gender: (byte)Gender.Female } => $"{species}f",
- { species: (ushort)Species.Alcremie } => $"{species}-{form}-{formArg1}",
- _ when form > 0 && FormInfo.HasTotemForm(species) && FormInfo.IsTotemForm(species, form) => $"{species}-{FormInfo.GetTotemBaseForm(species, form)}",
- { form: > 0 } => species switch
+ .Append((species, context, isEgg, form, formArg1, gender) switch
{
- (ushort)Species.Rockruff => species.ToString(),
- (ushort)Species.Sinistea or (ushort)Species.Polteageist => species.ToString(),
- (ushort)Species.Scatterbug or (ushort)Species.Spewpa => species.ToString(),
- (ushort)Species.Urshifu => species.ToString(),
- (ushort)Species.Dudunsparce => species.ToString(),
- _ => $"{species}-{form}",
- },
- { species: > (ushort)Species.None and < (ushort)Species.MAX_COUNT } =>
- species.ToString(),
- _ => "unknown",
- })
- .Append(".png")
- .ToString();
+ { context: EntityContext.Gen7b } and ({ species: (ushort)Species.Pikachu, form: PikachuStarterForm }
+ or { species: (ushort)Species.Eevee, form: EeveeStarterForm }) => $"{species}-{form}p",
+ { species: (ushort)Species.Manaphy, isEgg: true } => "490-e",
+ { isEgg: true } => "egg",
+ {
+ species: (ushort)Species.Frillish or (ushort)Species.Jellicent, gender: (byte)Gender.Female
+ } => $"{species}f",
+ { species: (ushort)Species.Alcremie } => $"{species}-{form}-{formArg1}",
+ (_, _, _, > 0, _, _) when FormInfo.HasTotemForm(species) && FormInfo.IsTotemForm(species, form) =>
+ $"{species}-{FormInfo.GetTotemBaseForm(species, form)}",
+ { form: > 0 } => species switch
+ {
+ (ushort)Species.Rockruff => species.ToString(),
+ (ushort)Species.Sinistea or (ushort)Species.Polteageist => species.ToString(),
+ (ushort)Species.Scatterbug or (ushort)Species.Spewpa => species.ToString(),
+ (ushort)Species.Urshifu => species.ToString(),
+ (ushort)Species.Dudunsparce => species.ToString(),
+ _ => $"{species}-{form}",
+ },
+ { species: > (ushort)Species.None and < (ushort)Species.MAX_COUNT } =>
+ species.ToString(),
+ _ => "unknown",
+ })
+ .Append(".png")
+ .ToString();
public static string GetBallSpriteFilename(int ball) =>
$"{SpritesRoot}b/_ball{ball}.png";
@@ -96,6 +101,7 @@ public static string GetBagPouchSpriteFileName(InventoryType type) =>
};
// TODO: Implement
+ // ReSharper disable once UnusedParameter.Global
public static string GetMoveCategorySpriteFileName(int categoryId) =>
string.Empty;
diff --git a/Pkmds.Web/wwwroot/css/app.css b/Pkmds.Web/wwwroot/css/app.css
index 4f785507..fc20f362 100644
--- a/Pkmds.Web/wwwroot/css/app.css
+++ b/Pkmds.Web/wwwroot/css/app.css
@@ -1,8 +1,5 @@
body, html {
- padding-bottom: env(safe-area-inset-bottom, 16px);
- padding-top: env(safe-area-inset-top);
- padding-left: env(safe-area-inset-left, 8px);
- padding-right: env(safe-area-inset-right);
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 8px);
box-sizing: border-box;
}
@@ -12,12 +9,12 @@ body, html {
box-sizing: border-box;
}
-pkm-sprite {
+.pkm-sprite {
object-fit: contain;
align-self: center;
}
-item-sprite {
+.item-sprite {
object-fit: contain;
align-self: center;
}
@@ -74,19 +71,19 @@ item-sprite {
margin: 20vh auto 1rem auto;
}
- .loading-progress circle {
- fill: none;
- stroke: #e0e0e0;
- stroke-width: 0.6rem;
- transform-origin: 50% 50%;
- transform: rotate(-90deg);
- }
+.loading-progress circle {
+ fill: none;
+ stroke: #e0e0e0;
+ stroke-width: 0.6rem;
+ transform-origin: 50% 50%;
+ transform: rotate(-90deg);
+}
- .loading-progress circle:last-child {
- stroke: #1b6ec2;
- stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
- transition: stroke-dasharray 0.05s ease-in-out;
- }
+.loading-progress circle:last-child {
+ stroke: #1b6ec2;
+ stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
+ transition: stroke-dasharray 0.05s ease-in-out;
+}
.loading-progress-text {
position: absolute;
@@ -95,6 +92,6 @@ item-sprite {
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}
- .loading-progress-text:after {
- content: var(--blazor-load-percentage-text, "Loading");
- }
+.loading-progress-text:after {
+ content: var(--blazor-load-percentage-text, "Loading");
+}
diff --git a/Pkmds.Web/wwwroot/js/fileSave.js b/Pkmds.Web/wwwroot/js/fileSave.js
index d106bef8..2f852ede 100644
--- a/Pkmds.Web/wwwroot/js/fileSave.js
+++ b/Pkmds.Web/wwwroot/js/fileSave.js
@@ -4,13 +4,13 @@
suggestedName: fileName,
types: [{
description: description,
- accept: { 'application/octet-stream': [extension] }
+ accept: {'application/octet-stream': [extension]}
}]
};
const handle = await window.showSaveFilePicker(opts);
const writable = await handle.createWritable();
- await writable.write(new Blob([new Uint8Array(byteArray)], { type: "application/octet-stream" }));
+ await writable.write(new Blob([new Uint8Array(byteArray)], {type: "application/octet-stream"}));
await writable.close();
} catch (ex) {
console.error(ex);
diff --git a/Pkmds.Web/wwwroot/service-worker.published.js b/Pkmds.Web/wwwroot/service-worker.published.js
index db328429..a8c294a4 100644
--- a/Pkmds.Web/wwwroot/service-worker.published.js
+++ b/Pkmds.Web/wwwroot/service-worker.published.js
@@ -17,8 +17,8 @@ const cacheNamePrefix = 'offline-cache-';
const CACHE_VERSION = '%%CACHE_VERSION%%'
const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}${CACHE_VERSION}`;
-const offlineAssetsInclude = [ /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/ ];
-const offlineAssetsExclude = [ /^service-worker\.js$/ ];
+const offlineAssetsInclude = [/\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/];
+const offlineAssetsExclude = [/^service-worker\.js$/];
// Replace with your base path if you are hosting on a subfolder. Ensure there is a trailing '/'.
const base = "/";
@@ -32,7 +32,7 @@ async function onInstall(event) {
const assetsRequests = self.assetsManifest.assets
.filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url)))
.filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url)))
- .map(asset => new Request(asset.url, { integrity: asset.hash, cache: 'no-cache' }));
+ .map(asset => new Request(asset.url, {integrity: asset.hash, cache: 'no-cache'}));
await caches.open(cacheName).then(cache => cache.addAll(assetsRequests));
}