Revert & Improve on Level Up + Egg Move forms

Changed back to the sorted list by creating and using a datasource for
LevelUp.
Added a Sprite Preview window
Carried changes over to Egg Move Editor
This commit is contained in:
Kurt
2015-04-19 13:23:22 -07:00
parent 5262c21a0a
commit 67b73925a2
4 changed files with 69 additions and 18 deletions

View File

@@ -41,10 +41,12 @@ private void InitializeComponent()
this.NUD_STAB = new System.Windows.Forms.NumericUpDown();
this.CHK_STAB = new System.Windows.Forms.CheckBox();
this.CHK_HMs = new System.Windows.Forms.CheckBox();
this.PB_MonSprite = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MonSprite)).BeginInit();
this.SuspendLayout();
//
// dgv
@@ -92,7 +94,7 @@ private void InitializeComponent()
//
// B_Dump
//
this.B_Dump.Location = new System.Drawing.Point(193, 10);
this.B_Dump.Location = new System.Drawing.Point(248, 10);
this.B_Dump.Name = "B_Dump";
this.B_Dump.Size = new System.Drawing.Size(46, 23);
this.B_Dump.TabIndex = 5;
@@ -205,11 +207,20 @@ private void InitializeComponent()
this.CHK_HMs.Text = "Allow HMs";
this.CHK_HMs.UseVisualStyleBackColor = true;
//
// PB_MonSprite
//
this.PB_MonSprite.Location = new System.Drawing.Point(193, 5);
this.PB_MonSprite.Name = "PB_MonSprite";
this.PB_MonSprite.Size = new System.Drawing.Size(40, 30);
this.PB_MonSprite.TabIndex = 91;
this.PB_MonSprite.TabStop = false;
//
// EggMove
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 412);
this.Controls.Add(this.PB_MonSprite);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.B_Dump);
this.Controls.Add(this.B_RandAll);
@@ -227,6 +238,7 @@ private void InitializeComponent()
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MonSprite)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -247,5 +259,6 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown NUD_STAB;
private System.Windows.Forms.CheckBox CHK_STAB;
private System.Windows.Forms.CheckBox CHK_HMs;
private System.Windows.Forms.PictureBox PB_MonSprite;
}
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Media;
using System.Text;
using System.Windows.Forms;
using pk3DS.Properties;
namespace pk3DS
{
@@ -13,29 +15,31 @@ public partial class EggMove : Form
public EggMove()
{
InitializeComponent();
string[] specieslist = Main.getText((Main.oras) ? 98 : 80);
specieslist[0] = movelist[0] = "";
Array.Resize(ref specieslist, 722);
sortedmoves = (string[])movelist.Clone();
Array.Sort(sortedmoves);
string[] sortedspecies = (string[])specieslist.Clone();
Array.Sort(sortedspecies);
foreach (string s in sortedspecies) CB_Species.Items.Add(s);
CB_Species.Items.RemoveAt(0);
Array.Resize(ref sortedspecies, 722); Array.Sort(sortedspecies);
setupDGV();
var newlist = new List<Util.cbItem>();
for (int i = 1; i < 722; i++) // add all species
newlist.Add(new Util.cbItem { Text = sortedspecies[i], Value = Array.IndexOf(specieslist, sortedspecies[i]) });
CB_Species.DisplayMember = "Text";
CB_Species.ValueMember = "Value";
CB_Species.DataSource = newlist;
CB_Species.SelectedIndex = 0;
}
private string[] files = Directory.GetFiles("eggmove");
private byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
private int entry = -1;
private string[] movelist = Main.getText((Main.oras) ? 14 : 13);
private string[] specieslist = Main.getText((Main.oras) ? 98 : 80);
private string[] sortedmoves;
bool dumping;
private void setupDGV()
{
string[] sortedmoves = (string[])movelist.Clone();
Array.Sort(sortedmoves);
DataGridViewComboBoxColumn dgvMove = new DataGridViewComboBoxColumn();
{
dgvMove.HeaderText = "Move";
@@ -50,7 +54,12 @@ private void setupDGV()
}
private void getList()
{
entry = Array.IndexOf(specieslist, CB_Species.Text);
entry = Util.getIndex(CB_Species);
int[] specForm = Personal.getSpecies(data, Main.oras, entry);
string filename = "_" + specForm[0] + ((entry > 721) ? "_" + (specForm[1] + 1) : "");
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
dgv.Rows.Clear();
byte[] input = File.ReadAllBytes(files[entry]);
if (input.Length == 0) return;

View File

@@ -45,11 +45,13 @@ private void InitializeComponent()
this.NUD_STAB = new System.Windows.Forms.NumericUpDown();
this.CHK_STAB = new System.Windows.Forms.CheckBox();
this.CHK_HMs = new System.Windows.Forms.CheckBox();
this.PB_MonSprite = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MonSprite)).BeginInit();
this.SuspendLayout();
//
// dgv
@@ -72,7 +74,7 @@ private void InitializeComponent()
this.CB_Species.FormattingEnabled = true;
this.CB_Species.Location = new System.Drawing.Point(66, 12);
this.CB_Species.Name = "CB_Species";
this.CB_Species.Size = new System.Drawing.Size(140, 21);
this.CB_Species.Size = new System.Drawing.Size(121, 21);
this.CB_Species.TabIndex = 1;
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeEntry);
//
@@ -261,11 +263,20 @@ private void InitializeComponent()
this.CHK_HMs.Text = "Allow HMs";
this.CHK_HMs.UseVisualStyleBackColor = true;
//
// PB_MonSprite
//
this.PB_MonSprite.Location = new System.Drawing.Point(193, 5);
this.PB_MonSprite.Name = "PB_MonSprite";
this.PB_MonSprite.Size = new System.Drawing.Size(40, 30);
this.PB_MonSprite.TabIndex = 90;
this.PB_MonSprite.TabStop = false;
//
// LevelUp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 412);
this.Controls.Add(this.PB_MonSprite);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.B_Dump);
this.Controls.Add(this.B_RandAll);
@@ -284,6 +295,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_Moves)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_STAB)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MonSprite)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -308,5 +320,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label L_Moves;
private System.Windows.Forms.NumericUpDown NUD_Moves;
private System.Windows.Forms.CheckBox CHK_Expand;
private System.Windows.Forms.PictureBox PB_MonSprite;
}
}

View File

@@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Media;
using System.Text;
using System.Windows.Forms;
using pk3DS.Properties;
namespace pk3DS
{
@@ -16,14 +18,23 @@ public LevelUp()
string[] specieslist = Personal.getSpeciesIndexStrings(Main.oras);
specieslist[0] = movelist[0] = "";
string[] sortedspecies = (string[])specieslist.Clone();
Array.Resize(ref sortedspecies, 722); Array.Sort(sortedspecies);
setupDGV();
// Sort Species list
for (int i = 0; i < specieslist.Length; i++)
CB_Species.Items.Add(String.Format("{0} - {1}", specieslist[i], i.ToString("000")));
var newlist = new List<Util.cbItem>();
for (int i = 1; i < 722; 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
newlist.Add(new Util.cbItem { Text = specieslist[i], Value = i });
CB_Species.DisplayMember = "Text";
CB_Species.ValueMember = "Value";
CB_Species.DataSource = newlist;
CB_Species.SelectedIndex = 0;
}
private string[] files = Directory.GetFiles("levelup");
private byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
private int entry = -1;
private string[] movelist = Main.getText((Main.oras) ? 14 : 13);
bool dumping;
@@ -53,7 +64,12 @@ private void setupDGV()
}
private void getList()
{
entry = CB_Species.SelectedIndex;
entry = Util.getIndex(CB_Species);
int[] specForm = Personal.getSpecies(data, Main.oras, entry);
string filename = "_" + specForm[0] + ((entry > 721) ? "_" + (specForm[1] + 1) : "");
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
dgv.Rows.Clear();
byte[] input = File.ReadAllBytes(files[entry]);
if (input.Length <= 4) { File.WriteAllBytes(files[entry], BitConverter.GetBytes(-1)); return; }