Add Static Encounter editor

Thanks SciresM for finally finding these and working out the structure!
This commit is contained in:
Kaphotics
2016-05-03 20:26:53 -07:00
parent c7fd04f4cf
commit 5efd64805c
7 changed files with 687 additions and 8 deletions

29
pk3DS/Main.Designer.cs generated
View File

@@ -62,6 +62,7 @@ private void InitializeComponent()
this.unPackBCLIMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_BLZ = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_LZ11 = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_Shuffler = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_Rebuild = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_RomFS = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_ExeFS = new System.Windows.Forms.ToolStripMenuItem();
@@ -78,7 +79,7 @@ private void InitializeComponent()
this.B_Gift = new System.Windows.Forms.Button();
this.B_TypeChart = new System.Windows.Forms.Button();
this.B_Starter = new System.Windows.Forms.Button();
this.Menu_Shuffler = new System.Windows.Forms.ToolStripMenuItem();
this.B_Static = new System.Windows.Forms.Button();
this.GB_RomFS.SuspendLayout();
this.GB_ExeFS.SuspendLayout();
this.menuStrip1.SuspendLayout();
@@ -396,7 +397,7 @@ private void InitializeComponent()
this.Menu_Rebuild,
this.Menu_SMDH});
this.Menu_Tools.Name = "Menu_Tools";
this.Menu_Tools.Size = new System.Drawing.Size(48, 20);
this.Menu_Tools.Size = new System.Drawing.Size(47, 20);
this.Menu_Tools.Text = "Tools";
//
// Menu_Restore
@@ -439,6 +440,14 @@ private void InitializeComponent()
this.Menu_LZ11.Text = "(de)Compress LZ11";
this.Menu_LZ11.Click += new System.EventHandler(this.Menu_LZ11_Click);
//
// Menu_Shuffler
//
this.Menu_Shuffler.Enabled = false;
this.Menu_Shuffler.Name = "Menu_Shuffler";
this.Menu_Shuffler.Size = new System.Drawing.Size(176, 22);
this.Menu_Shuffler.Text = "GARC Shuffler";
this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click);
//
// Menu_Rebuild
//
this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -552,6 +561,7 @@ private void InitializeComponent()
//
this.GB_CRO.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.GB_CRO.Controls.Add(this.B_Static);
this.GB_CRO.Controls.Add(this.B_Gift);
this.GB_CRO.Controls.Add(this.B_TypeChart);
this.GB_CRO.Controls.Add(this.B_Starter);
@@ -593,13 +603,15 @@ private void InitializeComponent()
this.B_Starter.UseVisualStyleBackColor = true;
this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click);
//
// Menu_Shuffler
// B_Static
//
this.Menu_Shuffler.Enabled = false;
this.Menu_Shuffler.Name = "Menu_Shuffler";
this.Menu_Shuffler.Size = new System.Drawing.Size(176, 22);
this.Menu_Shuffler.Text = "GARC Shuffler";
this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click);
this.B_Static.Location = new System.Drawing.Point(324, 19);
this.B_Static.Name = "B_Static";
this.B_Static.Size = new System.Drawing.Size(100, 23);
this.B_Static.TabIndex = 3;
this.B_Static.Text = "Static Encounters";
this.B_Static.UseVisualStyleBackColor = true;
this.B_Static.Click += new System.EventHandler(this.B_Static_Click);
//
// Main
//
@@ -684,5 +696,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem Menu_CRO;
private System.Windows.Forms.Button B_Gift;
private System.Windows.Forms.ToolStripMenuItem Menu_Shuffler;
private System.Windows.Forms.Button B_Static;
}
}

View File

@@ -727,6 +727,20 @@ private void B_Gift_Click(object sender, EventArgs e)
}
new Gifts().ShowDialog();
}
private void B_Static_Click(object sender, EventArgs e)
{
if (threadActive()) return;
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo,
"CRO Editing causes crashes if you do not patch the RO module.", "Continue anyway?"))
return;
string CRO = Path.Combine(RomFSPath, "DllField.cro");
if (!File.Exists(CRO))
{
Util.Error("File Missing!", "DllField.cro was not found in your RomFS folder!");
return;
}
new StaticEncounters().ShowDialog();
}
private void backupCROs(bool overwrite, string path)
{
if (!Directory.Exists(path))

View File

@@ -872,6 +872,49 @@ public byte[] Write()
}
}
}
public class EncounterStatic
{
// All
public readonly byte[] Data;
public ushort Species
{
get { return BitConverter.ToUInt16(Data, 0x0); }
set { BitConverter.GetBytes(value).CopyTo(Data, 0x0); }
}
public byte Form { get { return Data[0x2]; } set { Data[0x2] = value; } }
public byte Level { get { return Data[0x3]; } set { Data[0x3] = value; } }
public int HeldItem
{
get
{
int item = BitConverter.ToInt16(Data, 0x4);
if (item < 0) item = 0;
return item;
}
set
{
if (value == 0) value = -1;
BitConverter.GetBytes((short)value).CopyTo(Data, 0x4);
}
}
public bool ShinyLock { get { return (Data[0x6] & 2) >> 1 == 1; } set { Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0)); } }
public int Gender { get { return (Data[0x6] & 0xC) >> 2; } set { Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2)); } }
public int Ability { get { return (Data[0x6] & 0x70) >> 4; } set { Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4)); } }
public bool IV3 { get { return (Data[0x7] & 1) >> 0 == 1; } set { Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0)); } }
public bool IV3_1 { get { return (Data[0x7] & 2) >> 1 == 1; } set { Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0)); } }
public EncounterStatic(byte[] data)
{
Data = (byte[])data.Clone();
}
public byte[] Write()
{
return (byte[])Data.Clone();
}
}
public class MegaEvolutions
{
public ushort[] Form, Method, Argument, u6;

View File

@@ -0,0 +1,318 @@
namespace pk3DS
{
partial class StaticEncounters
{
/// <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.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.LB_Gifts = new System.Windows.Forms.ListBox();
this.CB_Species = new System.Windows.Forms.ComboBox();
this.L_Species = new System.Windows.Forms.Label();
this.NUD_Level = new System.Windows.Forms.NumericUpDown();
this.L_Level = new System.Windows.Forms.Label();
this.NUD_Form = new System.Windows.Forms.NumericUpDown();
this.L_Form = new System.Windows.Forms.Label();
this.B_RandAll = new System.Windows.Forms.Button();
this.L_HeldItem = new System.Windows.Forms.Label();
this.CB_HeldItem = new System.Windows.Forms.ComboBox();
this.NUD_Ability = new System.Windows.Forms.NumericUpDown();
this.L_Ability = new System.Windows.Forms.Label();
this.NUD_Gender = new System.Windows.Forms.NumericUpDown();
this.L_Gender = new System.Windows.Forms.Label();
this.CHK_3IV = new System.Windows.Forms.CheckBox();
this.CHK_NoShiny = new System.Windows.Forms.CheckBox();
this.CHK_3IV_2 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).BeginInit();
this.SuspendLayout();
//
// B_Cancel
//
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Cancel.Location = new System.Drawing.Point(211, 296);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(70, 23);
this.B_Cancel.TabIndex = 467;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// B_Save
//
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Save.Location = new System.Drawing.Point(282, 296);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(70, 23);
this.B_Save.TabIndex = 466;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// LB_Gifts
//
this.LB_Gifts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.LB_Gifts.FormattingEnabled = true;
this.LB_Gifts.Location = new System.Drawing.Point(12, 12);
this.LB_Gifts.Name = "LB_Gifts";
this.LB_Gifts.Size = new System.Drawing.Size(110, 303);
this.LB_Gifts.TabIndex = 468;
this.LB_Gifts.SelectedIndexChanged += new System.EventHandler(this.changeIndex);
//
// CB_Species
//
this.CB_Species.FormattingEnabled = true;
this.CB_Species.Location = new System.Drawing.Point(196, 12);
this.CB_Species.Name = "CB_Species";
this.CB_Species.Size = new System.Drawing.Size(121, 21);
this.CB_Species.TabIndex = 469;
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies);
//
// L_Species
//
this.L_Species.Location = new System.Drawing.Point(96, 12);
this.L_Species.Name = "L_Species";
this.L_Species.Size = new System.Drawing.Size(94, 21);
this.L_Species.TabIndex = 477;
this.L_Species.Text = "Species:";
this.L_Species.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Level
//
this.NUD_Level.Location = new System.Drawing.Point(196, 66);
this.NUD_Level.Name = "NUD_Level";
this.NUD_Level.Size = new System.Drawing.Size(41, 20);
this.NUD_Level.TabIndex = 479;
this.NUD_Level.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// L_Level
//
this.L_Level.Location = new System.Drawing.Point(97, 64);
this.L_Level.Name = "L_Level";
this.L_Level.Size = new System.Drawing.Size(94, 21);
this.L_Level.TabIndex = 480;
this.L_Level.Text = "Level:";
this.L_Level.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Form
//
this.NUD_Form.Location = new System.Drawing.Point(283, 66);
this.NUD_Form.Name = "NUD_Form";
this.NUD_Form.Size = new System.Drawing.Size(34, 20);
this.NUD_Form.TabIndex = 481;
//
// L_Form
//
this.L_Form.Location = new System.Drawing.Point(189, 64);
this.L_Form.Name = "L_Form";
this.L_Form.Size = new System.Drawing.Size(94, 21);
this.L_Form.TabIndex = 482;
this.L_Form.Text = "Form:";
this.L_Form.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// B_RandAll
//
this.B_RandAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_RandAll.Location = new System.Drawing.Point(128, 296);
this.B_RandAll.Name = "B_RandAll";
this.B_RandAll.Size = new System.Drawing.Size(83, 23);
this.B_RandAll.TabIndex = 496;
this.B_RandAll.Text = "Randomize All";
this.B_RandAll.UseVisualStyleBackColor = true;
this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click);
//
// L_HeldItem
//
this.L_HeldItem.Location = new System.Drawing.Point(96, 38);
this.L_HeldItem.Name = "L_HeldItem";
this.L_HeldItem.Size = new System.Drawing.Size(94, 21);
this.L_HeldItem.TabIndex = 478;
this.L_HeldItem.Text = "Held Item:";
this.L_HeldItem.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CB_HeldItem
//
this.CB_HeldItem.FormattingEnabled = true;
this.CB_HeldItem.Location = new System.Drawing.Point(196, 39);
this.CB_HeldItem.Name = "CB_HeldItem";
this.CB_HeldItem.Size = new System.Drawing.Size(121, 21);
this.CB_HeldItem.TabIndex = 470;
//
// NUD_Ability
//
this.NUD_Ability.Location = new System.Drawing.Point(284, 91);
this.NUD_Ability.Maximum = new decimal(new int[] {
3,
0,
0,
0});
this.NUD_Ability.Name = "NUD_Ability";
this.NUD_Ability.Size = new System.Drawing.Size(34, 20);
this.NUD_Ability.TabIndex = 492;
//
// L_Ability
//
this.L_Ability.Location = new System.Drawing.Point(190, 89);
this.L_Ability.Name = "L_Ability";
this.L_Ability.Size = new System.Drawing.Size(94, 21);
this.L_Ability.TabIndex = 493;
this.L_Ability.Text = "Ability:";
this.L_Ability.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Gender
//
this.NUD_Gender.Location = new System.Drawing.Point(284, 117);
this.NUD_Gender.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.NUD_Gender.Name = "NUD_Gender";
this.NUD_Gender.Size = new System.Drawing.Size(34, 20);
this.NUD_Gender.TabIndex = 494;
//
// L_Gender
//
this.L_Gender.Location = new System.Drawing.Point(190, 115);
this.L_Gender.Name = "L_Gender";
this.L_Gender.Size = new System.Drawing.Size(94, 21);
this.L_Gender.TabIndex = 495;
this.L_Gender.Text = "Gender:";
this.L_Gender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// CHK_3IV
//
this.CHK_3IV.AutoSize = true;
this.CHK_3IV.Location = new System.Drawing.Point(132, 118);
this.CHK_3IV.Name = "CHK_3IV";
this.CHK_3IV.Size = new System.Drawing.Size(42, 17);
this.CHK_3IV.TabIndex = 497;
this.CHK_3IV.Text = "3IV";
this.CHK_3IV.UseVisualStyleBackColor = true;
//
// CHK_NoShiny
//
this.CHK_NoShiny.AutoSize = true;
this.CHK_NoShiny.Location = new System.Drawing.Point(132, 92);
this.CHK_NoShiny.Name = "CHK_NoShiny";
this.CHK_NoShiny.Size = new System.Drawing.Size(79, 17);
this.CHK_NoShiny.TabIndex = 498;
this.CHK_NoShiny.Text = "Shiny Lock";
this.CHK_NoShiny.UseVisualStyleBackColor = true;
//
// CHK_3IV_2
//
this.CHK_3IV_2.AutoSize = true;
this.CHK_3IV_2.Location = new System.Drawing.Point(132, 141);
this.CHK_3IV_2.Name = "CHK_3IV_2";
this.CHK_3IV_2.Size = new System.Drawing.Size(54, 17);
this.CHK_3IV_2.TabIndex = 499;
this.CHK_3IV_2.Text = "3IV_2";
this.CHK_3IV_2.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(201, 142);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(117, 130);
this.label1.TabIndex = 500;
this.label1.Text = "Ability:\r\n0: Random\r\n1: Ability 0\r\n2: Ability 1\r\n3: Hidden\r\n\r\nGender:\r\n0: Random/" +
"Genderless\r\n1: Male\r\n2: Female";
//
// StaticEncounters
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(364, 331);
this.Controls.Add(this.label1);
this.Controls.Add(this.CHK_3IV_2);
this.Controls.Add(this.CHK_NoShiny);
this.Controls.Add(this.CHK_3IV);
this.Controls.Add(this.B_RandAll);
this.Controls.Add(this.L_Gender);
this.Controls.Add(this.NUD_Gender);
this.Controls.Add(this.LB_Gifts);
this.Controls.Add(this.NUD_Level);
this.Controls.Add(this.L_Form);
this.Controls.Add(this.NUD_Form);
this.Controls.Add(this.CB_HeldItem);
this.Controls.Add(this.CB_Species);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.Controls.Add(this.L_Level);
this.Controls.Add(this.L_HeldItem);
this.Controls.Add(this.L_Species);
this.Controls.Add(this.L_Ability);
this.Controls.Add(this.NUD_Ability);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimumSize = new System.Drawing.Size(380, 370);
this.Name = "StaticEncounters";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Static Encounter Editor";
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Form)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Ability)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Gender)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.ListBox LB_Gifts;
private System.Windows.Forms.ComboBox CB_Species;
private System.Windows.Forms.Label L_Species;
private System.Windows.Forms.NumericUpDown NUD_Level;
private System.Windows.Forms.Label L_Level;
private System.Windows.Forms.NumericUpDown NUD_Form;
private System.Windows.Forms.Label L_Form;
private System.Windows.Forms.Button B_RandAll;
private System.Windows.Forms.Label L_Gender;
private System.Windows.Forms.NumericUpDown NUD_Gender;
private System.Windows.Forms.Label L_Ability;
private System.Windows.Forms.NumericUpDown NUD_Ability;
private System.Windows.Forms.ComboBox CB_HeldItem;
private System.Windows.Forms.Label L_HeldItem;
private System.Windows.Forms.CheckBox CHK_3IV;
private System.Windows.Forms.CheckBox CHK_NoShiny;
private System.Windows.Forms.CheckBox CHK_3IV_2;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,162 @@
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace pk3DS
{
public partial class StaticEncounters : Form
{
public StaticEncounters()
{
specieslist[0] = "---";
Array.Resize(ref specieslist, 722);
if (!File.Exists(FieldPath))
{
Util.Error("CRO does not exist! Closing.", FieldPath);
Close();
}
InitializeComponent();
specieslist[0] = "---";
abilitylist[0] = itemlist[0] = movelist[0] = "(None)"; // blank == -1
CB_Species.Items.Clear();
foreach (string s in specieslist)
CB_Species.Items.Add(s);
CB_HeldItem.Items.Clear();
foreach (string s in itemlist)
CB_HeldItem.Items.Add(s);
loadData();
}
private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro");
private byte[] FieldData;
private readonly int fieldOffset = Main.oras ? 0xF1B20 : 0xEE478;
private const int fieldSize = 0xC;
private readonly int count = Main.oras ? 0x3B : 0xC;
private EncounterStatic[] GiftData;
private readonly string[] abilitylist = Main.getText(Main.oras ? 37 : 34);
private readonly string[] movelist = Main.getText(Main.oras ? 14 : 13);
private readonly string[] itemlist = Main.getText(Main.oras ? 114 : 96);
private readonly string[] specieslist = Main.getText(Main.oras ? 98 : 80);
private void B_Save_Click(object sender, EventArgs e)
{
saveEntry();
saveData();
Close();
}
private void B_Cancel_Click(object sender, EventArgs e)
{
Close();
}
private void loadData()
{
FieldData = File.ReadAllBytes(FieldPath);
GiftData = new EncounterStatic[count];
LB_Gifts.Items.Clear();
for (int i = 0; i < GiftData.Length; i++)
{
GiftData[i] = new EncounterStatic(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray());
LB_Gifts.Items.Add($"{i.ToString("00")} - {specieslist[GiftData[i].Species]}");
}
loaded = true;
LB_Gifts.SelectedIndex = 0;
}
private void saveData()
{
for (int i = 0; i < GiftData.Length; i++)
{
int offset = fieldOffset + i*fieldSize;
// Write new data
Array.Copy(GiftData[i].Write(), 0, FieldData, offset, fieldSize);
}
File.WriteAllBytes(FieldPath, FieldData);
}
private int entry = -1;
private bool loaded;
private void changeIndex(object sender, EventArgs e)
{
if (LB_Gifts.SelectedIndex < 0)
return;
if (!loaded)
return;
if (entry != -1)
saveEntry();
entry = LB_Gifts.SelectedIndex;
loadEntry();
}
private void loadEntry()
{
bool oldloaded = loaded;
loaded = false;
CB_Species.SelectedIndex = GiftData[entry].Species;
CB_HeldItem.SelectedIndex = GiftData[entry].HeldItem;
NUD_Level.Value = GiftData[entry].Level;
NUD_Form.Value = GiftData[entry].Form;
NUD_Ability.Value = GiftData[entry].Ability;
NUD_Gender.Value = GiftData[entry].Gender;
CHK_NoShiny.Checked = GiftData[entry].ShinyLock;
CHK_3IV.Checked = GiftData[entry].IV3;
CHK_3IV_2.Checked = GiftData[entry].IV3_1;
loaded |= oldloaded;
}
private void saveEntry()
{
GiftData[entry].Species = (ushort)CB_Species.SelectedIndex;
GiftData[entry].HeldItem = CB_HeldItem.SelectedIndex;
GiftData[entry].Level = (byte)NUD_Level.Value;
GiftData[entry].Form = (byte)NUD_Form.Value;
GiftData[entry].Ability = (sbyte)NUD_Ability.Value;
GiftData[entry].Gender = (sbyte)NUD_Gender.Value;
GiftData[entry].ShinyLock = CHK_NoShiny.Checked;
GiftData[entry].IV3 = CHK_3IV.Checked;
GiftData[entry].IV3_1 = CHK_3IV_2.Checked;
}
private void B_RandAll_Click(object sender, EventArgs e)
{
DialogResult ync = Util.Prompt(MessageBoxButtons.YesNoCancel,
"Randomize by BST: Yes" + Environment.NewLine +
"Randomize Randomly: No" + Environment.NewLine +
"Abort: Cancel");
if (ync != DialogResult.Yes && ync != DialogResult.No)
return;
if (ync == DialogResult.No)
{
for (int i = 0; i < LB_Gifts.Items.Count; i++)
{
LB_Gifts.SelectedIndex = i;
int species = Util.rand.Next(1, 721);
CB_Species.SelectedIndex = species;
}
return;
}
// Randomize by BST
int[] sL = Randomizer.getSpeciesList(G1: true, G2: true, G3: true, G4: true, G5: true, G6: true, L: false, E: false, Shedinja: false);
int ctr = 0;
for (int i = 0; i < LB_Gifts.Items.Count; i++)
{
LB_Gifts.SelectedIndex = i;
int species = CB_Species.SelectedIndex;
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))
pkm = Main.SpeciesStat[species = Randomizer.getRandomSpecies(ref sL, ref ctr)];
CB_Species.SelectedIndex = species;
}
}
private void changeSpecies(object sender, EventArgs e)
{
int index = LB_Gifts.SelectedIndex;
LB_Gifts.Items[index] = index.ToString("00") + " - " + CB_Species.Text;
}
}
}

View 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>

View File

@@ -69,6 +69,12 @@
<Compile Include="Randomizer.cs" />
<Compile Include="3DS\RomFS.cs" />
<Compile Include="Structs.cs" />
<Compile Include="Subforms\StaticEncounters.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Subforms\StaticEncounters.Designer.cs">
<DependentUpon>StaticEncounters.cs</DependentUpon>
</Compile>
<Compile Include="Subforms\Gifts.cs">
<SubType>Form</SubType>
</Compile>
@@ -255,6 +261,9 @@
<EmbeddedResource Include="Misc\About.resx">
<DependentUpon>About.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Subforms\StaticEncounters.resx">
<DependentUpon>StaticEncounters.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Subforms\Gifts.resx">
<DependentUpon>Gifts.cs</DependentUpon>
</EmbeddedResource>