mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-25 11:53:11 +00:00
37cb15749e
Disassociate pk4/pk6 backing byte[] when converting to pk5|pk7, as we no longer make a copy of the byte[] in the pkm's constructor. Change UpdatePKM to include isParty, as we want it optional to update FormArgument too. Change FormArgument saving to be handled by FormConverter; kinda not really good to have it there, but nothing else is handling FormArgument values. Expand IFormArgument to have all FormArgument values exposed. "Maximum" is furfrou only. PK6: Max is in the "FormArgument" u32, and the remain/elapsed is in party stats (hence the reverting when boxed) PK7: u8 remain, u8 elapsed, u8 max, u8 unused. PK8: assumedly the same as PK7, given the disassembly hints that it's the same as past games (even though Furfrou and Hoopa are not in SWSH).
57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System;
|
|
using PKHeX.Core;
|
|
|
|
namespace PKHeX.WinForms.Controls
|
|
{
|
|
public partial class PKMEditor
|
|
{
|
|
private void PopulateFieldsPK6()
|
|
{
|
|
if (Entity is not PK6 pk6)
|
|
throw new FormatException(nameof(Entity));
|
|
|
|
LoadMisc1(pk6);
|
|
LoadMisc2(pk6);
|
|
LoadMisc3(pk6);
|
|
LoadMisc4(pk6);
|
|
LoadMisc6(pk6);
|
|
|
|
CB_EncounterType.SelectedValue = pk6.Gen4 ? pk6.EncounterType : 0;
|
|
CB_EncounterType.Visible = Label_EncounterType.Visible = pk6.Gen4;
|
|
|
|
LoadPartyStats(pk6);
|
|
UpdateStats();
|
|
}
|
|
|
|
private PK6 PreparePK6()
|
|
{
|
|
if (Entity is not PK6 pk6)
|
|
throw new FormatException(nameof(Entity));
|
|
|
|
SaveMisc1(pk6);
|
|
SaveMisc2(pk6);
|
|
SaveMisc3(pk6);
|
|
SaveMisc4(pk6);
|
|
SaveMisc6(pk6);
|
|
CheckTransferPIDValid(pk6);
|
|
|
|
pk6.EncounterType = WinFormsUtil.GetIndex(CB_EncounterType);
|
|
|
|
// Toss in Party Stats
|
|
SavePartyStats(pk6);
|
|
|
|
// Unneeded Party Stats (Status, Flags, Unused)
|
|
pk6.Data[0xE8] = pk6.Data[0xE9] = pk6.Data[0xEA] = pk6.Data[0xEB] =
|
|
pk6.Data[0xEF] =
|
|
pk6.Data[0xFE] = pk6.Data[0xFF] = pk6.Data[0x100] =
|
|
pk6.Data[0x101] = pk6.Data[0x102] = pk6.Data[0x103] = 0;
|
|
|
|
pk6.FixMoves();
|
|
pk6.FixRelearn();
|
|
if (ModifyPKM)
|
|
pk6.FixMemories();
|
|
pk6.RefreshChecksum();
|
|
return pk6;
|
|
}
|
|
}
|
|
}
|