diff --git a/pkNX.Structures.FlatBuffers/Dumpers/PersonalDumperSV.cs b/pkNX.Structures.FlatBuffers/Dumpers/PersonalDumperSV.cs index 0f12cb6d..55a7feb7 100644 --- a/pkNX.Structures.FlatBuffers/Dumpers/PersonalDumperSV.cs +++ b/pkNX.Structures.FlatBuffers/Dumpers/PersonalDumperSV.cs @@ -59,33 +59,35 @@ public List Dump(PersonalTable9SV table) for (ushort species = 0; species <= table.MaxSpeciesID; species++) { - var spec = table[species]; - for (byte form = 0; form < spec.FormCount; form++) - AddDump(lines, table, species, form); + var pi = table[species]; + var specInternal = SpeciesConverterSV.GetInternal9(species); + for (byte form = 0; form < pi.FormCount; form++) + AddDump(lines, table, specInternal, species, form); } return lines; } - private string GetSpeciesName(ushort nationalIndex) => Species[nationalIndex]; + private string GetSpeciesName(ushort internalIndex) => Species[internalIndex]; - public void AddDump(List lines, PersonalTable9SV table, ushort species, byte form) + public void AddDump(List lines, PersonalTable9SV table, ushort speciesInternal, ushort species, byte form) { var index = table.GetFormIndex(species, form); var entry = table[index]; - string name = GetSpeciesName(species); + string name = GetSpeciesName(speciesInternal); if (form != 0) name += $"-{form}"; if (entry.FB.Dex is { } dex) name += $" #{dex.Index:000}"; - AddDump(lines, entry, index, name, species, form); + AddDump(lines, entry, index, name, speciesInternal, form); } - private void AddDump(List lines, PersonalInfo9SV pi, int entry, string name, int species, int form) + private void AddDump(List lines, PersonalInfo9SV pi, int entry, string name, ushort speciesInternal, byte form) { if (pi is { IsPresentInGame: false }) return; - var specCode = pi.FormCount > 1 ? $"{Species[species]}-{form}" : $"{Species[species]}"; + var specName = GetSpeciesName(speciesInternal); + var specCode = pi.FormCount > 1 ? $"{specName}-{form}" : $"{specName}"; if (Settings.Stats) AddPersonalLines(lines, pi, entry, name, specCode); @@ -177,7 +179,7 @@ private void AddEvolutions(PersonalInfo9SVfb fb, List lines) var method = (EvolutionType)z.Method; string arg = GetArgTypeDisplayValue(method, z.Argument); - var line = $"Evolves into {Species[z.SpeciesInternal]}-{z.Form} @ lv{z.Level} ({method}) [{arg}]"; + var line = $"Evolves into {GetSpeciesName(z.SpeciesInternal)}-{z.Form} @ lv{z.Level} ({method}) [{arg}]"; lines.Add(line); } } @@ -199,7 +201,7 @@ private string GetArgTypeDisplayValue(EvolutionType type, ushort value) EvolutionTypeArgumentType.NoArg => value.ToString(), EvolutionTypeArgumentType.Items => Items[value], EvolutionTypeArgumentType.Moves => Moves[value], - EvolutionTypeArgumentType.Species => Species[value], + EvolutionTypeArgumentType.Species => GetSpeciesName(value), EvolutionTypeArgumentType.Type => Types[value], //EvolutionTypeArgumentType.Stat => expr, //EvolutionTypeArgumentType.Version => expr, diff --git a/pkNX.Structures.FlatBuffers/Gen9/Personal/Wrapper/PersonalTable9SV.cs b/pkNX.Structures.FlatBuffers/Gen9/Personal/Wrapper/PersonalTable9SV.cs index 2546d860..b5aa6f6e 100644 --- a/pkNX.Structures.FlatBuffers/Gen9/Personal/Wrapper/PersonalTable9SV.cs +++ b/pkNX.Structures.FlatBuffers/Gen9/Personal/Wrapper/PersonalTable9SV.cs @@ -28,12 +28,12 @@ public PersonalTable9SV(IFileContainer file) var formGrouped = Root.Table .GroupBy(x => x.Info.SpeciesNational) - .Select(group => group).ToArray(); - formGrouped = SpeciesConverterSV.GetRearrangedAsNational(formGrouped); + .OrderBy(x => x.Key).ToArray(); for (int i = 0; i <= MaxSpecies; i++) { - var forms = formGrouped[i].ToArray(); + var item = formGrouped[i]; + var forms = item.ToArray(); baseForms[i] = GetObj(forms[0], forms, MaxSpecies, formTable); for (int f = 1; f < forms.Length; f++) diff --git a/pkNX.Structures.FlatBuffers/Gen9/Raid/DeliveryRaidEnemyTableArray.cs b/pkNX.Structures.FlatBuffers/Gen9/Raid/DeliveryRaidEnemyTableArray.cs index d30a960e..099030b3 100644 --- a/pkNX.Structures.FlatBuffers/Gen9/Raid/DeliveryRaidEnemyTableArray.cs +++ b/pkNX.Structures.FlatBuffers/Gen9/Raid/DeliveryRaidEnemyTableArray.cs @@ -61,6 +61,13 @@ public void SerializePKHeX(BinaryWriter bw, byte star, sbyte rate, RaidSerializa bw.Write(rate); } + public void SerializeType2(BinaryWriter bw) + { + var b = BossPokePara; + bw.Write((byte)b.ScaleType); + bw.Write((byte)b.ScaleValue); + } + public void SerializeType3(BinaryWriter bw) { // Fixed Nature, fixed IVs, fixed Scale diff --git a/pkNX.WinForms/Dumping/TeraRaidRipper.cs b/pkNX.WinForms/Dumping/TeraRaidRipper.cs index 16f396e6..facd0358 100644 --- a/pkNX.WinForms/Dumping/TeraRaidRipper.cs +++ b/pkNX.WinForms/Dumping/TeraRaidRipper.cs @@ -293,6 +293,8 @@ private static void AddToList(IReadOnlyCollection table, bw.Write(noTotal ? (ushort)0 : totalS[stage]); bw.Write(noTotal ? (ushort)0 : totalV[stage]); } + if (format == RaidSerializationFormat.Type2) + enc.SerializeType2(bw); if (format == RaidSerializationFormat.Type3) enc.SerializeType3(bw);