Add text file enum

Also defined max species ID
This commit is contained in:
Kaphotics
2016-10-30 10:10:57 -07:00
parent 2f802aca13
commit 8c713d3217
26 changed files with 158 additions and 106 deletions

View File

@@ -77,11 +77,12 @@ private void getGameData(GameVersion game)
public GARCReference getGARC(string name) { return Files.FirstOrDefault(f => f.Name == name); }
public TextVariableCode getVariableCode(string name) { return Variables.FirstOrDefault(v => v.Name == name); }
public TextVariableCode getVariableName(int value) { return Variables.FirstOrDefault(v => v.Code == value); }
public TextReference getGameText(string name) { return GameText.FirstOrDefault(f => f.Name == name); }
public TextReference getGameText(TextName name) { return GameText.FirstOrDefault(f => f.Name == name); }
public bool XY => Version == GameVersion.XY;
public bool ORAS => Version == GameVersion.ORAS || Version == GameVersion.ORASDEMO;
public bool SM => Version == GameVersion.SM || Version == GameVersion.SMDEMO;
public int MaxSpeciesID => XY || ORAS ? 722 : 802;
public bool IsRebuildable(int fileCount)
{
switch (fileCount)

View File

@@ -1,10 +1,32 @@
namespace pk3DS
{
public enum TextName
{
AbilityNames,
MoveNames,
MoveFlavor,
ItemNames,
ItemFlavor,
SpeciesNames,
Types,
Natures,
Forms,
TrainerNames,
TrainerClasses,
TrainerText,
metlist_000000,
OPowerFlavor,
MaisonTrainerNames,
SuperTrainerNames
}
public class TextReference
{
public readonly int Index;
public readonly string Name;
private TextReference(int index, string name)
public readonly TextName Name;
private TextReference(int index, TextName name)
{
Index = index;
Name = name;
@@ -12,11 +34,41 @@ private TextReference(int index, string name)
public static readonly TextReference[] GameText_XY =
{
new TextReference(005, TextName.Forms),
new TextReference(013, TextName.MoveNames),
new TextReference(015, TextName.MoveFlavor),
new TextReference(017, TextName.Types),
new TextReference(020, TextName.TrainerClasses),
new TextReference(021, TextName.TrainerNames),
new TextReference(022, TextName.TrainerText),
new TextReference(034, TextName.AbilityNames),
new TextReference(047, TextName.Natures),
new TextReference(072, TextName.metlist_000000),
new TextReference(080, TextName.SpeciesNames),
new TextReference(096, TextName.ItemNames),
new TextReference(099, TextName.ItemFlavor),
new TextReference(130, TextName.MaisonTrainerNames),
new TextReference(131, TextName.SuperTrainerNames),
new TextReference(141, TextName.OPowerFlavor),
};
public static readonly TextReference[] GameText_AO =
{
new TextReference(005, TextName.Forms),
new TextReference(014, TextName.MoveNames),
new TextReference(016, TextName.MoveFlavor),
new TextReference(018, TextName.Types),
new TextReference(021, TextName.TrainerClasses),
new TextReference(022, TextName.TrainerNames),
new TextReference(023, TextName.TrainerText),
new TextReference(037, TextName.AbilityNames),
new TextReference(051, TextName.Natures),
new TextReference(090, TextName.metlist_000000),
new TextReference(098, TextName.SpeciesNames),
new TextReference(114, TextName.ItemNames),
new TextReference(117, TextName.ItemFlavor),
new TextReference(153, TextName.MaisonTrainerNames),
new TextReference(154, TextName.SuperTrainerNames),
new TextReference(165, TextName.OPowerFlavor),
};
public static readonly TextReference[] GameText_SM =
{

View File

@@ -958,14 +958,15 @@ private static void restoreGARCs(params string[] g)
}
// Text Requests
internal static string[] getText(int file)
internal static string[] getText(TextName file)
{
return TextFile.getStrings(Path.Combine("gametext", $"{file.ToString("000")}.bin"));
string path = Path.Combine("gametext", $"{Config.getGameText(file).Index.ToString("000")}.bin");
return TextFile.getStrings(path);
}
internal static bool setText(int file, string[] strings)
internal static bool setText(TextName file, string[] strings)
{
byte[] data = TextFile.getBytes(strings);
string path = Path.Combine("gametext", $"{file.ToString("000")}.bin");
string path = Path.Combine("gametext", $"{Config.getGameText(file).Index.ToString("000")}.bin");
File.WriteAllBytes(path, data);
return true;
}

View File

@@ -15,15 +15,15 @@ public partial class EggMove : Form
public EggMove()
{
InitializeComponent();
string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
string[] specieslist = Main.getText(TextName.SpeciesNames);
specieslist[0] = movelist[0] = "";
string[] sortedspecies = (string[])specieslist.Clone();
Array.Resize(ref sortedspecies, 722); Array.Sort(sortedspecies);
Array.Resize(ref sortedspecies, Main.Config.MaxSpeciesID); Array.Sort(sortedspecies);
setupDGV();
var newlist = new List<Util.cbItem>();
for (int i = 1; i < 722; i++) // add all species
for (int i = 1; i < Main.Config.MaxSpeciesID; i++) // add all species
newlist.Add(new Util.cbItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) });
CB_Species.DisplayMember = "Text";
@@ -34,7 +34,7 @@ public EggMove()
private readonly string[] files = Directory.GetFiles("eggmove");
private readonly byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
private int entry = -1;
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private bool dumping;
private void setupDGV()
{
@@ -202,7 +202,7 @@ private void calcStats()
int spec = 0;
int stab = 0;
int species = 0;
for (int i = 0; i < 722; i++)
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
{
byte[] movedata = File.ReadAllBytes(files[i]);
if (movedata.Length <= 2) continue;

View File

@@ -16,7 +16,7 @@ public Evolution()
InitializeComponent();
specieslist[0] = movelist[0] = itemlist[0] = "";
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
string[] evolutionMethods =
{
@@ -81,10 +81,10 @@ public Evolution()
private readonly PictureBox[] pic;
private int entry = -1;
private readonly string[] sortedspecies;
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] typelist = Main.getText(Main.Config.ORAS ? 18 : 17);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly string[] typelist = Main.getText(TextName.Types);
private bool dumping;
private Evolutions evo = new Evolutions(new byte[0x30]);
private void getList()
@@ -160,7 +160,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
loopctr++;
// Verify it meets specifications
if (newSpecies == currentSpecies && loopctr < 722*10) // no A->A evolutions
if (newSpecies == currentSpecies && loopctr < Main.Config.MaxSpeciesID*10) // no A->A evolutions
{ goto defspecies; }
if (rEXP) // Experience Growth Rate matches
{
@@ -176,7 +176,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
{
const int l = 5; // tweakable scalars
const int h = 6;
if (!(pkm.BST * l / (h + loopctr/722) < oldpkm.BST && (pkm.BST * h + loopctr/722) / l > oldpkm.BST))
if (!(pkm.BST * l / (h + loopctr/Main.Config.MaxSpeciesID) < oldpkm.BST && (pkm.BST * h + loopctr/Main.Config.MaxSpeciesID) / l > oldpkm.BST))
{ goto defspecies; }
}
// assign random val

View File

@@ -10,7 +10,7 @@ public partial class Gifts : Form
public Gifts()
{
specieslist[0] = "---";
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
if (!File.Exists(FieldPath))
{
Util.Error("CRO does not exist! Closing.", FieldPath);
@@ -36,10 +36,10 @@ public Gifts()
private readonly int fieldSize = Main.Config.ORAS ? 0x24 : 0x18;
private readonly int count = Main.Config.ORAS ? 0x25 : 0x13;
private Gift[] GiftData;
private readonly string[] abilitylist = Main.getText(Main.Config.ORAS ? 37 : 34);
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] abilitylist = Main.getText(TextName.AbilityNames);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private void B_Save_Click(object sender, EventArgs e)
{
saveEntry();
@@ -185,7 +185,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
int bst = Main.SpeciesStat[species].BST;
int tries = 0;
var pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
while (!((pkm.BST*(5 - ++tries/722)/6 < bst) && pkm.BST*(6 + ++tries/722)/5 > bst))
while (!((pkm.BST*(5 - ++tries/Main.Config.MaxSpeciesID)/6 < bst) && pkm.BST*(6 + ++tries/Main.Config.MaxSpeciesID)/5 > bst))
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
CB_Species.SelectedIndex = species;

View File

@@ -15,8 +15,8 @@ public ItemEditor()
}
private readonly string[] files = Directory.GetFiles("item");
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] itemflavor = Main.getText(Main.Config.ORAS ? 117 : 99);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly string[] itemflavor = Main.getText(TextName.ItemFlavor);
private void Setup()
{

View File

@@ -19,13 +19,13 @@ public LevelUp()
specieslist[0] = movelist[0] = "";
string[] sortedspecies = (string[])specieslist.Clone();
Array.Resize(ref sortedspecies, 722); Array.Sort(sortedspecies);
Array.Resize(ref sortedspecies, Main.Config.MaxSpeciesID); Array.Sort(sortedspecies);
setupDGV();
var newlist = new List<Util.cbItem>();
for (int i = 1; i < 722; i++) // add all species
for (int i = 1; i < Main.Config.MaxSpeciesID; i++) // add all species
newlist.Add(new Util.cbItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) });
for (int i = 722; i < specieslist.Length; i++) // add all forms
for (int i = Main.Config.MaxSpeciesID; i < specieslist.Length; i++) // add all forms
newlist.Add(new Util.cbItem { Text = specieslist[i], Value = i });
CB_Species.DisplayMember = "Text";
@@ -36,7 +36,7 @@ public LevelUp()
private readonly string[] files = Directory.GetFiles("levelup");
private readonly byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
private int entry = -1;
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private bool dumping;
private void setupDGV()
{
@@ -245,7 +245,7 @@ private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e)
int max = 0;
int spec = 0;
int stab = 0;
for (int i = 0; i < 722; i++)
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
{
byte[] movedata = File.ReadAllBytes(files[i]);
int movecount = (movedata.Length - 4) / 4;

View File

@@ -11,10 +11,10 @@ namespace pk3DS
public partial class MEE : Form
{
private readonly string[] files = Directory.GetFiles("megaevo");
private readonly string[] forms = Main.getText(Main.Config.ORAS ? 5 : 5);
private readonly string[] types = Main.getText(Main.Config.ORAS ? 18 : 17);
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] forms = Main.getText(TextName.Forms);
private readonly string[] types = Main.getText(TextName.Types);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());
private readonly GroupBox[] groupbox_spec;
private readonly ComboBox[] forme_spec;
@@ -34,7 +34,7 @@ public partial class MEE : Form
CB_Species.ValueMember = "Value";
#region Intializations
Array.Resize(ref specieslist, 722); specieslist[0] = itemlist[0] = "";
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID); specieslist[0] = itemlist[0] = "";
specieslist[32] += "♂"; specieslist[29] += "♀";
AltForms = Personal.getFormList(personalData, Main.Config.ORAS, specieslist, forms, types, itemlist);
@@ -188,7 +188,7 @@ private void B_Dump_Click(object sender, EventArgs e)
dumping = true;
string result = "";
for (int i = 0; i < 722; i++)
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
{
CB_Species.SelectedValue = i; // Get new Species
string header = "======" + Environment.NewLine + entry + " " + CB_Species.Text + Environment.NewLine + "======" + Environment.NewLine;

View File

@@ -11,14 +11,13 @@ public partial class MaisonEditor : Form
{
public MaisonEditor(bool super)
{
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
movelist[0] = specieslist[0] = itemlist[0] = "";
trFiles = Directory.GetFiles(super ? "maisontrS" : "maisontrN");
pkFiles = Directory.GetFiles(super ? "maisonpkS" : "maisonpkN");
int trTXTFile = Main.Config.ORAS ? 153 : 130;
trNames = Main.getText(super ? trTXTFile : trTXTFile + 1); Array.Resize(ref trNames, trFiles.Length);
trNames = Main.getText(super ? TextName.SuperTrainerNames : TextName.MaisonTrainerNames); Array.Resize(ref trNames, trFiles.Length);
InitializeComponent();
Setup();
@@ -27,11 +26,11 @@ public MaisonEditor(bool super)
private readonly string[] trFiles;
private readonly string[] trNames;
private readonly string[] pkFiles;
private readonly string[] natures = Main.getText(Main.Config.ORAS ? 51 : 47);
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] trClass = Main.getText(Main.Config.ORAS ? 21 : 20);
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] natures = Main.getText(TextName.Natures);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private readonly string[] trClass = Main.getText(TextName.TrainerClasses);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private int trEntry = -1;
private int pkEntry = -1;
private bool dumping;

View File

@@ -23,7 +23,7 @@ public Mart()
}
private readonly string codebin;
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly byte[] data;
private readonly byte[] entries = Main.Config.ORAS

View File

@@ -19,9 +19,9 @@ public Moves()
Setup();
}
private string[] files = Directory.GetFiles("move");
private readonly string[] types = Main.getText(Main.Config.ORAS ? 18 : 17);
private readonly string[] moveflavor = Main.getText(Main.Config.ORAS ? 16 : 15);
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] types = Main.getText(TextName.Types);
private readonly string[] moveflavor = Main.getText(TextName.MoveFlavor);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly string[] sortedmoves;
private readonly string[] MoveCategories = { "Status", "Physical", "Special", };
private readonly string[] StatCategories = { "None", "Attack", "Defense", "Special Attack", "Special Defense", "Speed", "Accuracy", "Evasion", "All", };

View File

@@ -36,7 +36,7 @@ public OPower()
private readonly int offset;
private readonly byte[] exefsData;
private readonly byte[][] powerData = new byte[65][];
private readonly string[] powerFlavor = Main.getText(Main.Config.ORAS ? 165 : 141);
private readonly string[] powerFlavor = Main.getText(TextName.OPowerFlavor);
private int entry = -1;
private void changeEntry(object sender, EventArgs e)

View File

@@ -24,7 +24,7 @@ public OWSE()
mapView.Show();
tb_Zone.SelectedIndex = 1; // Show Overworlds tab
}
private readonly string[] gameLocations = Main.getText(Main.Config.ORAS ? 90 : 72);
private readonly string[] gameLocations = Main.getText(TextName.metlist_000000);
private string[] filepaths;
private string[] encdatapaths;
private byte[] masterZoneData;

View File

@@ -72,12 +72,12 @@ public Personal()
#endregion
private void Setup()
{
abilities = Main.getText(Main.Config.ORAS ? 37 : 34);
moves = Main.getText(Main.Config.ORAS ? 14 : 13);
items = Main.getText(Main.Config.ORAS ? 114 : 96);
species = Main.getText(Main.Config.ORAS ? 98 : 80);
types = Main.getText(Main.Config.ORAS ? 18 : 17);
forms = Main.getText(Main.Config.ORAS ? 5 : 5);
abilities = Main.getText(TextName.AbilityNames);
moves = Main.getText(TextName.MoveNames);
items = Main.getText(TextName.ItemNames);
species = Main.getText(TextName.SpeciesNames);
types = Main.getText(TextName.Types);
forms = Main.getText(TextName.Forms);
species[0] = "---";
abilities[0] = items[0] = moves[0] = "";
AltForms = getFormList(data, Main.Config.ORAS, species, forms, types, items);
@@ -523,9 +523,9 @@ private void formClosing(object sender, FormClosingEventArgs e)
internal static int[] getSpecies(byte[] data, bool oras, int PersonalEntry)
{
int entrysize = oras ? 0x50 : 0x40;
if (PersonalEntry < 722) return new[] { PersonalEntry, 0 };
if (PersonalEntry < Main.Config.MaxSpeciesID) return new[] { PersonalEntry, 0 };
for (int i = 0; i < 722; i++)
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
{
int FormCount = data[i * entrysize + 0x20] - 1; // Mons with no alt forms have a FormCount of 1.
ushort altformpointer = BitConverter.ToUInt16(data, entrysize * i + 0x1C);
@@ -541,10 +541,10 @@ internal static string[][] getFormList(byte[] data, bool oras, string[] species,
{
try
{
string[][] FormList = new string[722][];
string[][] FormList = new string[Main.Config.MaxSpeciesID][];
int entrysize = oras ? 0x50 : 0x40;
int AltFormOfs = 723; //null + 721 species + 1 gap
for (int i = 0; i < 722; i++) //Hardcode 721 species + null
for (int i = 0; i < Main.Config.MaxSpeciesID; i++) //Hardcode 721 species + null
{
int FormCount = data[i * entrysize + 0x20]; // Mons with no alt forms have a FormCount of 1.
FormList[i] = new string[FormCount];
@@ -574,7 +574,7 @@ internal static string[] getPersonalEntryList(byte[] data, bool oras, string[][]
{
int entrysize = oras ? 0x50 : 0x40;
string[] result = new string[data.Length / entrysize];
for (int i = 0; i < 722; i++)
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
{
result[i] = species[i];
if (AltForms[i].Length == 0) continue;
@@ -587,7 +587,7 @@ internal static string[] getPersonalEntryList(byte[] data, bool oras, string[][]
}
internal static ushort[] getPersonalIndexList(byte[] data, bool oras)
{
ushort[] result = new ushort[722];
ushort[] result = new ushort[Main.Config.MaxSpeciesID];
int entrysize = oras ? 0x50 : 0x40;
for (int i = 0; i < result.Length; i++)
result[i] = BitConverter.ToUInt16(data, entrysize * i + 0x1C);
@@ -613,10 +613,10 @@ internal static void setForms(int species, ComboBox cb, string[][] AltForms)
internal static string[] getSpeciesIndexStrings(bool oras)
{
string[] items = Main.getText(Main.Config.ORAS ? 114 : 96);
string[] species = Main.getText(Main.Config.ORAS ? 98 : 80);
string[] types = Main.getText(Main.Config.ORAS ? 18 : 17);
string[] forms = Main.getText(Main.Config.ORAS ? 5 : 5);
string[] items = Main.getText(TextName.ItemNames);
string[] species = Main.getText(TextName.SpeciesNames);
string[] types = Main.getText(TextName.Types);
string[] forms = Main.getText(TextName.Forms);
species[0] = "---";
byte[] data = File.ReadAllBytes(Directory.GetFiles("personal").Last());
string[][] AltForms = getFormList(data, Main.Config.ORAS, species, forms, types, items);

View File

@@ -23,7 +23,7 @@ public Pickup()
}
private readonly string codebin;
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly int offset = Main.Config.ORAS ? 0x004872FC : 0x004455A8;
private readonly byte[] data;
private int dataoffset;

View File

@@ -13,7 +13,7 @@ public partial class RSTE : Form
{
public RSTE()
{
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
InitializeComponent();
// String Fetching
@@ -151,15 +151,15 @@ internal static uint rnd32()
// Top Level Functions
private readonly string[] trdatapaths = Directory.GetFiles("trdata");
private readonly string[] trpokepaths = Directory.GetFiles("trpoke");
private readonly string[] abilitylist = Main.getText(Main.Config.ORAS ? 37 : 34);
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] types = Main.getText(Main.Config.ORAS ? 18 : 17);
private readonly string[] forms = Main.getText(Main.Config.ORAS ? 5 : 5);
private string[] trName = Main.getText(Main.Config.ORAS ? 22 : 21);
private readonly string[] trClass = Main.getText(Main.Config.ORAS ? 21 : 20);
private readonly string[] trText = Main.getText(Main.Config.ORAS ? 23 : 22);
private readonly string[] abilitylist = Main.getText(TextName.AbilityNames);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private readonly string[] types = Main.getText(TextName.Types);
private readonly string[] forms = Main.getText(TextName.Forms);
private string[] trName = Main.getText(TextName.TrainerNames);
private readonly string[] trClass = Main.getText(TextName.TrainerClasses);
private readonly string[] trText = Main.getText(TextName.TrainerText);
#endregion
// Ability Loading
@@ -565,7 +565,7 @@ private void Randomize()
if (rEnsureMEvo.Length > 0)
{
if (mEvoTypes.Length < 13 && rTypeTheme)
{ Util.Alert("There are insufficient types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.",
{ Util.Alert("There are insufficient Types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.",
"Re-Randomize Personal or don't choose both options."); return; }
GymE4Types.AddRange(mEvoTypes);
}
@@ -690,7 +690,7 @@ private void Randomize()
else if (rSmart) // Get a new Pokemon with a close BST
{
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
while (!((pkm.BST * (5 - ++tries / 722) / 6 < oldpkm.BST) && pkm.BST * (6 + ++tries / 722) / 5 > oldpkm.BST))
while (!((pkm.BST * (5 - ++tries / Main.Config.MaxSpeciesID) / 6 < oldpkm.BST) && pkm.BST * (6 + ++tries / Main.Config.MaxSpeciesID) / 5 > oldpkm.BST))
{
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
}
@@ -703,7 +703,7 @@ private void Randomize()
else if (rSmart) // Get a new Pokemon with a close BST
{
int tries = 0;
while (!((pkm.BST * (5 - ++tries / 722) / 6 < oldpkm.BST) && pkm.BST * (6 + ++tries / 722) / 5 > oldpkm.BST))
while (!((pkm.BST * (5 - ++tries / Main.Config.MaxSpeciesID) / 6 < oldpkm.BST) && pkm.BST * (6 + ++tries / Main.Config.MaxSpeciesID) / 5 > oldpkm.BST))
{
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
}
@@ -1031,7 +1031,7 @@ private int[] GetMegaEvolvableTypes()
MEvoTypes.Add(Main.SpeciesStat[spec].Types[1]);
}
MEvoTypes.Sort();
Console.WriteLine("There are " + MEvoTypes.Count + " types capable of mega evolution.");
Console.WriteLine("There are " + MEvoTypes.Count + " Types capable of mega evolution.");
return MEvoTypes.ToArray();
}
private int GetRandomMegaEvolvablePokemon(int type)

View File

@@ -286,7 +286,7 @@ public RSWE()
private void RSWE_Load()
{
specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
specieslist = Main.getText(TextName.SpeciesNames);
specieslist[0] = "---";
foreach (string s in formlist)
@@ -316,7 +316,7 @@ private void openQuick(string[] encdata)
Array.Sort(encdatapaths);
filepaths = new string[encdatapaths.Length - 2];
Array.Copy(encdatapaths, 2, filepaths, 0, filepaths.Length);
metRS_00000 = Main.getText(Main.Config.ORAS ? 90 : 72);
metRS_00000 = Main.getText(TextName.metlist_000000);
zonedata = File.ReadAllBytes(encdatapaths[0]);
decStorage = File.ReadAllBytes(encdatapaths[1]);
LocationNames = new string[filepaths.Length];

View File

@@ -10,7 +10,7 @@ public partial class Starters : Form
public Starters()
{
specieslist[0] = "---";
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
string[] personalList = Directory.GetFiles("personal");
personal = new byte[personalList.Length][];
@@ -51,7 +51,7 @@ public Starters()
}
private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro");
private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro");
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private readonly ComboBox[][] Choices;
private readonly PictureBox[][] Previews;
private readonly Label[] Labels;

View File

@@ -10,7 +10,7 @@ public partial class StaticEncounters : Form
public StaticEncounters()
{
specieslist[0] = "---";
Array.Resize(ref specieslist, 722);
Array.Resize(ref specieslist, Main.Config.MaxSpeciesID);
if (!File.Exists(FieldPath))
{
Util.Error("CRO does not exist! Closing.", FieldPath);
@@ -35,8 +35,8 @@ public StaticEncounters()
private const int fieldSize = 0xC;
private readonly int count = Main.Config.ORAS ? 0x3B : 0xC;
private EncounterStatic[] EncounterData;
private readonly string[] itemlist = Main.getText(Main.Config.ORAS ? 114 : 96);
private readonly string[] specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
private readonly string[] itemlist = Main.getText(TextName.ItemNames);
private readonly string[] specieslist = Main.getText(TextName.SpeciesNames);
private void B_Save_Click(object sender, EventArgs e)
{
saveEntry();
@@ -144,7 +144,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
int bst = Main.SpeciesStat[species].BST;
int tries = 0;
var pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
while (!((pkm.BST*(5 - ++tries/722)/6 < bst) && pkm.BST*(6 + ++tries/722)/5 > bst))
while (!((pkm.BST*(5 - ++tries/Main.Config.MaxSpeciesID)/6 < bst) && pkm.BST*(6 + ++tries/Main.Config.MaxSpeciesID)/5 > bst))
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
CB_Species.SelectedIndex = species;

View File

@@ -24,7 +24,7 @@ public TMHM()
}
private readonly string codebin;
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly int offset = Main.Config.ORAS ? 0x004A67EE : 0x00464796; // Default
private readonly byte[] data;
private int dataoffset;
@@ -128,9 +128,8 @@ private void setList()
}
// Set Move Text Descriptions back into Item Text File
int itemFile = Main.Config.ORAS ? 117 : 99;
string[] itemDescriptions = Main.getText(itemFile);
string[] moveDescriptions = Main.getText(Main.Config.ORAS ? 16 : 15);
string[] itemDescriptions = Main.getText(TextName.ItemFlavor);
string[] moveDescriptions = Main.getText(TextName.MoveFlavor);
for (int i = 1 - 1; i <= 92 - 1; i++) // TM01 - TM92
itemDescriptions[328 + i] = moveDescriptions[tmlist[i]];
for (int i = 93 - 1; i <= 95 - 1; i++) // TM92 - TM95
@@ -144,7 +143,7 @@ private void setList()
itemDescriptions[425] = moveDescriptions[hmlist[5]]; // HM06
itemDescriptions[737] = moveDescriptions[hmlist[6]]; // HM07
}
Main.setText(itemFile, itemDescriptions);
Main.setText(TextName.ItemFlavor, itemDescriptions);
}
private void formClosing(object sender, FormClosingEventArgs e)

View File

@@ -17,8 +17,8 @@ public TrainerRand()
trClassnorep.Sort();
}
private string[] trName = Main.getText(Main.Config.ORAS ? 22 : 21);
private readonly string[] trClass = Main.getText(Main.Config.ORAS ? 21 : 20);
private string[] trName = Main.getText(TextName.TrainerNames);
private readonly string[] trClass = Main.getText(TextName.TrainerClasses);
private readonly List<string> trClassnorep;
private void B_Close_Click(object sender, EventArgs e)

View File

@@ -23,7 +23,7 @@ public Tutors()
}
private readonly string codebin;
private readonly string[] movelist = Main.getText(Main.Config.ORAS ? 14 : 13);
private readonly string[] movelist = Main.getText(TextName.MoveNames);
private readonly byte[] data;
private readonly byte[] entries = { 0xF, 0x11, 0x10, 0xF }; // Entries per Tutor
private const int offset = 0x004960F8;

View File

@@ -9,7 +9,7 @@ namespace pk3DS
public partial class TypeChart : Form
{
private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllBattle.cro");
private readonly string[] types = Main.getText(Main.Config.ORAS ? 18 : 17);
private readonly string[] types = Main.getText(TextName.Types);
private readonly int offset = Main.Config.ORAS ? 0x000DB428 : 0x000D12A8;
private readonly byte[] chart = new byte[0x144];
private readonly byte[] CROData;

View File

@@ -291,7 +291,7 @@ public XYWE()
private void Load_XYWE()
{
specieslist = Main.getText(Main.Config.ORAS ? 98 : 80);
specieslist = Main.getText(TextName.SpeciesNames);
specieslist[0] = "---";
CB_FormeList.Items.AddRange(formlist);
@@ -312,7 +312,7 @@ private void openQuick(string[] encdata)
Array.Sort(encdatapaths);
filepaths = new string[encdatapaths.Length - 1];
Array.Copy(encdatapaths, 1, filepaths, 0, filepaths.Length);
metXY_00000 = Main.getText(Main.Config.ORAS ? 90 : 72);
metXY_00000 = Main.getText(TextName.metlist_000000);
zonedata = File.ReadAllBytes(encdatapaths[0]);
LocationNames = new string[filepaths.Length];
for (int f = 0; f < filepaths.Length; f++)

View File

@@ -66,7 +66,7 @@ internal static Bitmap getSprite(int species, int form, int gender, int item)
Bitmap baseImage = (Bitmap)Properties.Resources.ResourceManager.GetObject(file);
if (baseImage == null)
{
if (species < 722)
if (species < Main.Config.MaxSpeciesID)
{
baseImage = LayerImage(
(Image)Properties.Resources.ResourceManager.GetObject("_" + species),