mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-02 22:06:40 -05:00
Initial personalview 7 / tm edit7
This commit is contained in:
@@ -89,6 +89,18 @@ private void getGameData(GameVersion game)
|
||||
public bool SM => Version == GameVersion.SM || Version == GameVersion.SMDEMO;
|
||||
public int MaxSpeciesID => XY || ORAS ? 722 : 802;
|
||||
public int GARCVersion => XY || ORAS ? CTR.GARC.VER_4 : CTR.GARC.VER_6;
|
||||
public int Generation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (XY || ORAS)
|
||||
return 6;
|
||||
if (SM)
|
||||
return 7;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRebuildable(int fileCount)
|
||||
{
|
||||
switch (fileCount)
|
||||
|
||||
@@ -236,7 +236,7 @@ private void openQuick(string path)
|
||||
Tab_ExeFS.Enabled = RomFSPath != null && ExeFSPath != null;
|
||||
if (RomFSPath != null)
|
||||
{
|
||||
B_MoveTutor.Visible = Config.ORAS; // Default false unless loaded
|
||||
toggleSubEditors();
|
||||
string newtext = $"Game Loaded: {Config.Version}";
|
||||
if (L_Game.Text != newtext && Directory.Exists("personal"))
|
||||
{ Directory.Delete("personal", true); } // Force reloading of personal data if the game is switched.
|
||||
@@ -274,6 +274,17 @@ private void openQuick(string path)
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleSubEditors()
|
||||
{
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
B_MoveTutor.Visible = Config.ORAS; // Default false unless loaded
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void updateGameInfo()
|
||||
{
|
||||
// 0 - JP
|
||||
@@ -471,7 +482,15 @@ private void B_Personal_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] files = { "personal" };
|
||||
fileGet(files, false, true);
|
||||
Invoke((Action)(() => new PersonalEditor6().ShowDialog()));
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
Invoke((Action)(() => new PersonalEditor6().ShowDialog()));
|
||||
break;
|
||||
case 7:
|
||||
Invoke((Action)(() => new PersonalEditor7().ShowDialog()));
|
||||
break;
|
||||
}
|
||||
|
||||
// Refresh Personal Stats
|
||||
SpeciesStat = new PersonalTable(File.ReadAllBytes(Directory.GetFiles("personal").Last()), Config.Version).Table;
|
||||
@@ -680,7 +699,16 @@ private void B_Pickup_Click(object sender, EventArgs e)
|
||||
private void B_TMHM_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (ExeFSPath != null) new TMHMEditor6().Show();
|
||||
if (ExeFSPath != null)
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
new TMHMEditor6().Show();
|
||||
break;
|
||||
case 7:
|
||||
new TMEditor7().Show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void B_Mart_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ public abstract class PersonalInfo
|
||||
public abstract int [] Abilities { get; set; }
|
||||
public abstract int EscapeRate { get; set; }
|
||||
public virtual int FormeCount { get; set; }
|
||||
protected virtual int FormStatsIndex { get; set; }
|
||||
protected internal virtual int FormStatsIndex { get; set; }
|
||||
public virtual int FormeSprite { get; set; }
|
||||
public abstract int BaseEXP { get; set; }
|
||||
public abstract int Color { get; set; }
|
||||
|
||||
@@ -87,7 +87,7 @@ public override int[] Abilities
|
||||
}
|
||||
}
|
||||
public override int EscapeRate { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
|
||||
protected override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } }
|
||||
protected internal override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } }
|
||||
public override int FormeSprite { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } }
|
||||
public override int FormeCount { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } }
|
||||
public override int Color { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } }
|
||||
|
||||
@@ -85,5 +85,44 @@ public PersonalInfo getFormeEntry(int species, int forme)
|
||||
{
|
||||
return this[getFormeIndex(species, forme)];
|
||||
}
|
||||
|
||||
public string[][] getFormList(string[] species, int MaxSpecies)
|
||||
{
|
||||
string[][] FormList = new string[MaxSpecies + 1][];
|
||||
for (int i = 0; i <= MaxSpecies; i++)
|
||||
{
|
||||
int FormCount = this[i].FormeCount;
|
||||
FormList[i] = new string[FormCount];
|
||||
if (FormCount <= 0) continue;
|
||||
FormList[i][0] = species[i];
|
||||
for (int j = 1; j < FormCount; j++)
|
||||
{
|
||||
FormList[i][j] = $"{species[i]} " + j;
|
||||
}
|
||||
}
|
||||
|
||||
return FormList;
|
||||
}
|
||||
public string[] getPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal)
|
||||
{
|
||||
string[] result = new string[Table.Length];
|
||||
baseForm = new int[result.Length];
|
||||
formVal = new int[result.Length];
|
||||
for (int i = 0; i <= MaxSpecies; i++)
|
||||
{
|
||||
result[i] = species[i];
|
||||
if (AltForms[i].Length == 0) continue;
|
||||
int altformpointer = this[i].FormStatsIndex;
|
||||
if (altformpointer <= 0) continue;
|
||||
for (int j = 1; j < AltForms[i].Length; j++)
|
||||
{
|
||||
int ptr = altformpointer + j - 1;
|
||||
baseForm[ptr] = i;
|
||||
formVal[ptr] = j;
|
||||
result[ptr] = AltForms[i][j];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,14 @@ public TMHMEditor6()
|
||||
if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) { Util.Alert("No .code.bin detected."); Close(); }
|
||||
data = File.ReadAllBytes(files[0]);
|
||||
if (data.Length % 0x200 != 0) { Util.Alert(".code.bin not decompressed. Aborting."); Close(); }
|
||||
offset = Util.IndexOfBytes(data, new byte[] { 0xD4, 0x00, 0xAE, 0x02, 0xAF, 0x02, 0xB0, 0x02 }, 0x400000, 0) + 8;
|
||||
offset = Util.IndexOfBytes(data, Signature, 0x400000, 0) + 8;
|
||||
codebin = files[0];
|
||||
movelist[0] = "";
|
||||
setupDGV();
|
||||
getList();
|
||||
}
|
||||
|
||||
private static readonly byte[] Signature = {0xD4, 0x00, 0xAE, 0x02, 0xAF, 0x02, 0xB0, 0x02};
|
||||
private readonly string codebin;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
private readonly int offset = Main.Config.ORAS ? 0x004A67EE : 0x00464796; // Default
|
||||
@@ -176,7 +177,7 @@ internal static void getTMHMList(bool oras, ref ushort[] TMs, ref ushort[] HMs)
|
||||
string[] files = Directory.GetFiles(Main.ExeFSPath);
|
||||
if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) return;
|
||||
byte[] data = File.ReadAllBytes(files[0]);
|
||||
int dataoffset = Util.IndexOfBytes(data, new byte[] { 0xD4, 0x00, 0xAE, 0x02, 0xAF, 0x02, 0xB0, 0x02 }, 0x400000, 0) + 8;
|
||||
int dataoffset = Util.IndexOfBytes(data, Signature, 0x400000, 0) + 8;
|
||||
if (data.Length % 0x200 != 0) return;
|
||||
|
||||
List<ushort> tms = new List<ushort>();
|
||||
|
||||
1537
pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs
generated
Normal file
1537
pk3DS/Subforms/Gen7/PersonalEditor7.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
446
pk3DS/Subforms/Gen7/PersonalEditor7.cs
Normal file
446
pk3DS/Subforms/Gen7/PersonalEditor7.cs
Normal file
@@ -0,0 +1,446 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using pk3DS.Properties;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class PersonalEditor7 : Form
|
||||
{
|
||||
public PersonalEditor7()
|
||||
{
|
||||
InitializeComponent();
|
||||
helditem_boxes = new[] { CB_HeldItem1, CB_HeldItem2, CB_HeldItem3 };
|
||||
ability_boxes = new[] { CB_Ability1, CB_Ability2, CB_Ability3 };
|
||||
typing_boxes = new[] { CB_Type1, CB_Type2 };
|
||||
eggGroup_boxes = new[] { CB_EggGroup1, CB_EggGroup2 };
|
||||
byte_boxes = new[] { TB_BaseHP, TB_BaseATK, TB_BaseDEF, TB_BaseSPA, TB_BaseSPD, TB_BaseSPE, TB_Gender, TB_HatchCycles, TB_Friendship, TB_CatchRate };
|
||||
ev_boxes = new[] { TB_HPEVs, TB_ATKEVs, TB_DEFEVs, TB_SPEEVs, TB_SPAEVs, TB_SPDEVs };
|
||||
rstat_boxes = new[] { CHK_rHP, CHK_rATK, CHK_rDEF, CHK_rSPA, CHK_rSPD, CHK_rSPE };
|
||||
|
||||
data = File.ReadAllBytes(paths.Last()); // Load last to data.
|
||||
Personal = new PersonalTable(data, GameVersion.SM);
|
||||
species[0] = "---";
|
||||
abilities[0] = items[0] = moves[0] = "";
|
||||
AltForms = Personal.getFormList(species, Main.Config.MaxSpeciesID);
|
||||
entryNames = Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal);
|
||||
|
||||
Setup();
|
||||
CB_Species.SelectedIndex = 1;
|
||||
}
|
||||
#region Global Variables
|
||||
private readonly string[] paths = Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
private readonly string[] items = Main.getText(TextName.ItemNames);
|
||||
private readonly string[] moves = Main.getText(TextName.MoveNames);
|
||||
private readonly string[] species = Main.getText(TextName.SpeciesNames);
|
||||
private readonly string[] abilities = Main.getText(TextName.AbilityNames);
|
||||
private readonly string[] forms = Main.getText(TextName.Forms);
|
||||
private readonly string[] types = Main.getText(TextName.Types);
|
||||
|
||||
private readonly byte[] data;
|
||||
private readonly string[] entryNames;
|
||||
|
||||
private readonly ComboBox[] helditem_boxes;
|
||||
private readonly ComboBox[] ability_boxes;
|
||||
private readonly ComboBox[] typing_boxes;
|
||||
private readonly ComboBox[] eggGroup_boxes;
|
||||
|
||||
private readonly MaskedTextBox[] byte_boxes;
|
||||
private readonly MaskedTextBox[] ev_boxes;
|
||||
private readonly CheckBox[] rstat_boxes;
|
||||
|
||||
private readonly string[] eggGroups = { "---", "Monster", "Water 1", "Bug", "Flying", "Field", "Fairy", "Grass", "Human-Like", "Water 3", "Mineral", "Amorphous", "Water 2", "Ditto", "Dragon", "Undiscovered" };
|
||||
private readonly string[] EXPGroups = { "Medium-Fast", "Erratic", "Fluctuating", "Medium-Slow", "Fast", "Slow" };
|
||||
private readonly string[] colors = { "Red", "Blue", "Yellow", "Green", "Black", "Brown", "Purple", "Gray", "White", "Pink" };
|
||||
private readonly ushort[] tutormoves = { 338, 307, 308, 520, 519, 518, 434, 620 };
|
||||
|
||||
private readonly PersonalTable Personal;
|
||||
private string[][] AltForms;
|
||||
private int[] baseForms, formVal;
|
||||
int entry = -1;
|
||||
#endregion
|
||||
private void Setup()
|
||||
{
|
||||
ushort[] TMs = new ushort[0];
|
||||
TMEditor7.getTMHMList(ref TMs);
|
||||
CLB_TMHM.Items.Clear();
|
||||
|
||||
if (TMs.Length == 0) // No ExeFS to grab TMs from.
|
||||
{
|
||||
for (int i = 1; i <= 100; i++)
|
||||
CLB_TMHM.Items.Add("TM" + i.ToString("00"));
|
||||
}
|
||||
else // Use TMHM moves.
|
||||
{
|
||||
for (int i = 1; i <= 100; i++)
|
||||
CLB_TMHM.Items.Add($"TM{i.ToString("00")} {moves[TMs[i - 1]]}");
|
||||
}
|
||||
foreach (ushort m in tutormoves)
|
||||
CLB_MoveTutors.Items.Add(moves[m]);
|
||||
|
||||
for (int i = 0; i < entryNames.Length; i++)
|
||||
CB_Species.Items.Add($"{entryNames[i]} - {i.ToString("000")}");
|
||||
|
||||
foreach (ComboBox cb in helditem_boxes)
|
||||
foreach (string it in items)
|
||||
cb.Items.Add(it);
|
||||
|
||||
foreach (ComboBox cb in ability_boxes)
|
||||
foreach (string ab in abilities)
|
||||
cb.Items.Add(ab);
|
||||
|
||||
foreach (ComboBox cb in typing_boxes)
|
||||
foreach (string ty in types)
|
||||
cb.Items.Add(ty);
|
||||
|
||||
foreach (ComboBox cb in eggGroup_boxes)
|
||||
foreach (string eg in eggGroups)
|
||||
cb.Items.Add(eg);
|
||||
|
||||
foreach (string co in colors)
|
||||
CB_Color.Items.Add(co);
|
||||
|
||||
foreach (string eg in EXPGroups)
|
||||
CB_EXPGroup.Items.Add(eg);
|
||||
}
|
||||
|
||||
private void CB_Species_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (entry > -1 && !dumping) saveEntry();
|
||||
entry = CB_Species.SelectedIndex;
|
||||
readEntry();
|
||||
}
|
||||
private void ByteLimiter(object sender, EventArgs e)
|
||||
{
|
||||
MaskedTextBox mtb = sender as MaskedTextBox;
|
||||
int val;
|
||||
int.TryParse(mtb.Text, out val);
|
||||
if (Array.IndexOf(byte_boxes, mtb) > -1 && val > 255)
|
||||
mtb.Text = "255";
|
||||
else if (Array.IndexOf(ev_boxes, mtb) > -1 && val > 3)
|
||||
mtb.Text = "3";
|
||||
}
|
||||
|
||||
private PersonalInfo pkm;
|
||||
private void readInfo()
|
||||
{
|
||||
pkm = Main.SpeciesStat[entry];
|
||||
|
||||
TB_BaseHP.Text = pkm.HP.ToString("000");
|
||||
TB_BaseATK.Text = pkm.ATK.ToString("000");
|
||||
TB_BaseDEF.Text = pkm.DEF.ToString("000");
|
||||
TB_BaseSPE.Text = pkm.SPE.ToString("000");
|
||||
TB_BaseSPA.Text = pkm.SPA.ToString("000");
|
||||
TB_BaseSPD.Text = pkm.SPD.ToString("000");
|
||||
TB_HPEVs.Text = pkm.EV_HP.ToString("0");
|
||||
TB_ATKEVs.Text = pkm.EV_ATK.ToString("0");
|
||||
TB_DEFEVs.Text = pkm.EV_DEF.ToString("0");
|
||||
TB_SPEEVs.Text = pkm.EV_SPE.ToString("0");
|
||||
TB_SPAEVs.Text = pkm.EV_SPA.ToString("0");
|
||||
TB_SPDEVs.Text = pkm.EV_SPD.ToString("0");
|
||||
|
||||
CB_Type1.SelectedIndex = pkm.Types[0];
|
||||
CB_Type2.SelectedIndex = pkm.Types[1];
|
||||
|
||||
TB_CatchRate.Text = pkm.CatchRate.ToString("000");
|
||||
TB_Stage.Text = pkm.EvoStage.ToString("0");
|
||||
|
||||
CB_HeldItem1.SelectedIndex = pkm.Items[0];
|
||||
CB_HeldItem2.SelectedIndex = pkm.Items[1];
|
||||
CB_HeldItem3.SelectedIndex = pkm.Items[2];
|
||||
|
||||
TB_Gender.Text = pkm.Gender.ToString("000");
|
||||
TB_HatchCycles.Text = pkm.HatchCycles.ToString("000");
|
||||
TB_Friendship.Text = pkm.BaseFriendship.ToString("000");
|
||||
|
||||
CB_EXPGroup.SelectedIndex = pkm.EXPGrowth;
|
||||
|
||||
CB_EggGroup1.SelectedIndex = pkm.EggGroups[0];
|
||||
CB_EggGroup2.SelectedIndex = pkm.EggGroups[1];
|
||||
|
||||
CB_Ability1.SelectedIndex = pkm.Abilities[0];
|
||||
CB_Ability2.SelectedIndex = pkm.Abilities[1];
|
||||
CB_Ability3.SelectedIndex = pkm.Abilities[2];
|
||||
|
||||
TB_FormeCount.Text = pkm.FormeCount.ToString("000");
|
||||
TB_FormeSprite.Text = pkm.FormeSprite.ToString("000");
|
||||
|
||||
TB_RawColor.Text = pkm.Color.ToString("000");
|
||||
CB_Color.SelectedIndex = pkm.Color & 0xF;
|
||||
|
||||
TB_BaseExp.Text = pkm.BaseEXP.ToString("000");
|
||||
|
||||
TB_Height.Text = (pkm.Height / 100).ToString("00.0");
|
||||
TB_Weight.Text = (pkm.Weight / 10).ToString("000.0");
|
||||
|
||||
for (int i = 0; i < CLB_TMHM.Items.Count; i++)
|
||||
CLB_TMHM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TMHM
|
||||
|
||||
for (int i = 0; i < CLB_MoveTutors.Items.Count; i++)
|
||||
CLB_MoveTutors.SetItemChecked(i, pkm.TypeTutors[i]); // Bitflags for Tutors
|
||||
}
|
||||
private void readEntry()
|
||||
{
|
||||
readInfo();
|
||||
|
||||
if (dumping) return;
|
||||
int s = baseForms[entry];
|
||||
int f = formVal[entry];
|
||||
if (entry <= Main.Config.MaxSpeciesID)
|
||||
s = entry;
|
||||
int[] specForm = {s, f};
|
||||
string filename = "_" + specForm[0] + (CB_Species.SelectedIndex > Main.Config.MaxSpeciesID ? "_" + (specForm[1] + 1) : "");
|
||||
Bitmap rawImg = (Bitmap)Resources.ResourceManager.GetObject(filename) ?? Resources.unknown;
|
||||
Bitmap bigImg = new Bitmap(rawImg.Width * 2, rawImg.Height * 2);
|
||||
for (int x = 0; x < rawImg.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < rawImg.Height; y++)
|
||||
{
|
||||
Color c = rawImg.GetPixel(x, y);
|
||||
bigImg.SetPixel(2 * x, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x + 1, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x, 2 * y + 1, c);
|
||||
bigImg.SetPixel(2 * x + 1, 2 * y + 1, c);
|
||||
}
|
||||
}
|
||||
PB_MonSprite.Image = bigImg;
|
||||
}
|
||||
private void savePersonal()
|
||||
{
|
||||
pkm.HP = Convert.ToByte(TB_BaseHP.Text);
|
||||
pkm.ATK = Convert.ToByte(TB_BaseATK.Text);
|
||||
pkm.DEF = Convert.ToByte(TB_BaseDEF.Text);
|
||||
pkm.SPE = Convert.ToByte(TB_BaseSPE.Text);
|
||||
pkm.SPA = Convert.ToByte(TB_BaseSPA.Text);
|
||||
pkm.SPD = Convert.ToByte(TB_BaseSPD.Text);
|
||||
|
||||
pkm.EV_HP = Convert.ToByte(TB_HPEVs.Text);
|
||||
pkm.EV_ATK = Convert.ToByte(TB_ATKEVs.Text);
|
||||
pkm.EV_DEF = Convert.ToByte(TB_DEFEVs.Text);
|
||||
pkm.EV_SPE = Convert.ToByte(TB_SPEEVs.Text);
|
||||
pkm.EV_SPA = Convert.ToByte(TB_SPAEVs.Text);
|
||||
pkm.EV_SPD = Convert.ToByte(TB_SPDEVs.Text);
|
||||
|
||||
pkm.CatchRate = Convert.ToByte(TB_CatchRate.Text);
|
||||
pkm.EvoStage = Convert.ToByte(TB_Stage.Text);
|
||||
|
||||
pkm.Types[0] = (byte) CB_Type1.SelectedIndex;
|
||||
pkm.Types[1] = (byte) CB_Type2.SelectedIndex;
|
||||
pkm.Items[0] = (ushort) CB_HeldItem1.SelectedIndex;
|
||||
pkm.Items[1] = (ushort) CB_HeldItem2.SelectedIndex;
|
||||
pkm.Items[2] = (ushort) CB_HeldItem3.SelectedIndex;
|
||||
|
||||
pkm.Gender = Convert.ToByte(TB_Gender.Text);
|
||||
pkm.HatchCycles = Convert.ToByte(TB_HatchCycles.Text);
|
||||
pkm.BaseFriendship = Convert.ToByte(TB_Friendship.Text);
|
||||
pkm.EXPGrowth = (byte) CB_EXPGroup.SelectedIndex;
|
||||
pkm.EggGroups[0] = (byte) CB_EggGroup1.SelectedIndex;
|
||||
pkm.EggGroups[1] = (byte) CB_EggGroup2.SelectedIndex;
|
||||
|
||||
pkm.Abilities[0] = (byte) CB_Ability1.SelectedIndex;
|
||||
pkm.Abilities[1] = (byte) CB_Ability2.SelectedIndex;
|
||||
pkm.Abilities[2] = (byte) CB_Ability3.SelectedIndex;
|
||||
|
||||
pkm.FormeSprite = Convert.ToUInt16(TB_FormeSprite.Text);
|
||||
pkm.FormeCount = Convert.ToByte(TB_FormeCount.Text);
|
||||
pkm.Color = (byte) (Convert.ToByte(CB_Color.SelectedIndex) | (Convert.ToByte(TB_RawColor.Text) & 0xF0));
|
||||
pkm.BaseEXP = Convert.ToUInt16(TB_BaseExp.Text);
|
||||
|
||||
pkm.Height = (int)Convert.ToDouble(TB_Height.Text)*100;
|
||||
pkm.Weight = (int)Convert.ToDouble(TB_Weight.Text)*10;
|
||||
|
||||
for (int i = 0; i < CLB_TMHM.Items.Count; i++)
|
||||
pkm.TMHM[i] = CLB_TMHM.GetItemChecked(i);
|
||||
|
||||
for (int t = 0; t < CLB_MoveTutors.Items.Count; t++)
|
||||
pkm.TypeTutors[t] = CLB_MoveTutors.GetItemChecked(t);
|
||||
}
|
||||
private void saveEntry()
|
||||
{
|
||||
savePersonal();
|
||||
byte[] edits = pkm.Write();
|
||||
File.WriteAllBytes(paths[entry], edits);
|
||||
Array.Copy(edits, 0, data, entry * edits.Length, edits.Length);
|
||||
File.WriteAllBytes(paths[paths.Length - 1], data);
|
||||
}
|
||||
|
||||
private void B_Randomize_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new Random();
|
||||
const int TMPercent = 35; // Average Learnable TMs is 35.260.
|
||||
const int TutorPercent = 2; //136 special tutor moves learnable by species in Untouched ORAS.
|
||||
ushort[] itemlist = Main.Config.ORAS ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY;
|
||||
ushort[] berrylist = Legal.Pouch_Berry_XY;
|
||||
Array.Resize(ref itemlist, itemlist.Length + berrylist.Length);
|
||||
Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length);
|
||||
|
||||
int itemlen = itemlist.Length;
|
||||
int abillen = CB_Ability1.Items.Count;
|
||||
int typelen = CB_Type1.Items.Count;
|
||||
|
||||
for (int i = 1; i < CB_Species.Items.Count; i++)
|
||||
{
|
||||
CB_Species.SelectedIndex = i; // Get new Species
|
||||
|
||||
// Fiddle with TM Learnsets
|
||||
if (CHK_TM.Checked)
|
||||
for (int t = 0; t < 100; t++)
|
||||
CLB_TMHM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked);
|
||||
if (CHK_HM.Checked)
|
||||
for (int t = 100; t < CLB_TMHM.Items.Count;t++)
|
||||
CLB_TMHM.SetItemCheckState(t, rnd.Next(0, 100) < TMPercent ? CheckState.Checked : CheckState.Unchecked);
|
||||
if (CHK_Tutors.Checked)
|
||||
{
|
||||
for (int t = 0; t < CLB_MoveTutors.Items.Count; t++)
|
||||
CLB_MoveTutors.SetItemCheckState(t, rnd.Next(0, 100) < TutorPercent ? CheckState.Checked : CheckState.Unchecked);
|
||||
if (Main.Config.ORAS && (CB_Species.SelectedIndex == 384 || CB_Species.SelectedIndex == 814)) //Make sure Rayquaza can learn Dragon Ascent.
|
||||
CLB_MoveTutors.SetItemCheckState(CLB_MoveTutors.Items.Count-1, CheckState.Checked);
|
||||
}
|
||||
|
||||
// Abilities:
|
||||
if (CHK_Ability.Checked)
|
||||
{
|
||||
ComboBox[] abils = {CB_Ability1, CB_Ability2, CB_Ability3};
|
||||
for (int a = 0; a < 3; a++) // Set 3 New Abilities, none being Wonder Guard (25) unless CHK_WGuard is checked.
|
||||
{
|
||||
int newabil = rnd.Next(1, abillen);
|
||||
while (newabil == 25 && !CHK_WGuard.Checked)
|
||||
newabil = rnd.Next(1, abillen);
|
||||
if (abils[a].SelectedIndex != 25 || CHK_WGuard.Checked) abils[a].SelectedIndex = newabil;
|
||||
}
|
||||
}
|
||||
|
||||
// Fiddle with Base Stats, don't muck with Shedinja.
|
||||
if (CHK_Stats.Checked)
|
||||
{
|
||||
if (Convert.ToByte(byte_boxes[0].Text) != 1)
|
||||
for (int z = 0; z < 6; z++)
|
||||
if (rstat_boxes[z].Checked)
|
||||
byte_boxes[z].Text =
|
||||
Math.Max(5,rnd.Next(
|
||||
Math.Min(255, (int) (Convert.ToByte(byte_boxes[z].Text)*(1 - NUD_StatDev.Value/100))),
|
||||
Math.Min(255, (int) (Convert.ToByte(byte_boxes[z].Text)*(1 + NUD_StatDev.Value/100)))
|
||||
)).ToString("000");
|
||||
}
|
||||
// EV yield stays the same...
|
||||
|
||||
if (CHK_CatchRate.Checked)
|
||||
TB_CatchRate.Text = rnd.Next(3, 251).ToString("000"); //Random Catch Rate between 3 and 250. Should I make this normally distributed?
|
||||
if (CHK_EggGroup.Checked)
|
||||
{
|
||||
if (rnd.Next(0, 100) < NUD_Egg.Value) // 50% chance to have either One or Two Egg Groups
|
||||
CB_EggGroup1.SelectedIndex = CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
|
||||
else
|
||||
{
|
||||
CB_EggGroup1.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
|
||||
CB_EggGroup2.SelectedIndex = rnd.Next(1, CB_EggGroup1.Items.Count);
|
||||
}
|
||||
}
|
||||
|
||||
// Items
|
||||
if (CHK_Item.Checked)
|
||||
{
|
||||
CB_HeldItem1.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
|
||||
CB_HeldItem2.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
|
||||
CB_HeldItem3.SelectedIndex = itemlist[rnd.Next(1, itemlen)];
|
||||
}
|
||||
|
||||
// Type
|
||||
if (CHK_Type.Checked)
|
||||
{
|
||||
if (rnd.Next(0, 100) < NUD_TypePercent.Value) // 50% chance to have either Single or Dual Typing
|
||||
CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen);
|
||||
else
|
||||
{
|
||||
CB_Type1.SelectedIndex = rnd.Next(0, typelen);
|
||||
CB_Type2.SelectedIndex = rnd.Next(0, typelen);
|
||||
}
|
||||
}
|
||||
}
|
||||
saveEntry();
|
||||
Util.Alert("All relevant Pokemon Personal Entries have been randomized!");
|
||||
}
|
||||
private void B_ModifyAll(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 1; i < CB_Species.Items.Count; i++)
|
||||
{
|
||||
CB_Species.SelectedIndex = i; // Get new Species
|
||||
|
||||
if (CHK_NoEV.Checked)
|
||||
for (int z = 0; z < 6; z++)
|
||||
ev_boxes[z].Text = 0.ToString();
|
||||
if (CHK_LowCatch.Checked)
|
||||
TB_CatchRate.Text = 3.ToString("000");
|
||||
if (CHK_Growth.Checked)
|
||||
CB_EXPGroup.SelectedIndex = 5;
|
||||
if (CHK_EXP.Checked)
|
||||
TB_BaseExp.Text = ((float)NUD_EXP.Value*(Convert.ToUInt16(TB_BaseExp.Text)/100f)).ToString("000");
|
||||
|
||||
if (CHK_QuickHatch.Checked)
|
||||
TB_HatchCycles.Text = 1.ToString();
|
||||
}
|
||||
CB_Species.SelectedIndex = 1;
|
||||
Util.Alert("All species modified to specification!");
|
||||
}
|
||||
private bool dumping;
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Dump all Personal Entries to Text File?"))
|
||||
return;
|
||||
|
||||
dumping = true;
|
||||
string result = "";
|
||||
for (int i = 0; i < CB_Species.Items.Count; i++)
|
||||
{
|
||||
CB_Species.SelectedIndex = i; // Get new Species
|
||||
result += "======" + Environment.NewLine + entry + " " + CB_Species.Text + Environment.NewLine + "======" + Environment.NewLine;
|
||||
|
||||
result +=
|
||||
$"Base Stats: {TB_BaseHP.Text}.{TB_BaseATK.Text}.{TB_BaseDEF.Text}.{TB_BaseSPA.Text}.{TB_BaseSPD.Text}.{TB_BaseSPE.Text} (BST: {pkm.BST})" + Environment.NewLine;
|
||||
result +=
|
||||
$"EV Yield: {TB_HPEVs.Text}.{TB_ATKEVs.Text}.{TB_DEFEVs.Text}.{TB_SPAEVs.Text}.{TB_SPDEVs.Text}.{TB_SPEEVs.Text}" + Environment.NewLine;
|
||||
result += $"Abilities: {CB_Ability1.Text} (1) | {CB_Ability2.Text} (2) | {CB_Ability3.Text} (H)" + Environment.NewLine;
|
||||
|
||||
result += string.Format(CB_Type1.SelectedIndex != CB_Type2.SelectedIndex ? "Type: {0} / {1}" : "Type: {0}", CB_Type1.Text, CB_Type2.Text);
|
||||
|
||||
result += $"Item 1 (50%): {CB_HeldItem1.Text}" + Environment.NewLine;
|
||||
result += $"Item 2 (5%): {CB_HeldItem2.Text}" + Environment.NewLine;
|
||||
result += $"Item 3 (1%): {CB_HeldItem3.Text}" + Environment.NewLine;
|
||||
// I don't want to add anything else. Should be pretty easy for anyone else to expand.
|
||||
|
||||
result += Environment.NewLine;
|
||||
}
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog {FileName = "Personal Entries.txt", Filter = "Text File|*.txt"};
|
||||
|
||||
SystemSounds.Asterisk.Play();
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = sfd.FileName;
|
||||
File.WriteAllText(path, result, Encoding.Unicode);
|
||||
}
|
||||
dumping = false;
|
||||
}
|
||||
private void CHK_Stats_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
L_StatDev.Visible = NUD_StatDev.Visible = CHK_Stats.Checked;
|
||||
}
|
||||
private void CHK_Ability_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CHK_WGuard.Enabled = CHK_Ability.Checked;
|
||||
if (!CHK_WGuard.Enabled)
|
||||
CHK_WGuard.Checked = false;
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (entry > -1) saveEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
pk3DS/Subforms/Gen7/PersonalEditor7.resx
Normal file
120
pk3DS/Subforms/Gen7/PersonalEditor7.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
97
pk3DS/Subforms/Gen7/TMEditor7.Designer.cs
generated
Normal file
97
pk3DS/Subforms/Gen7/TMEditor7.Designer.cs
generated
Normal file
@@ -0,0 +1,97 @@
|
||||
namespace pk3DS
|
||||
{
|
||||
partial class TMEditor7
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dgvTM = new System.Windows.Forms.DataGridView();
|
||||
this.L_TM = new System.Windows.Forms.Label();
|
||||
this.B_RTM = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvTM)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dgvTM
|
||||
//
|
||||
this.dgvTM.AllowUserToAddRows = false;
|
||||
this.dgvTM.AllowUserToDeleteRows = false;
|
||||
this.dgvTM.AllowUserToResizeColumns = false;
|
||||
this.dgvTM.AllowUserToResizeRows = false;
|
||||
this.dgvTM.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.dgvTM.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvTM.Location = new System.Drawing.Point(9, 25);
|
||||
this.dgvTM.Name = "dgvTM";
|
||||
this.dgvTM.Size = new System.Drawing.Size(240, 299);
|
||||
this.dgvTM.TabIndex = 1;
|
||||
//
|
||||
// L_TM
|
||||
//
|
||||
this.L_TM.AutoSize = true;
|
||||
this.L_TM.Location = new System.Drawing.Point(9, 9);
|
||||
this.L_TM.Name = "L_TM";
|
||||
this.L_TM.Size = new System.Drawing.Size(26, 13);
|
||||
this.L_TM.TabIndex = 2;
|
||||
this.L_TM.Text = "TM:";
|
||||
//
|
||||
// B_RTM
|
||||
//
|
||||
this.B_RTM.Location = new System.Drawing.Point(41, 1);
|
||||
this.B_RTM.Name = "B_RTM";
|
||||
this.B_RTM.Size = new System.Drawing.Size(75, 23);
|
||||
this.B_RTM.TabIndex = 5;
|
||||
this.B_RTM.Text = "Randomize";
|
||||
this.B_RTM.UseVisualStyleBackColor = true;
|
||||
this.B_RTM.Click += new System.EventHandler(this.B_RandomTM_Click);
|
||||
//
|
||||
// TMHMEditor7
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(259, 331);
|
||||
this.Controls.Add(this.B_RTM);
|
||||
this.Controls.Add(this.L_TM);
|
||||
this.Controls.Add(this.dgvTM);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(520, 670);
|
||||
this.MinimumSize = new System.Drawing.Size(275, 370);
|
||||
this.Name = "TMHMEditor7";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "TM Editor";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvTM)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dgvTM;
|
||||
private System.Windows.Forms.Label L_TM;
|
||||
private System.Windows.Forms.Button B_RTM;
|
||||
}
|
||||
}
|
||||
132
pk3DS/Subforms/Gen7/TMEditor7.cs
Normal file
132
pk3DS/Subforms/Gen7/TMEditor7.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class TMEditor7 : Form
|
||||
{
|
||||
public TMEditor7()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Main.ExeFSPath == null) { Util.Alert("No exeFS code to load."); Close(); }
|
||||
string[] files = Directory.GetFiles(Main.ExeFSPath);
|
||||
if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) { Util.Alert("No .code.bin detected."); Close(); }
|
||||
data = File.ReadAllBytes(files[0]);
|
||||
if (data.Length % 0x200 != 0) { Util.Alert(".code.bin not decompressed. Aborting."); Close(); }
|
||||
offset = Util.IndexOfBytes(data, Signature, 0x500000, 0) + 8;
|
||||
codebin = files[0];
|
||||
movelist[0] = "";
|
||||
setupDGV();
|
||||
getList();
|
||||
}
|
||||
|
||||
private static readonly byte[] Signature = {0x03, 0x40, 0x03, 0x41, 0x03, 0x42, 0x03, 0x43, 0x03}; // tail end of item::ITEM_CheckBeads
|
||||
private readonly string codebin;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
private readonly int offset = 0x0059795A; // Default
|
||||
private readonly byte[] data;
|
||||
private int dataoffset;
|
||||
private void getDataOffset()
|
||||
{
|
||||
dataoffset = offset; // reset
|
||||
}
|
||||
private void setupDGV()
|
||||
{
|
||||
dgvTM.Columns.Clear();
|
||||
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
|
||||
{
|
||||
dgvIndex.HeaderText = "Index";
|
||||
dgvIndex.DisplayIndex = 0;
|
||||
dgvIndex.Width = 45;
|
||||
dgvIndex.ReadOnly = true;
|
||||
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
dgvIndex.SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
}
|
||||
DataGridViewComboBoxColumn dgvMove = new DataGridViewComboBoxColumn();
|
||||
{
|
||||
dgvMove.HeaderText = "Move";
|
||||
dgvMove.DisplayIndex = 1;
|
||||
foreach (string t in movelist)
|
||||
dgvMove.Items.Add(t); // add only the Names
|
||||
|
||||
dgvMove.Width = 133;
|
||||
dgvMove.FlatStyle = FlatStyle.Flat;
|
||||
dgvIndex.SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
}
|
||||
dgvTM.Columns.Add(dgvIndex);
|
||||
dgvTM.Columns.Add(dgvMove);
|
||||
}
|
||||
|
||||
private List<ushort> tms = new List<ushort>();
|
||||
|
||||
private void getList()
|
||||
{
|
||||
tms = new List<ushort>();
|
||||
dgvTM.Rows.Clear();
|
||||
|
||||
getDataOffset();
|
||||
for (int i = 0; i < 100; i++) // TMs stored sequentially
|
||||
tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i));
|
||||
|
||||
ushort[] tmlist = tms.ToArray();
|
||||
for (int i = 0; i < tmlist.Length; i++)
|
||||
{ dgvTM.Rows.Add(); dgvTM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvTM.Rows[i].Cells[1].Value = movelist[tmlist[i]]; }
|
||||
}
|
||||
private void setList()
|
||||
{
|
||||
// Gather TM/HM list.
|
||||
tms = new List<ushort>();
|
||||
for (int i = 0; i < dgvTM.Rows.Count; i++)
|
||||
tms.Add((ushort)Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value));
|
||||
|
||||
ushort[] tmlist = tms.ToArray();
|
||||
|
||||
// Set TM/HM list in
|
||||
for (int i = 0; i < 100; i++)
|
||||
Array.Copy(BitConverter.GetBytes(tmlist[i]), 0, data, offset + 2 * i, 2);
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setList();
|
||||
File.WriteAllBytes(codebin, data);
|
||||
}
|
||||
|
||||
private void B_RandomTM_Click(object sender, EventArgs e)
|
||||
{
|
||||
int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
|
||||
Util.Shuffle(randomMoves);
|
||||
|
||||
int[] banned = { 15, 19, 57, 70, 127, 249, 291, 148 };
|
||||
int ctr = 0;
|
||||
|
||||
for (int i = 0; i < dgvTM.Rows.Count; i++)
|
||||
{
|
||||
int val = Array.IndexOf(movelist, dgvTM.Rows[i].Cells[1].Value);
|
||||
if (banned.Contains(val)) continue;
|
||||
while (banned.Contains(randomMoves[ctr])) ctr++;
|
||||
|
||||
dgvTM.Rows[i].Cells[1].Value = movelist[randomMoves[ctr++]];
|
||||
}
|
||||
}
|
||||
|
||||
internal static void getTMHMList(ref ushort[] TMs)
|
||||
{
|
||||
if (Main.ExeFSPath == null) return;
|
||||
string[] files = Directory.GetFiles(Main.ExeFSPath);
|
||||
if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code")) return;
|
||||
byte[] data = File.ReadAllBytes(files[0]);
|
||||
int dataoffset = Util.IndexOfBytes(data, Signature, 0x500000, 0) + 8;
|
||||
if (data.Length % 0x200 != 0) return;
|
||||
|
||||
List<ushort> tms = new List<ushort>();
|
||||
|
||||
for (int i = 0; i < 100; i++) // TMs stored sequentially
|
||||
tms.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i));
|
||||
TMs = tms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
pk3DS/Subforms/Gen7/TMEditor7.resx
Normal file
120
pk3DS/Subforms/Gen7/TMEditor7.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -60,6 +60,7 @@
|
||||
<Compile Include="3DS\CTR.cs" />
|
||||
<Compile Include="3DS\ExeFS.cs" />
|
||||
<Compile Include="3DS\BCLIM.cs" />
|
||||
<Compile Include="Game\GameRNG.cs" />
|
||||
<Compile Include="Game\GameVersion.cs" />
|
||||
<Compile Include="Game\GARCReference.cs" />
|
||||
<Compile Include="Game\TextReference.cs" />
|
||||
@@ -73,8 +74,11 @@
|
||||
<Compile Include="Game\GameConfig.cs" />
|
||||
<Compile Include="Legality\Randomizer.cs" />
|
||||
<Compile Include="3DS\RomFS.cs" />
|
||||
<Compile Include="Structs.cs" />
|
||||
<Compile Include="Subforms\Gen6\Experimental\OWSEStructs.cs" />
|
||||
<Compile Include="Structures\EggMoves.cs" />
|
||||
<Compile Include="Structures\Gen6\EncounterGift6.cs" />
|
||||
<Compile Include="Structures\Gen6\EncounterStatic6.cs" />
|
||||
<Compile Include="Structures\Gen6\Evolutions.cs" />
|
||||
<Compile Include="Structures\Gen6\Item6.cs" />
|
||||
<Compile Include="Structures\Gen6\Maison6.cs" />
|
||||
<Compile Include="Structures\Gen6\MegaEvolution6.cs" />
|
||||
@@ -88,6 +92,12 @@
|
||||
<Compile Include="Structures\PersonalInfo\PersonalInfoSM.cs" />
|
||||
<Compile Include="Structures\PersonalInfo\PersonalInfoXY.cs" />
|
||||
<Compile Include="Structures\PersonalInfo\PersonalTable.cs" />
|
||||
<Compile Include="Subforms\Gen7\PersonalEditor7.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Subforms\Gen7\PersonalEditor7.Designer.cs">
|
||||
<DependentUpon>PersonalEditor7.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Subforms\Gen7\SMTE.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -118,6 +128,12 @@
|
||||
<Compile Include="Subforms\Gen6\Experimental\MapPermView.Designer.cs">
|
||||
<DependentUpon>MapPermView.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Subforms\Gen7\TMEditor7.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Subforms\Gen7\TMEditor7.Designer.cs">
|
||||
<DependentUpon>TMEditor7.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Tools\Shuffler.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -293,6 +309,9 @@
|
||||
<EmbeddedResource Include="Misc\About.resx">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Subforms\Gen7\PersonalEditor7.resx">
|
||||
<DependentUpon>PersonalEditor7.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Subforms\Gen7\SMTE.resx">
|
||||
<DependentUpon>SMTE.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -308,6 +327,9 @@
|
||||
<EmbeddedResource Include="Subforms\Gen6\Experimental\MapPermView.resx">
|
||||
<DependentUpon>MapPermView.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Subforms\Gen7\TMEditor7.resx">
|
||||
<DependentUpon>TMEditor7.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Tools\Shuffler.resx">
|
||||
<DependentUpon>Shuffler.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user