Add size export for new raids

This commit is contained in:
Kurt
2023-02-27 09:57:21 -08:00
parent 0dbcad184e
commit e34701b893
4 changed files with 25 additions and 14 deletions

View File

@@ -59,33 +59,35 @@ public List<string> 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<string> lines, PersonalTable9SV table, ushort species, byte form)
public void AddDump(List<string> 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<string> lines, PersonalInfo9SV pi, int entry, string name, int species, int form)
private void AddDump(List<string> 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<string> 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,

View File

@@ -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++)

View File

@@ -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

View File

@@ -293,6 +293,8 @@ private static void AddToList(IReadOnlyCollection<DeliveryRaidEnemyTable> 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);