Add index to dumped bcat nests

This commit is contained in:
Kurt
2021-04-18 12:02:30 -07:00
parent 1dad93d7c5
commit e772a99341
2 changed files with 10 additions and 5 deletions

View File

@@ -111,20 +111,21 @@ string GetItemName(uint itemID)
}
}
public IEnumerable<string> GetSummary(IReadOnlyList<string> species)
public IEnumerable<string> GetSummary(IReadOnlyList<string> species, int index)
{
foreach (var entry in Entries)
{
if (entry.Exists)
yield return Summary(entry);
yield return Summary(entry, index);
}
yield return string.Empty;
string Summary(NestHoleDistributionEncounter8 e)
string Summary(NestHoleDistributionEncounter8 e, int index)
{
var comment = $" // {species[e.Species]}{(e.AltForm == 0 ? string.Empty : "-" + e.AltForm)}";
var gender = e.Gender == 0 ? string.Empty : $", Gender = {e.Gender - 1}";
var altform = e.AltForm == 0 ? string.Empty : $", Form = {e.AltForm}";
var istr = $", Index = {index}";
var giga = !e.IsGigantamax ? string.Empty : ", CanGigantamax = true";
var moves = $", Moves = new[]{{ {e.Move0:000}, {e.Move1:000}, {e.Move2:000}, {e.Move3:000} }}";
var shiny = e.ShinyLock switch
@@ -153,7 +154,7 @@ string Summary(NestHoleDistributionEncounter8 e)
throw new Exception();
}
var flawless = e.FlawlessIVs;
var line = $" new({e.Level:00},{e.DynamaxLevel:00},{flawless}) {{ Species = {e.Species:000}, Ability = {ability}{moves}{gender}{altform}{giga}{shiny} }},{comment}";
var line = $" new({e.Level:00},{e.DynamaxLevel:00},{flawless}) {{ Species = {e.Species:000}, Ability = {ability}{moves}{istr}{gender}{altform}{giga}{shiny} }},{comment}";
if (e.Field_13 == 6 && e.Field_14 == 6)
line = line.Insert(12, "//").Remove(10, 2); // comment out uncatchable encounters
return line;

View File

@@ -541,6 +541,10 @@ public void DumpDistributionNestEntries(string path)
var dist_bonus = FlatBufferConverter.DeserializeFrom<NestHoleDistributionReward8Archive>(bonus_data);
var dai_encounts = FlatBufferConverter.DeserializeFrom<NestHoleCrystalEncounter8Archive>(dai_data);
int index = dai_data[0];
System.Diagnostics.Debug.Assert(dai_data[0] == drop_data[0] && dai_data[0] == bonus_data[0], "BCAT Index should be the same for all files!");
DumpDistIfExists("normal_encount", "");
DumpDistIfExists("normal_encount_rigel1", "Armor");
DumpDistIfExists("normal_encount_rigel2", "Crown");
@@ -571,7 +575,7 @@ void DumpDistIfExists(string filePath, string dest)
foreach (var game in new[] { 1, 2 })
{
var tables = encounts.Tables.Where(z => z.GameVersion == game).ToList();
var encounters = tables.SelectMany(z => z.GetSummary(speciesNames)).ToArray();
var encounters = tables.SelectMany(z => z.GetSummary(speciesNames, index)).ToArray();
var path1 = GetPath($"nestDistHex{game}.txt");
File.WriteAllLines(path1, encounters);