Skip to content

Commit

Permalink
Add Gen I - III Rival info, Gen III BP
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey85 committed Nov 25, 2024
1 parent b014cb3 commit 7c17691
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
80 changes: 73 additions & 7 deletions Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,49 @@
</div>
}

@if (saveFile is SAV1 sav1Rival)
{
<div class="form-field">
<MudTextField Label="Rival Name"
Variant="@Variant.Outlined"
MaxLength="@sav1Rival.MaxStringLengthTrainer"
@bind-Value="@sav1Rival.Rival"
For="@(() => sav1Rival.Rival)" />
</div>

<div class="form-field">
<MudAutocomplete T="@ComboItem"
Label="Rival Starter"
Variant="@Variant.Outlined"
@bind-Value:get="@(AppService.GetSpeciesComboItem(sav1Rival.RivalStarter))"
@bind-Value:set="@(species => { sav1Rival.RivalStarter = (byte)species.Value; })"
SearchFunc="@SearchPokemonNames"
ToStringFunc="@(species => species?.Text)" />
</div>
}

@if (saveFile is SAV2 sav2Rival)
{
<div class="form-field">
<MudTextField Label="Rival Name"
Variant="@Variant.Outlined"
MaxLength="@sav2Rival.MaxStringLengthTrainer"
@bind-Value="@sav2Rival.Rival"
For="@(() => sav2Rival.Rival)" />
</div>
}

@if (saveFile is SAV3FRLG sav3Rival)
{
<div class="form-field">
<MudTextField Label="Rival Name"
Variant="@Variant.Outlined"
MaxLength="@sav3Rival.MaxStringLengthTrainer"
@bind-Value="@sav3Rival.RivalName"
For="@(() => sav3Rival.RivalName)" />
</div>
}

<div class="form-field">
<MudNumericField Label="Money"
T="@uint"
Expand All @@ -100,6 +143,29 @@
</div>
}

if (saveFile is SAV3E sav3)
{
<div class="form-field">
<MudNumericField Label="BP"
T="@uint"
Variant="@Variant.Outlined"
Min="0"
Max="9999"
@bind-Value="@sav3.BP"
For="@(() => sav3.BP)" />
</div>

<div class="form-field">
<MudNumericField Label="Earned BP"
T="@uint"
Variant="@Variant.Outlined"
Min="0"
Max="@uint.MaxValue"
@bind-Value="@sav3.BPEarned"
For="@(() => sav3.BPEarned)" />
</div>
}

<div class="form-field">
<MudNumericField Label="Hours"
T="@int"
Expand Down Expand Up @@ -130,13 +196,13 @@
For="@(() => saveFile.PlayedSeconds)" />
</div>

@if (saveFile is SAV1 sav1)
@if (saveFile is SAV1 sav1Options)
{
<div class="form-field">
<MudSelect Label="Battle Style"
Variant="@Variant.Outlined"
@bind-Value="@sav1.BattleStyleSwitch"
For="@(() => sav1.BattleStyleSwitch)">
@bind-Value="@sav1Options.BattleStyleSwitch"
For="@(() => sav1Options.BattleStyleSwitch)">
<MudSelectItem Value="@true"
@key="@true">
Switch
Expand All @@ -151,8 +217,8 @@
<div class="form-field">
<MudSelect Label="Text Speed"
Variant="@Variant.Outlined"
@bind-Value="@sav1.TextSpeed"
For="@(() => sav1.TextSpeed)">
@bind-Value="@sav1Options.TextSpeed"
For="@(() => sav1Options.TextSpeed)">
<MudSelectItem Value="0"
@key="0">
0 (Instant)
Expand Down Expand Up @@ -190,8 +256,8 @@

<div class="form-field">
<MudCheckBox Label="Use Battle Effects"
@bind-Value="@sav1.BattleEffects"
For="@(() => sav1.BattleEffects)" />
@bind-Value="@sav1Options.BattleEffects"
For="@(() => sav1Options.BattleEffects)" />
</div>
}

Expand Down
3 changes: 3 additions & 0 deletions Pkmds.Web/Components/MainTabPages/TrainerInfoTab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ private void SetCoins(uint value)
break;
}
}

private Task<IEnumerable<ComboItem>> SearchPokemonNames(string searchString, CancellationToken token) =>
Task.FromResult(AppService.SearchPokemonNames(searchString));
}

0 comments on commit 7c17691

Please sign in to comment.