mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
88830e0d00
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now. Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes. Adds functionality for Batch Editor commands to `>`, `<` and <=/>= TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants. Main window has a new layout to account for DPI scaling (8 point grid) Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724) Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720) Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714) Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691) Added: Properties for ribbon/mark count (closes #3659) Fixed: Traded SV eggs are now checked correctly (closes #3692)
97 lines
3.7 KiB
C#
97 lines
3.7 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using PKHeX.Core;
|
|
using PKHeX.Drawing;
|
|
using PKHeX.Drawing.Misc;
|
|
using PKHeX.Drawing.PokeSprite;
|
|
|
|
namespace PKHeX.WinForms;
|
|
|
|
public partial class KChart : Form
|
|
{
|
|
private readonly SaveFile SAV;
|
|
private readonly string[] abilities;
|
|
|
|
public KChart(SaveFile sav)
|
|
{
|
|
InitializeComponent();
|
|
Icon = Properties.Resources.Icon;
|
|
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
|
|
SAV = sav;
|
|
|
|
var pt = SAV.Personal;
|
|
var strings = GameInfo.Strings;
|
|
var species = strings.specieslist;
|
|
abilities = strings.abilitylist;
|
|
|
|
DGV.Rows.Clear();
|
|
for (ushort s = 1; s <= pt.MaxSpeciesID; s++)
|
|
{
|
|
var fc = pt[s, 0].FormCount;
|
|
var formNames = fc <= 1
|
|
? Array.Empty<string>()
|
|
: FormConverter.GetFormList(s, strings.Types, strings.forms, Main.GenderSymbols, SAV.Context);
|
|
|
|
for (byte f = 0; f < fc; f++)
|
|
{
|
|
var name = f == 0 ? species[s] : $"{species[s]}-{(f < formNames.Length ? formNames[f] : f.ToString())}";
|
|
PopEntry(s, f, name, pt);
|
|
}
|
|
}
|
|
|
|
DGV.Sort(DGV.Columns[0], ListSortDirection.Ascending);
|
|
}
|
|
|
|
private void PopEntry(ushort species, byte form, string name, IPersonalTable pt)
|
|
{
|
|
if (!pt.IsPresentInGame(species, form))
|
|
return;
|
|
|
|
var p = pt.GetFormEntry(species, form);
|
|
var row = new DataGridViewRow();
|
|
row.CreateCells(DGV);
|
|
var cells = row.Cells;
|
|
int c = 0;
|
|
|
|
var bst = p.GetBaseStatTotal();
|
|
cells[c++].Value = species.ToString(pt.MaxSpeciesID > 999 ? "0000" : "000") + (form > 0 ? $"-{form:00}" : "");
|
|
cells[c++].Value = SpriteUtil.GetSprite(species, form, 0, 0, 0, false, Shiny.Never, SAV.Context);
|
|
cells[c++].Value = name;
|
|
cells[c++].Value = GetIsNative(p, species);
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStatTotal(bst);
|
|
cells[c++].Value = bst.ToString("000");
|
|
cells[c++].Value = p.CatchRate.ToString("000");
|
|
cells[c++].Value = TypeSpriteUtil.GetTypeSpriteWide(p.Type1, SAV.Generation);
|
|
cells[c++].Value = p.Type1 == p.Type2 ? SpriteUtil.Spriter.Transparent : TypeSpriteUtil.GetTypeSpriteWide(p.Type2, SAV.Generation);
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.HP);
|
|
cells[c++].Value = p.HP.ToString("000");
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.ATK);
|
|
cells[c++].Value = p.ATK.ToString("000");
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.DEF);
|
|
cells[c++].Value = p.DEF.ToString("000");
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.SPA);
|
|
cells[c++].Value = p.SPA.ToString("000");
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.SPD);
|
|
cells[c++].Value = p.SPD.ToString("000");
|
|
cells[c].Style.BackColor = ColorUtil.ColorBaseStat(p.SPE);
|
|
cells[c++].Value = p.SPE.ToString("000");
|
|
var abils = p.AbilityCount;
|
|
cells[c++].Value = abilities[abils > 0 ? p.GetAbilityAtIndex(0) : 0];
|
|
cells[c++].Value = abilities[abils > 1 ? p.GetAbilityAtIndex(1) : 0];
|
|
cells[c].Value = abilities[abils > 2 ? p.GetAbilityAtIndex(2) : 0];
|
|
|
|
row.Height = SpriteUtil.Spriter.Height + 1;
|
|
DGV.Rows.Add(row);
|
|
}
|
|
|
|
private static bool GetIsNative(IPersonalInfo personalInfo, ushort s) => personalInfo switch
|
|
{
|
|
PersonalInfo7 => s > 721 || Legal.PastGenAlolanNatives.Contains(s),
|
|
PersonalInfo8SWSH ss => ss.IsInDex,
|
|
PersonalInfo8BDSP bs => bs.IsInDex,
|
|
PersonalInfo8LA bs => bs.IsPresentInGame,
|
|
PersonalInfo9SV sv => sv.IsInDex,
|
|
_ => true,
|
|
};
|
|
}
|