mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-06 12:55:45 -05:00
Fix nest dumping, improve ahtb dumping
This commit is contained in:
parent
0b38bee882
commit
e4580ea7e9
|
|
@ -53,14 +53,14 @@ IEnumerable<string> Summary(EncounterNest8 e)
|
|||
int max = e.MaxRank;
|
||||
|
||||
int curMin = -1;
|
||||
for (int i = min; i < max; i++)
|
||||
for (int i = min; i >= 0 && i <= max; i++)
|
||||
{
|
||||
if (e.Probabilities[i] != 0)
|
||||
{
|
||||
if (curMin == -1)
|
||||
curMin = i;
|
||||
|
||||
if (i == max - 1)
|
||||
if (i == max)
|
||||
yield return $" new EncounterStatic8N(Nest{index:00},{curMin},{i},{flawless}) {{ Species = {e.Species:000}, Ability = {ability}{gender}{altform}{giga} }},{comment}";
|
||||
}
|
||||
else if (curMin != -1)
|
||||
|
|
|
|||
|
|
@ -9,14 +9,16 @@ public static class EncounterTable8Util
|
|||
{
|
||||
public static byte[][] GetBytes(IReadOnlyDictionary<ulong, byte> zone_loc, EncounterArchive8 t)
|
||||
{
|
||||
var result = new byte[t.EncounterTables.Length][];
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
var result = new List<byte[]>();
|
||||
for (int i = 0; i < t.EncounterTables.Length; i++)
|
||||
{
|
||||
var zone = t.EncounterTables[i];
|
||||
result[i] = GetZoneBytes(zone, zone_loc);
|
||||
var entry = GetZoneBytes(zone, zone_loc);
|
||||
if (entry.Length != 0)
|
||||
result.Add(entry);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
private static byte[] GetZoneBytes(EncounterTable8 zone, IReadOnlyDictionary<ulong, byte> zoneLoc)
|
||||
|
|
|
|||
|
|
@ -114,6 +114,25 @@ public void DumpAHTB()
|
|||
}
|
||||
}
|
||||
|
||||
var paks = Directory.EnumerateFiles(ROM.PathRomFS, "*", SearchOption.AllDirectories)
|
||||
.Where(z => Path.GetExtension(z) == ".gfpak");
|
||||
foreach (var f in paks)
|
||||
{
|
||||
var pak = new GFPack(f);
|
||||
foreach (var bytes in pak.DecompressedFiles)
|
||||
{
|
||||
if (AHTB.IsAHTB(bytes))
|
||||
{
|
||||
var tbl = new AHTB(bytes);
|
||||
var summaries = tbl.Summary;
|
||||
foreach (var t in tbl.ShortSummary)
|
||||
result.Add(t);
|
||||
list.Add(Path.GetFileName(f));
|
||||
list.AddRange(summaries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var outname = GetPath("ahtb.txt");
|
||||
var outname2 = GetPath("ahtblist.txt");
|
||||
File.WriteAllLines(outname, result);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user