Skip to content

Commit

Permalink
Update from .NET Framework 4.6 to .NET 7 (#3729)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
kwsch authored Jan 22, 2023
1 parent 4265407 commit 88830e0
Show file tree
Hide file tree
Showing 916 changed files with 17,045 additions and 14,202 deletions.
8 changes: 2 additions & 6 deletions .github/README-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ PKHeX erwartet entschlüsselte Spielstände. Da diese konsolenspezifisch verschl

## Erstellen

PKHeX ist eine Windows Forms Anwendung, die das [.NET Framework v4.6](https://www.microsoft.com/de-de/download/details.aspx?id=48137) benötigt, mit experimenteller Unterstützung für [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0).
PKHeX ist eine Windows Forms Anwendung, die das [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0).

Die Anwendung kann mit jedem Kompiler erstellt werden, der C# 10 unterstützt.
Die Anwendung kann mit jedem Kompiler erstellt werden, der C# 11 unterstützt.

### Erstell Konfiguration

Expand All @@ -47,7 +47,3 @@ PKHeXs Pokémon Legends: Arceus Sprites kommen vom [National Pokédex - Icon Dex
### IDE

PKHeX kann mit IDEs wie [Visual Studio](https://visualstudio.microsoft.com/de/downloads/) durch das Öffnen der .sln oder .csproj Dateien geöffnet werden.

### GNU/Linux

Da GNU/Linux nicht das Hauptbetriebssystem der PKHeX Entwickler ist können Bugs auftreten. Manche kommen möglicherweise von GNU/Linux spezifischem Code in Mono/Wine und können deshalb nicht von jedem reproduziert werden kann.
10 changes: 3 additions & 7 deletions .github/README-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ La interfaz gráfica puede ser traducida con archivos de texto externos para dar

Pokémon Showdown asigna un código QR que puede ser importado/exportado para ayudar al compartir.

PKHeX espera archivos de guardado que no estén cifrados con las claves específicas de la consola. Use un gestor de archivos de guardado para importar y exportar información de la consola ([Checkpoint](https://github.com/FlagBrew/Checkpoint), save_manager, [JKSM](https://github.com/J-D-K/JKSM), o SaveDataFiler).
PKHeX espera archivos de guardado que no estén cifrados con las claves específicas de la consola. Use un gestor de archivos de guardado para importar y exportar información de la consola ([Checkpoint](https://github.com/FlagBrew/Checkpoint) o [JKSM](https://github.com/J-D-K/JKSM)).

**No apoyamos ni toleramos las trampas a expensas de otros. No uses un Pokémon modificado significativamente en batalla o en intercambios con quienes no estén al tanto de que estás usando un Pokémon modificado.**

Expand All @@ -28,9 +28,9 @@ PKHeX espera archivos de guardado que no estén cifrados con las claves específ

## Building

PKHeX es una aplicación de Windows Forms que requiere [.NET Framework v4.6](https://www.microsoft.com/es-es/download/details.aspx?id=48137), con soporte experimental para [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0).
PKHeX es una aplicación de Windows Forms que requiere [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0).

El archivo ejecutable puede ser construido con cualquier compilador que soporte C# 10.
El archivo ejecutable puede ser construido con cualquier compilador que soporte C# 11.

### Configuraciones del Build

Expand All @@ -47,7 +47,3 @@ PKHeX's Pokémon Legends: Arceus sprite collection is taken from the [National P
### IDE

PKHeX se puede abrir con un IDE como [Visual Studio](https://visualstudio.microsoft.com/es/downloads/), abriendo los archivos .sln o .csproj.

### GNU/Linux

GNU/Linux no es el sistema operativo principal de los desarrolladores de este proyecto, así que probablemente haya errores o bugs; de los cuales algunos pueden provenir de código no específico de GNU/Linux desde Mono o de Wine, con lo cual puede haber otros usuarios que no puedan reproducir ese error.
10 changes: 3 additions & 7 deletions .github/README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Les données sont affichées dans une vue qui peut être modifiée et enregistr

Les ensembles Pokémon Showdown et les QR codes peuvent être importés/exportés pour faciliter le partage.

PKHeX attend des fichiers de sauvegarde qui ne sont pas chiffrés avec des clés spécifiques à la console. Utilisez un gestionnaire de données enregistrées pour importer et exporter des données enregistrées à partir de la console ([Checkpoint](https://github.com/FlagBrew/Checkpoint), save_manager, [JKSM](https://github.com/J-D-K/JKSM) ou SaveDataFiler).
PKHeX attend des fichiers de sauvegarde qui ne sont pas chiffrés avec des clés spécifiques à la console. Utilisez un gestionnaire de données enregistrées pour importer et exporter des données enregistrées à partir de la console ([Checkpoint](https://github.com/FlagBrew/Checkpoint) ou [JKSM](https://github.com/J-D-K/JKSM)).

**Nous ne soutenons ni ne tolérons la tricherie aux dépens des autres. N'utilisez pas de Pokémon piratés de manière significative au combat ou dans des échanges avec ceux qui ne savent pas que des Pokémon piratés sont en cours d'utilisation.**

Expand All @@ -27,9 +27,9 @@ PKHeX attend des fichiers de sauvegarde qui ne sont pas chiffrés avec des clés

## Construction

PKHeX est une application Windows Forms qui nécessite [.NET Framework v4.6](https://www.microsoft.com/fr-fr/download/details.aspx?id=48137), avec une prise en charge expérimentale de [.NET 6.0.](https://dotnet.microsoft.com/download/dotnet/6.0)
PKHeX est une application Windows Forms qui nécessite [.NET 7.0.](https://dotnet.microsoft.com/download/dotnet/7.0)

L'exécutable peut être construit avec n'importe quel compilateur prenant en charge C# 10.
L'exécutable peut être construit avec n'importe quel compilateur prenant en charge C# 11.

### Construire les configurations

Expand All @@ -46,7 +46,3 @@ PKHeX's Pokémon Legends: Arceus sprite collection is taken from the [National P
## IDE

PKHeX peut être ouvert avec des IDE tels que [Visual Studio](https://visualstudio.microsoft.com/fr/downloads/) en ouvrant le fichier .sln ou .csproj.

## GNU/Linux

GNU/Linux n'est pas le système d'exploitation principal des développeurs de ce programme, il peut donc y avoir des bugues; certains peuvent provenir de code non spécifique à GNU/Linux de Mono/Wine, donc d'autres utilisateurs peuvent ne pas être en mesure de reproduire l'erreur que vous rencontrez.
10 changes: 3 additions & 7 deletions .github/README-it.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ L'interfaccia può essere tradotta con risorse/file di testo esterni, così che

Set di Pokémon Showdown e QR Code possono essere importati/esportati per agevolare la condivisione di file.

PKHeX si aspetta file di salvataggio non criptati con le chiavi specifiche della console. È possibile usare un gestore di salvataggi per importare ed esportare dati di salvataggio dalla console ([Checkpoint](https://github.com/FlagBrew/Checkpoint), save_manager, [JKSM](https://github.com/J-D-K/JKSM), o SaveDataFiler).
PKHeX si aspetta file di salvataggio non criptati con le chiavi specifiche della console. È possibile usare un gestore di salvataggi per importare ed esportare dati di salvataggio dalla console ([Checkpoint](https://github.com/FlagBrew/Checkpoint) o [JKSM](https://github.com/J-D-K/JKSM)).

**Non supportiamo e non perdoniamo l'utilizzo di cheat a scapito di altri giocatori. Non utilizzare Pokémon modificati significativamente in lotte o scambi con giocatori che non ne sono a conoscenza.**

Expand All @@ -28,9 +28,9 @@ PKHeX si aspetta file di salvataggio non criptati con le chiavi specifiche della

## Building

PKHeX è un applicazione Windows Form e necessita [.NET Framework v4.6](https://www.microsoft.com/it-it/download/details.aspx?id=48137), con supporto sperimentale per [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0).
PKHeX è un applicazione Windows Form e necessita [.NET Framework 7.0](https://dotnet.microsoft.com/download/dotnet/7.0).

L'eseguibile può essere compilato con qualsiasi compiler che supporti C# 10.
L'eseguibile può essere compilato con qualsiasi compiler che supporti C# 11.

### Configurazioni di Build

Expand All @@ -47,7 +47,3 @@ La collezione di sprite per Leggende Pokémon: Arceus è presa dal [National Pok
### IDE

PKHeX può essere aperto con IDE come [Visual Studio](https://visualstudio.microsoft.com/it/downloads/) aprendo il file .sln o il file .csproj.

### GNU/Linux

GNU/Linux non è il Sistema Operativo principale dei developer di questo programma, quindi potrebbero esserci bug; alcuni potrebbero provenire da codice GNU/Linux non specifico da Mono/Wine, per cui alcuni utenti potrebbero non essere in grado di riprodurre l'errore riscontrato.
8 changes: 2 additions & 6 deletions .github/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ PKHeX 所读取存档文件必须是未经主机唯一密钥加密,因此请

## 构建

PKHeX 是 Windows 窗口应用程序,依赖于 [.NET Framework v4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48137) 而运行,同时具有对 .[NET 6.0](https://www.microsoft.com/en-us/download/details.aspx?id=48137) 的实验性支持
PKHeX 是 Windows 窗口应用程序,依赖于 [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0)

可以使用任何支持 C# 10 的编译器生成可执行文件。
可以使用任何支持 C# 11 的编译器生成可执行文件。

### 构建配置

Expand All @@ -46,7 +46,3 @@ PKHeX 的“宝可梦传说:阿尔宙斯”精灵图片集来源于 [National
### IDE

PKHeX 可以通过打开 .sln 或 .csproj 文件来使用 [Visual Studio](https://visualstudio.microsoft.com/downloads/) 等 IDE 打开。

### GNU/Linux

GNU/Linux 非本程序开发人员主要操作系统,因此在 GNU/Linux 平台上运行本程序时可能存在 Bug; 部分 Bug 可能来自于 Mono/Wine 等非 GNU/Linux 特定源代码,因而其他使用者可能无法复现你所遇到的 Bug。
10 changes: 3 additions & 7 deletions .github/README-zhHK.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PKHeX

可匯入/匯出 配置資訊及 QR 碼以便進行共有分享。

PKHeX 所讀取檔案須未經主機唯一密鑰加密,因而請使用儲存資料管理軟體(如 [Checkpoint](https://github.com/FlagBrew/Checkpoint)save_manager, [JKSM](https://github.com/J-D-K/JKSM), 抑或是 SaveDataFiler)以從主機中匯入匯出儲存資料 .
PKHeX 所讀取檔案須未經主機唯一密鑰加密,因而請使用儲存資料管理軟體(如 [Checkpoint](https://github.com/FlagBrew/Checkpoint)[JKSM](https://github.com/J-D-K/JKSM))以從主機中匯入匯出儲存資料 .

**我們反對亦不會縱容透過作弊手段損害他人利益之行為。切勿將魔法寶可夢用於對戰,或連線交換至不知情之訓練家手中。**

Expand All @@ -28,9 +28,9 @@ PKHeX 所讀取檔案須未經主機唯一密鑰加密,因而請使用儲存

## 構建

PKHeX 係 Windows 窗體應用程式,其須依賴於 [.NET Framework v4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48137) 而運行,同時本程式亦實驗式地支援 [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0)
PKHeX 係 Windows 窗體應用程式,其須依賴於 [.NET Framework 7.0](https://dotnet.microsoft.com/download/dotnet/7.0)

程式可透過任意支援 C# 10 之編譯器構建。
程式可透過任意支援 C# 11 之編譯器構建。

### 構建配置

Expand All @@ -46,7 +46,3 @@ PKHeX 之「寶可夢傳説:阿爾宙斯」精靈圖示集合庫來源於 [Nat
### IDE

PKHeX 可透過如 [Visual Studio](https://visualstudio.microsoft.com/downloads/) 等各類 IDE ,開啓 .sln 或 .csproj 檔案以打開。

### GNU/Linux

GNU/Linux 非本程式開發者主要作業系統,因而於 GNU/Linux 平臺上運行本程式時可能存在 Bug; 部分 Bug 亦可能由 Mono/Wine 等非 GNU/Linux 特定源代碼所引入,因而其他使用者可能無法復現你所遇到之 Bug。
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>22.12.18</Version>
<LangVersion>10</LangVersion>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<NeutralLanguage>en</NeutralLanguage>
<Product>PKHeX</Product>
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/Editing/Applicators/BallApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static int GetCircularOnce<T>(T[] items, T current, Span<T> result)
result[ctr++] = items[i];
return ctr;
}

private static readonly Ball[] BallList = (Ball[])Enum.GetValues(typeof(Ball));
private static int MaxBallSpanAlloc => BallList.Length;

Expand Down
44 changes: 29 additions & 15 deletions PKHeX.Core/Editing/Applicators/CatchRateApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,49 @@ namespace PKHeX.Core;
/// </summary>
public static class CatchRateApplicator
{
public static int GetSuggestedCatchRate(PK1 pk1, SaveFile sav)
/// <summary>
/// Gets the suggested <see cref="PK1.Catch_Rate"/> for the entity.
/// </summary>
public static int GetSuggestedCatchRate(PK1 pk, SaveFile sav)
{
var la = new LegalityAnalysis(pk1);
return GetSuggestedCatchRate(pk1, sav, la);
var la = new LegalityAnalysis(pk);
return GetSuggestedCatchRate(pk, sav, la);
}

public static byte GetSuggestedCatchRate(PK1 pk1, SaveFile sav, LegalityAnalysis la)
/// <summary>
/// Gets the suggested <see cref="PK1.Catch_Rate"/> for the entity.
/// </summary>
public static byte GetSuggestedCatchRate(PK1 pk, SaveFile sav, LegalityAnalysis la)
{
// If it is already valid, just use the current value.
if (la.Valid)
return pk1.Catch_Rate;
return pk.Catch_Rate;

// If it has ever visited generation 2, the Held Item can be removed prior to trade back.
if (la.Info.Generation == 2)
return 0;

var v = la.EncounterMatch;
switch (v)
// Return the encounter's original value.
var enc = la.EncounterMatch;
switch (enc)
{
case EncounterTrade1 c:
return c.GetInitialCatchRate();
case EncounterStatic1E { Version: GameVersion.Stadium, Species: (int)Species.Psyduck}:
return pk1.Japanese ? (byte)167 : (byte)168; // Amnesia Psyduck has different catch rates depending on language
return pk.Japanese ? (byte)167 : (byte)168; // Amnesia Psyduck has different catch rates depending on language
default:
{
if (sav.Version.Contains(v.Version) || v.Version.Contains(sav.Version))
return (byte)sav.Personal[v.Species].CatchRate;
if (!GameVersion.RB.Contains(v.Version))
return (byte)PersonalTable.Y[v.Species].CatchRate;
return (byte)PersonalTable.RB[v.Species].CatchRate;
}
var pt = GetPersonalTable(sav, enc);
var pi = pt[enc.Species];
return (byte)pi.CatchRate;
}
}

private static PersonalTable1 GetPersonalTable(SaveFile sav, IEncounterable v)
{
if (sav.Personal is PersonalTable1 pt && (sav.Version.Contains(v.Version) || v.Version.Contains(sav.Version)))
return pt;
if (!GameVersion.RB.Contains(v.Version))
return PersonalTable.Y;
return PersonalTable.RB;
}
}
4 changes: 2 additions & 2 deletions PKHeX.Core/Editing/Applicators/GenderApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static void SetSaneGender(this PKM pk, int gender)
/// <param name="gender">Desired <see cref="PKM.Gender"/> value to set.</param>
public static void SetGender(this PKM pk, int gender)
{
gender = Math.Min(2, Math.Max(0, gender));
gender = Math.Clamp(gender, 0, 2);
if (pk.Gender == gender)
return;

Expand All @@ -52,7 +52,7 @@ public static void SetGender(this PKM pk, int gender)
/// <returns>Most-legal <see cref="PKM.Gender"/> value</returns>
public static int GetSaneGender(this PKM pk)
{
int gt = pk.PersonalInfo.Gender;
var gt = pk.PersonalInfo.Gender;
switch (gt)
{
case PersonalInfo.RatioMagicGenderless: return 2;
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/Editing/Applicators/MoveSetApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static ushort[] GetMoveSet(this LegalityAnalysis la, bool random = false)

const int count = 4;
if (m.Length > count)
return m.AsSpan(m.Length - count).ToArray();
return m[^count..];
Array.Resize(ref m, count);
return m;
}
Expand Down
Loading

0 comments on commit 88830e0

Please sign in to comment.