Skip to content

Commit

Permalink
Form numeric swapped to form combo only for valid species with forms
Browse files Browse the repository at this point in the history
- Few fixes
  • Loading branch information
zyro670 committed Dec 26, 2023
1 parent 8e6d61f commit 4025f82
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 52 deletions.
2 changes: 1 addition & 1 deletion PokeViewer.NET/MainViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace PokeViewer.NET
public partial class MainViewer : Form
{
public ViewerExecutor Executor = null!;
private const string ViewerVersion = "3.0.1";
private const string ViewerVersion = "3.0.2";
private readonly bool[] FormLoaded = new bool[8];
private int GameType;
private SimpleTrainerInfo TrainerInfo = new();
Expand Down
37 changes: 12 additions & 25 deletions PokeViewer.NET/SubForms/MiscViewSV.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 30 additions & 8 deletions PokeViewer.NET/SubForms/MiscViewSV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public partial class MiscViewSV : Form
private List<string> MapCountObB = [];
private List<string> MapStringsObB = [];
private List<PK9> pkList = [];
private readonly string[] SpeciesList = null!;
private readonly string[] FormsList = null!;
private readonly string[] TypesList = null!;
private readonly string[] GenderList = null!;
protected ViewerOffsets Offsets { get; } = new();
public MiscViewSV(ViewerExecutor executor, (Color, Color) color)
{
Expand All @@ -64,6 +68,10 @@ public MiscViewSV(ViewerExecutor executor, (Color, Color) color)
LoadFilters(path);

LoadOutbreakCache();
SpeciesList = GameInfo.GetStrings(1).specieslist;
FormsList = GameInfo.GetStrings(1).forms;
TypesList = GameInfo.GetStrings(1).types;
GenderList = [.. GameInfo.GenderSymbolUnicode];
}

private void LoadFilters(string data)
Expand Down Expand Up @@ -114,8 +122,8 @@ private void SetColors((Color, Color) color)
OutbreakIcon.ForeColor = color.Item2;
SpeciesBox.BackColor = color.Item1;
SpeciesBox.ForeColor = color.Item2;
FormBox.BackColor = color.Item1;
FormBox.ForeColor = color.Item2;
FormCombo.BackColor = color.Item1;
FormCombo.ForeColor = color.Item2;
MapGroup.BackColor = color.Item1;
MapGroup.ForeColor = color.Item2;
FwdButton.BackColor = color.Item1;
Expand Down Expand Up @@ -998,9 +1006,6 @@ private async Task SearchForOutbreak(CancellationToken token)
MapPOSB = [];
MapCountB = [];
MapStringsB = [];

Apply0To64.Checked = false;
OutbreakSearch.Checked = false;
}

DaySkipTotal.Text = $"Day Skips: {dayskip}";
Expand Down Expand Up @@ -1629,12 +1634,29 @@ private void button1_Click(object sender, EventArgs e)
MessageBox.Show(r, "Search List");
}

private void SpeciesBox_IsChanged(object sender, EventArgs e)
{
FormCombo.Items.Clear();
FormCombo.Text = string.Empty;
var formlist = FormConverter.GetFormList((ushort)(Species)SpeciesBox.SelectedIndex, TypesList, FormsList, GenderList, EntityContext.Gen9);
if ((Species)SpeciesBox.SelectedIndex == Species.Minior)
formlist = formlist.Take((formlist.Length + 1) / 2).ToArray();

if (formlist.Length == 0 || (formlist.Length == 1 && formlist[0].Equals("")))
FormCombo.Visible = false;
else
{
FormCombo.Items.AddRange(formlist);
FormCombo.Visible = true;
}
}

private void AddSpecies_Click(object sender, EventArgs e)
{
PK9 pk = new()
{
Species = (ushort)(Species)SpeciesBox.SelectedIndex,
Form = (byte)FormBox.Value,
Form = (byte)FormCombo.SelectedIndex,
};

if (pk.Species == 0)
Expand Down Expand Up @@ -1686,7 +1708,7 @@ private void RemoveSpecies_Click(object sender, EventArgs e)
PK9 pk = new()
{
Species = (ushort)(Species)SpeciesBox.SelectedIndex,
Form = (byte)FormBox.Value,
Form = (byte)FormCombo.SelectedIndex,
};
foreach (var p in pkList.ToList())
{
Expand Down Expand Up @@ -1789,7 +1811,7 @@ private async Task EnterRaidCode(CancellationToken token)
var strokes = FCETextBox.Text.ToUpper().ToArray();
var number = $"NumPad";
string[] badVals = { "@", "I", "O", "=", "&", ";", "Z", "*", "#", "!", "?" };
List<HidKeyboardKey> keystopress = new();
List<HidKeyboardKey> keystopress = [];
foreach (var str in strokes)
{
if (badVals.Contains(str.ToString()))
Expand Down
17 changes: 0 additions & 17 deletions PokeViewer.NET/Util/ViewerUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@ public class DataBlock

public static class Blocks
{
public static DataBlock KPlayerCurrentFieldID = new()
{
Name = "KPlayerCurrentFieldID",
Key = 0xF17EB014,
Type = SCTypeCode.SByte,
IsEncrypted = true,
Size = 1,
};
public static DataBlock KMassOutbreakTotalPaldea = new()
{
Name = "KMassOutbreakTotalPaldea",
Expand Down Expand Up @@ -2098,14 +2090,5 @@ public static class Blocks
Size = 12,
};
#endregion
public static DataBlock KBlueberryPoints = new()
{
Name = "KBlueberryPoints",
Key = 0x66A33824,
Type = SCTypeCode.UInt32,
IsEncrypted = true,
Size = 4,
};
}

}
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ steps:
inputs:
solution: '$(Project)'
msbuildArgs: '/t:restore;rebuild;publish
/p:Configuration=$(Configuration);Platform=$(Platform);PublishSingleFile=true;OutputPath=$(Build.ArtifactStagingDirectory)\'
/p:Configuration=$(Configuration);Platform=$(Platform);PublishSingleFile=true;OutputPath=$(Build.ArtifactStagingDirectory)\
/p:RuntimeIdentifier=win-$(Platform)'

- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: PokeViewer.NET-x64'
Expand Down

0 comments on commit 4025f82

Please sign in to comment.