Fix Trainer/Item Info dumps

Game Freak left in DLC 2 item data, so we should only iterate on items with names present.
This commit is contained in:
sora10pls
2020-06-21 22:24:59 -04:00
parent b719ca17ee
commit b52cc87c5a
4 changed files with 6 additions and 4 deletions

View File

@@ -1,4 +1,3 @@
using Newtonsoft.Json;
using System.Collections.Generic;
namespace pkNX.Structures

View File

@@ -42,7 +42,7 @@ public static string GetNamedTypeTable<T>(IList<T> arr, IList<string> names, str
list[0] = $"Index{sep}{name ?? t.Name}{sep}{list[0]}";
// slap in row name to row
for (int i = 1; i < list.Length; i++)
for (int i = 1; i < names.Count + 1; i++)
list[i] = $"{i - 1}{sep}{names[i - 1]}{sep}{list[i]}";
return string.Join(Environment.NewLine, list);

View File

@@ -179,8 +179,8 @@ public void DumpTrainers()
var t = tr[i];
// some battles with Avery and Klara have out of bounds trclasses -- set back to "Pokémon Trainer"
if (t.Self.Class == 250 || t.Self.Class == 251)
t.Self.Class = 219;
if (t.Self.Class > trc.Length)
t.Self.Class = 1;
result.Add($"{i:000} - {trc[t.Self.Class]}: {trn[i]}");
const int MoneyScalar = 80;

View File

@@ -478,6 +478,9 @@ private string GetTrainerString(VsTrainer Trainer)
var name = Trainer.Name;
var team = Trainer.Team;
var sb = new StringBuilder();
if (tr.Class > trClass.Length) // Klara and Avery out of bounds trclass edge case
tr.Class = 1;
sb.AppendLine("======");
sb.Append(file).Append(" - ").Append(trClass[tr.Class]).Append(" ").AppendLine(name);
sb.AppendLine("======");