diff --git a/BW_tool/BW_tool.csproj b/BW_tool/BW_tool.csproj index 03c4cee..148cd46 100644 --- a/BW_tool/BW_tool.csproj +++ b/BW_tool/BW_tool.csproj @@ -79,6 +79,10 @@ Medals.cs + + + TrainerInfo.cs + TrainerRec.cs @@ -122,6 +126,9 @@ Medals.cs + + TrainerInfo.cs + TrainerRec.cs diff --git a/BW_tool/Editors/TrainerInfo.Designer.cs b/BW_tool/Editors/TrainerInfo.Designer.cs new file mode 100644 index 0000000..5ec907b --- /dev/null +++ b/BW_tool/Editors/TrainerInfo.Designer.cs @@ -0,0 +1,613 @@ +/* + * Created by SharpDevelop. + * User: sergi + * Date: 17/06/2016 + * Time: 21:33 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +namespace BW_tool +{ + partial class TrainerInfo + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.NumericUpDown seconds; + private System.Windows.Forms.NumericUpDown minutes; + private System.Windows.Forms.NumericUpDown hours; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.NumericUpDown tid; + private System.Windows.Forms.NumericUpDown sid; + private System.Windows.Forms.ComboBox tnr_class; + private System.Windows.Forms.ComboBox tnr_nature; + private System.Windows.Forms.TextBox name; + private System.Windows.Forms.TextBox rival_name; + private System.Windows.Forms.NumericUpDown money; + private System.Windows.Forms.NumericUpDown bp; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.ComboBox gender; + private System.Windows.Forms.Button Exit_but; + private System.Windows.Forms.Button Saveexit_but; + private System.Windows.Forms.CheckBox badge1; + private System.Windows.Forms.DateTimePicker badge1_date; + private System.Windows.Forms.DateTimePicker dateTimePicker1; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.DateTimePicker dateTimePicker2; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.DateTimePicker dateTimePicker3; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.DateTimePicker dateTimePicker4; + private System.Windows.Forms.CheckBox checkBox4; + private System.Windows.Forms.DateTimePicker dateTimePicker5; + private System.Windows.Forms.CheckBox checkBox5; + private System.Windows.Forms.DateTimePicker dateTimePicker6; + private System.Windows.Forms.CheckBox checkBox6; + private System.Windows.Forms.DateTimePicker dateTimePicker7; + private System.Windows.Forms.CheckBox checkBox7; + + /// + /// Disposes resources used by the form. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.seconds = new System.Windows.Forms.NumericUpDown(); + this.minutes = new System.Windows.Forms.NumericUpDown(); + this.hours = new System.Windows.Forms.NumericUpDown(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.tid = new System.Windows.Forms.NumericUpDown(); + this.sid = new System.Windows.Forms.NumericUpDown(); + this.tnr_class = new System.Windows.Forms.ComboBox(); + this.tnr_nature = new System.Windows.Forms.ComboBox(); + this.name = new System.Windows.Forms.TextBox(); + this.rival_name = new System.Windows.Forms.TextBox(); + this.money = new System.Windows.Forms.NumericUpDown(); + this.bp = new System.Windows.Forms.NumericUpDown(); + this.label12 = new System.Windows.Forms.Label(); + this.gender = new System.Windows.Forms.ComboBox(); + this.Exit_but = new System.Windows.Forms.Button(); + this.Saveexit_but = new System.Windows.Forms.Button(); + this.badge1 = new System.Windows.Forms.CheckBox(); + this.badge1_date = new System.Windows.Forms.DateTimePicker(); + this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker(); + this.checkBox4 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker5 = new System.Windows.Forms.DateTimePicker(); + this.checkBox5 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker6 = new System.Windows.Forms.DateTimePicker(); + this.checkBox6 = new System.Windows.Forms.CheckBox(); + this.dateTimePicker7 = new System.Windows.Forms.DateTimePicker(); + this.checkBox7 = new System.Windows.Forms.CheckBox(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.seconds)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.minutes)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.hours)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.money)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bp)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(12, 28); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(51, 23); + this.label1.TabIndex = 0; + this.label1.Text = "Name"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(12, 53); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(51, 23); + this.label2.TabIndex = 1; + this.label2.Text = "TID"; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(12, 79); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(51, 23); + this.label3.TabIndex = 2; + this.label3.Text = "SID"; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(14, 268); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(51, 23); + this.label4.TabIndex = 3; + this.label4.Text = "Rival"; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(250, 28); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(51, 23); + this.label5.TabIndex = 4; + this.label5.Text = "Money"; + // + // label6 + // + this.label6.Location = new System.Drawing.Point(12, 106); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(76, 23); + this.label6.TabIndex = 5; + this.label6.Text = "Trainer class"; + // + // label7 + // + this.label7.Location = new System.Drawing.Point(12, 133); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(86, 23); + this.label7.TabIndex = 6; + this.label7.Text = "Trainer nature"; + // + // label8 + // + this.label8.Location = new System.Drawing.Point(250, 56); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(71, 23); + this.label8.TabIndex = 7; + this.label8.Text = "Battle Points"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.seconds); + this.groupBox1.Controls.Add(this.minutes); + this.groupBox1.Controls.Add(this.hours); + this.groupBox1.Controls.Add(this.label11); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.label9); + this.groupBox1.Location = new System.Drawing.Point(12, 157); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(209, 93); + this.groupBox1.TabIndex = 8; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Playtime"; + // + // seconds + // + this.seconds.Location = new System.Drawing.Point(83, 65); + this.seconds.Maximum = new decimal(new int[] { + 59, + 0, + 0, + 0}); + this.seconds.Name = "seconds"; + this.seconds.Size = new System.Drawing.Size(120, 20); + this.seconds.TabIndex = 13; + // + // minutes + // + this.minutes.Location = new System.Drawing.Point(83, 42); + this.minutes.Maximum = new decimal(new int[] { + 59, + 0, + 0, + 0}); + this.minutes.Name = "minutes"; + this.minutes.Size = new System.Drawing.Size(120, 20); + this.minutes.TabIndex = 12; + // + // hours + // + this.hours.Location = new System.Drawing.Point(83, 19); + this.hours.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.hours.Name = "hours"; + this.hours.Size = new System.Drawing.Size(120, 20); + this.hours.TabIndex = 11; + // + // label11 + // + this.label11.Location = new System.Drawing.Point(6, 67); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(86, 23); + this.label11.TabIndex = 10; + this.label11.Text = "Seconds"; + // + // label10 + // + this.label10.Location = new System.Drawing.Point(6, 44); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(86, 23); + this.label10.TabIndex = 10; + this.label10.Text = "Minutes"; + // + // label9 + // + this.label9.Location = new System.Drawing.Point(6, 21); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(86, 23); + this.label9.TabIndex = 9; + this.label9.Text = "Hours"; + // + // tid + // + this.tid.Location = new System.Drawing.Point(95, 51); + this.tid.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.tid.Name = "tid"; + this.tid.Size = new System.Drawing.Size(120, 20); + this.tid.TabIndex = 9; + // + // sid + // + this.sid.Location = new System.Drawing.Point(95, 77); + this.sid.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.sid.Name = "sid"; + this.sid.Size = new System.Drawing.Size(120, 20); + this.sid.TabIndex = 10; + // + // tnr_class + // + this.tnr_class.FormattingEnabled = true; + this.tnr_class.Items.AddRange(new object[] { + "Youngster", + "Ace trainer", + "PKMN Ranger", + "PKMN Breeder", + "Scientist", + "Hiker", + "Roughneck", + "Preschooler"}); + this.tnr_class.Location = new System.Drawing.Point(94, 103); + this.tnr_class.Name = "tnr_class"; + this.tnr_class.Size = new System.Drawing.Size(121, 21); + this.tnr_class.TabIndex = 11; + // + // tnr_nature + // + this.tnr_nature.FormattingEnabled = true; + this.tnr_nature.Items.AddRange(new object[] { + "Hardy", + "Lonely", + "Brave", + "Adamant", + "Naughty", + "Bold", + "Docile", + "Relaxed", + "Impish", + "Lax", + "Timid", + "Hasty", + "Serious", + "Jolly", + "Naive", + "Modest", + "Mild", + "Quiet", + "Bashful", + "Rash", + "Calm", + "Gentle", + "Sassy", + "Careful", + "Quirky"}); + this.tnr_nature.Location = new System.Drawing.Point(94, 130); + this.tnr_nature.Name = "tnr_nature"; + this.tnr_nature.Size = new System.Drawing.Size(121, 21); + this.tnr_nature.TabIndex = 12; + // + // name + // + this.name.Location = new System.Drawing.Point(94, 25); + this.name.MaxLength = 8; + this.name.Name = "name"; + this.name.Size = new System.Drawing.Size(120, 20); + this.name.TabIndex = 13; + // + // rival_name + // + this.rival_name.Location = new System.Drawing.Point(94, 265); + this.rival_name.MaxLength = 8; + this.rival_name.Name = "rival_name"; + this.rival_name.Size = new System.Drawing.Size(120, 20); + this.rival_name.TabIndex = 14; + // + // money + // + this.money.Location = new System.Drawing.Point(330, 26); + this.money.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.money.Name = "money"; + this.money.Size = new System.Drawing.Size(120, 20); + this.money.TabIndex = 14; + // + // bp + // + this.bp.Location = new System.Drawing.Point(330, 54); + this.bp.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.bp.Name = "bp"; + this.bp.Size = new System.Drawing.Size(120, 20); + this.bp.TabIndex = 15; + // + // label12 + // + this.label12.Location = new System.Drawing.Point(250, 81); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(71, 23); + this.label12.TabIndex = 16; + this.label12.Text = "Gender"; + // + // gender + // + this.gender.FormattingEnabled = true; + this.gender.Items.AddRange(new object[] { + "Male", + "Female"}); + this.gender.Location = new System.Drawing.Point(330, 78); + this.gender.Name = "gender"; + this.gender.Size = new System.Drawing.Size(121, 21); + this.gender.TabIndex = 17; + // + // Exit_but + // + this.Exit_but.Location = new System.Drawing.Point(12, 310); + this.Exit_but.Name = "Exit_but"; + this.Exit_but.Size = new System.Drawing.Size(102, 23); + this.Exit_but.TabIndex = 19; + this.Exit_but.Text = "Exit"; + this.Exit_but.UseVisualStyleBackColor = true; + this.Exit_but.Click += new System.EventHandler(this.Exit_butClick); + // + // Saveexit_but + // + this.Saveexit_but.Location = new System.Drawing.Point(119, 310); + this.Saveexit_but.Name = "Saveexit_but"; + this.Saveexit_but.Size = new System.Drawing.Size(102, 23); + this.Saveexit_but.TabIndex = 18; + this.Saveexit_but.Text = "Save and Exit"; + this.Saveexit_but.UseVisualStyleBackColor = true; + this.Saveexit_but.Click += new System.EventHandler(this.Saveexit_butClick); + // + // badge1 + // + this.badge1.Location = new System.Drawing.Point(250, 126); + this.badge1.Name = "badge1"; + this.badge1.Size = new System.Drawing.Size(125, 29); + this.badge1.TabIndex = 20; + this.badge1.Text = "Badge 1"; + this.badge1.UseVisualStyleBackColor = true; + // + // badge1_date + // + this.badge1_date.Location = new System.Drawing.Point(317, 127); + this.badge1_date.Name = "badge1_date"; + this.badge1_date.Size = new System.Drawing.Size(200, 20); + this.badge1_date.TabIndex = 21; + // + // dateTimePicker1 + // + this.dateTimePicker1.Location = new System.Drawing.Point(317, 153); + this.dateTimePicker1.Name = "dateTimePicker1"; + this.dateTimePicker1.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker1.TabIndex = 23; + // + // checkBox1 + // + this.checkBox1.Location = new System.Drawing.Point(250, 152); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(125, 29); + this.checkBox1.TabIndex = 22; + this.checkBox1.Text = "Badge 1"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // dateTimePicker2 + // + this.dateTimePicker2.Location = new System.Drawing.Point(317, 179); + this.dateTimePicker2.Name = "dateTimePicker2"; + this.dateTimePicker2.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker2.TabIndex = 25; + // + // checkBox2 + // + this.checkBox2.Location = new System.Drawing.Point(250, 178); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(125, 29); + this.checkBox2.TabIndex = 24; + this.checkBox2.Text = "Badge 1"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // dateTimePicker3 + // + this.dateTimePicker3.Location = new System.Drawing.Point(317, 205); + this.dateTimePicker3.Name = "dateTimePicker3"; + this.dateTimePicker3.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker3.TabIndex = 27; + // + // checkBox3 + // + this.checkBox3.Location = new System.Drawing.Point(250, 204); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(125, 29); + this.checkBox3.TabIndex = 26; + this.checkBox3.Text = "Badge 1"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // dateTimePicker4 + // + this.dateTimePicker4.Location = new System.Drawing.Point(317, 231); + this.dateTimePicker4.Name = "dateTimePicker4"; + this.dateTimePicker4.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker4.TabIndex = 29; + // + // checkBox4 + // + this.checkBox4.Location = new System.Drawing.Point(250, 230); + this.checkBox4.Name = "checkBox4"; + this.checkBox4.Size = new System.Drawing.Size(125, 29); + this.checkBox4.TabIndex = 28; + this.checkBox4.Text = "Badge 1"; + this.checkBox4.UseVisualStyleBackColor = true; + // + // dateTimePicker5 + // + this.dateTimePicker5.Location = new System.Drawing.Point(317, 257); + this.dateTimePicker5.Name = "dateTimePicker5"; + this.dateTimePicker5.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker5.TabIndex = 31; + // + // checkBox5 + // + this.checkBox5.Location = new System.Drawing.Point(250, 256); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.Size = new System.Drawing.Size(125, 29); + this.checkBox5.TabIndex = 30; + this.checkBox5.Text = "Badge 1"; + this.checkBox5.UseVisualStyleBackColor = true; + // + // dateTimePicker6 + // + this.dateTimePicker6.Location = new System.Drawing.Point(317, 283); + this.dateTimePicker6.Name = "dateTimePicker6"; + this.dateTimePicker6.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker6.TabIndex = 33; + // + // checkBox6 + // + this.checkBox6.Location = new System.Drawing.Point(250, 282); + this.checkBox6.Name = "checkBox6"; + this.checkBox6.Size = new System.Drawing.Size(125, 29); + this.checkBox6.TabIndex = 32; + this.checkBox6.Text = "Badge 1"; + this.checkBox6.UseVisualStyleBackColor = true; + // + // dateTimePicker7 + // + this.dateTimePicker7.Location = new System.Drawing.Point(317, 309); + this.dateTimePicker7.Name = "dateTimePicker7"; + this.dateTimePicker7.Size = new System.Drawing.Size(200, 20); + this.dateTimePicker7.TabIndex = 35; + // + // checkBox7 + // + this.checkBox7.Location = new System.Drawing.Point(250, 308); + this.checkBox7.Name = "checkBox7"; + this.checkBox7.Size = new System.Drawing.Size(125, 29); + this.checkBox7.TabIndex = 34; + this.checkBox7.Text = "Badge 1"; + this.checkBox7.UseVisualStyleBackColor = true; + // + // TrainerInfo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(529, 348); + this.Controls.Add(this.dateTimePicker7); + this.Controls.Add(this.checkBox7); + this.Controls.Add(this.dateTimePicker6); + this.Controls.Add(this.checkBox6); + this.Controls.Add(this.dateTimePicker5); + this.Controls.Add(this.checkBox5); + this.Controls.Add(this.dateTimePicker4); + this.Controls.Add(this.checkBox4); + this.Controls.Add(this.dateTimePicker3); + this.Controls.Add(this.checkBox3); + this.Controls.Add(this.dateTimePicker2); + this.Controls.Add(this.checkBox2); + this.Controls.Add(this.dateTimePicker1); + this.Controls.Add(this.checkBox1); + this.Controls.Add(this.badge1_date); + this.Controls.Add(this.badge1); + this.Controls.Add(this.Exit_but); + this.Controls.Add(this.Saveexit_but); + this.Controls.Add(this.gender); + this.Controls.Add(this.label12); + this.Controls.Add(this.bp); + this.Controls.Add(this.money); + this.Controls.Add(this.rival_name); + this.Controls.Add(this.name); + this.Controls.Add(this.tnr_nature); + this.Controls.Add(this.tnr_class); + this.Controls.Add(this.sid); + this.Controls.Add(this.tid); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "TrainerInfo"; + this.Text = "Trainer Info"; + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.seconds)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.minutes)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.hours)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.money)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bp)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + } +} diff --git a/BW_tool/Editors/TrainerInfo.cs b/BW_tool/Editors/TrainerInfo.cs new file mode 100644 index 0000000..8455084 --- /dev/null +++ b/BW_tool/Editors/TrainerInfo.cs @@ -0,0 +1,472 @@ +/* + * Created by SharpDevelop. + * User: sergi + * Date: 17/06/2016 + * Time: 21:33 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using System.Windows.Forms; +using System.Linq; +using System.Text; + +namespace BW_tool +{ + /// + /// Description of TrainerInfo. + /// + public partial class TrainerInfo : Form + { + TRAINER ash; + int trainer_block = 27; + RIVAL gary; + int rival_block = 66; + BADGES badge; + int badges_block = 52; + BATTLE battle; + int battle_block = 57; + CARDSIG card; + int cardsig_block = 33; + + public TrainerInfo() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + money.Maximum = 9999999; + bp.Maximum = 9999; + + ash = new TRAINER(MainForm.save.getBlock(trainer_block)); + gary = new RIVAL(MainForm.save.getBlock(rival_block)); + badge = new BADGES(MainForm.save.getBlock(badges_block)); + battle = new BATTLE(MainForm.save.getBlock(battle_block)); + card = new CARDSIG(MainForm.save.getBlock(cardsig_block)); + + load_data(); + + // + // TODO: Add constructor code after the InitializeComponent() call. + // + } + + void load_data() + { + name.Text = ash.name; + rival_name.Text = gary.name; + + tid.Value = ash.TID; + sid.Value = ash.SID; + + money.Value = badge.money; + + + if (ash.gender == 0) + { + tnr_class.Items.Clear(); + tnr_class.Items.AddRange(new object[] { + "Youngster", + "Ace trainer", + "PKMN Ranger", + "PKMN Breeder", + "Scientist", + "Hiker", + "Roughneck", + "Preschooler"}); + tnr_class.SelectedIndex = ash.trainer_class; + } + else + { + tnr_class.Items.Clear(); + tnr_class.Items.AddRange(new object[] { + "Lass", + "Ace trainer", + "PKMN Ranger", + "PKMN Breeder", + "Scientist", + "Parasol Lady", + "Nurse", + "Preschooler"}); + tnr_class.SelectedIndex = ash.trainer_class-8; + } + gender.SelectedIndex = ash.gender; + + hours.Value = ash.hours; + minutes.Value = ash.minutes; + seconds.Value = ash.seconds; + + bp.Value = battle.bp; + + tnr_nature.SelectedIndex = card.nature; + + badge1.Checked = badge.badge1; + badge1_date.Value = card.badge1; + + } + + void set_data() + { + ash.name = name.Text; + gary.name = rival_name.Text; + + ash.TID = (UInt16)tid.Value; + ash.SID = (UInt16)sid.Value; + + badge.money = (UInt32)money.Value; + + ash.gender = (byte)gender.SelectedIndex; + + if(gender.SelectedIndex == 1) + ash.trainer_class = (byte)(tnr_class.SelectedIndex+8); + else + ash.trainer_class = (byte)(tnr_class.SelectedIndex); + + + ash.hours = (UInt16)hours.Value; + ash.minutes = (byte)minutes.Value ; + ash.seconds = (byte)seconds.Value; + + battle.bp = (UInt16)bp.Value; + + card.nature = (byte)tnr_nature.SelectedIndex; + + + + } + void Exit_butClick(object sender, EventArgs e) + { + this.Close(); + } + void Saveexit_butClick(object sender, EventArgs e) + { + MainForm.save.setBlock(ash.Data, trainer_block); + MainForm.save.setBlock(gary.Data, rival_block); + MainForm.save.setBlock(badge.Data, badges_block); + MainForm.save.setBlock(battle.Data, badges_block); + MainForm.save.setBlock(card.Data, badges_block); + this.Close(); + } + + public class TRAINER + { + internal int Size = MainForm.save.getBlockLength(27);//Block 67 + + public byte[] Data; + public TRAINER(byte[] data = null) + { + Data = data ?? new byte[Size]; + + } + public byte[] getData(int Offset, int Length) + { + return Data.Skip(Offset).Take(Length).ToArray(); + } + public void setData(byte[] input, int Offset) + { + input.CopyTo(Data, Offset); + } + + //Helper functions from pkhex + internal static string TrimFromFFFF(string input) + { + int index = input.IndexOf((char)0xFFFF); + return index < 0 ? input : input.Substring(0, index); + } + + public string name + { + get + { + return TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x04, 0xE)) + .Replace("\uE08F", "\u2640") // nidoran + .Replace("\uE08E", "\u2642") // nidoran + .Replace("\u2019", "\u0027"); // farfetch'd + } + set + { + if (value.Length > 0xE/2) + value = value.Substring(0, 0xE/2); // Hard cap + string TempNick = value // Replace Special Characters and add Terminator + .Replace("\u2640", "\uE08F") // nidoran + .Replace("\u2642", "\uE08E") // nidoran + .Replace("\u0027", "\u2019") // farfetch'd + .PadRight(value.Length + 1, (char)0xFFFF); // Null Terminator + Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0x04); + } + } + public UInt16 TID + { + get + { + return BitConverter.ToUInt16(getData(0x14, 2), 0); + } + set + { + setData(BitConverter.GetBytes(value), 0x14); + } + } + public UInt16 SID + { + get + { + return BitConverter.ToUInt16(getData(0x16, 2), 0); + } + set + { + setData(BitConverter.GetBytes(value), 0x16); + } + } + public UInt16 hours + { + get + { + return BitConverter.ToUInt16(getData(0x24, 2), 0); + } + set + { + setData(BitConverter.GetBytes(value), 0x24); + } + } + public byte minutes + { + get + { + return Data[0x26]; + } + set + { + Data[0x26] = (byte) value; + } + } + public byte seconds + { + get + { + return Data[0x27]; + } + set + { + Data[0x27] = (byte) value; + } + } + + public int gender + { + get + { + if (Data[0x21] == 0x01) + return 1; + else + return 0; + } + set + { + if (value == 1) + Data[0x21] = 0x01; + else + Data[0x21] = 0; + } + } + + public byte trainer_class + { + get + { + return Data[0x20]; + } + set + { + Data[0x20] = (byte) value; + } + } + + + } + public class RIVAL + { + internal int Size = MainForm.save.getBlockLength(66);//Block 66 + + public byte[] Data; + public RIVAL(byte[] data = null) + { + Data = data ?? new byte[Size]; + + } + public byte[] getData(int Offset, int Length) + { + return Data.Skip(Offset).Take(Length).ToArray(); + } + public void setData(byte[] input, int Offset) + { + input.CopyTo(Data, Offset); + } + + //Helper functions from pkhex + internal static string TrimFromFFFF(string input) + { + int index = input.IndexOf((char)0xFFFF); + return index < 0 ? input : input.Substring(0, index); + } + + public string name + { + get + { + return TrimFromFFFF(Encoding.Unicode.GetString(Data, 0xA4, 0xE)) + .Replace("\uE08F", "\u2640") // nidoran + .Replace("\uE08E", "\u2642") // nidoran + .Replace("\u2019", "\u0027"); // farfetch'd + } + set + { + if (value.Length > 0xE/2) + value = value.Substring(0, 0xE/2); // Hard cap + string TempNick = value // Replace Special Characters and add Terminator + .Replace("\u2640", "\uE08F") // nidoran + .Replace("\u2642", "\uE08E") // nidoran + .Replace("\u0027", "\u2019") // farfetch'd + .PadRight(value.Length + 1, (char)0xFFFF); // Null Terminator + Encoding.Unicode.GetBytes(TempNick).CopyTo(Data, 0xA4); + } + } + } + + public class BADGES + { + internal int Size = MainForm.save.getBlockLength(52);//Block 66 + + public byte[] Data; + public BADGES(byte[] data = null) + { + Data = data ?? new byte[Size]; + + } + public byte[] getData(int Offset, int Length) + { + return Data.Skip(Offset).Take(Length).ToArray(); + } + public void setData(byte[] input, int Offset) + { + input.CopyTo(Data, Offset); + } + + public UInt32 money + { + get + { + return BitConverter.ToUInt32(getData(0, 4), 0); + } + set + { + setData(BitConverter.GetBytes((UInt32)value), 0); + } + } + + public bool badge1 + { + get + { + if ((Data[0x4] & 0x1) != 0) + return true; + else + return false; + } + set + { + if (value == true) + Data[0x4] = (byte)(Data[0x4]|0x1); + else + Data[0x4] =(byte)(Data[0x4]|~0x1); + } + } + } + public class BATTLE + { + internal int Size = MainForm.save.getBlockLength(57);//Block 57 BW2 + + public byte[] Data; + public BATTLE(byte[] data = null) + { + Data = data ?? new byte[Size]; + + } + public byte[] getData(int Offset, int Length) + { + return Data.Skip(Offset).Take(Length).ToArray(); + } + public void setData(byte[] input, int Offset) + { + input.CopyTo(Data, Offset); + } + + public UInt16 bp + { + get + { + return BitConverter.ToUInt16(getData(0, 2), 0); + } + set + { + setData(BitConverter.GetBytes((UInt16)value), 0); + } + } + } + public class CARDSIG + { + internal int Size = MainForm.save.getBlockLength(33);//Block 57 BW2 + + public byte[] Data; + public CARDSIG(byte[] data = null) + { + Data = data ?? new byte[Size]; + + } + public byte[] getData(int Offset, int Length) + { + return Data.Skip(Offset).Take(Length).ToArray(); + } + public void setData(byte[] input, int Offset) + { + input.CopyTo(Data, Offset); + } + + public byte nature + { + get + { + return Data[0x600]; + } + set + { + Data[0x600] = (byte) value; + } + } + + public DateTime badge1 + { + get + { + if (Data[0x604] != 0 && Data[0x605] != 0 && Data[0x606] != 0) + return new DateTime(2000+Data[0x604], Data[0x605], Data[0x606]); + else + return new DateTime(2000, 1, 1); + } + set + { + if(value == new DateTime(2000, 1, 1)) + { + + } + else + { + Data[0x604] = (byte) (value.Year-2000); + Data[0x605] = (byte) value.Month; + Data[0x606] = (byte) value.Day; + } + } + } + } + } +} diff --git a/BW_tool/Editors/TrainerInfo.resx b/BW_tool/Editors/TrainerInfo.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BW_tool/Editors/TrainerInfo.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BW_tool/MainForm.Designer.cs b/BW_tool/MainForm.Designer.cs index e1c4535..2b30c6a 100644 --- a/BW_tool/MainForm.Designer.cs +++ b/BW_tool/MainForm.Designer.cs @@ -27,6 +27,7 @@ namespace BW_tool private System.Windows.Forms.Button forest_but; private System.Windows.Forms.Button key_but; private System.Windows.Forms.Button join_but; + private System.Windows.Forms.Button trainer_but; /// /// Disposes resources used by the form. @@ -62,6 +63,7 @@ namespace BW_tool this.forest_but = new System.Windows.Forms.Button(); this.key_but = new System.Windows.Forms.Button(); this.join_but = new System.Windows.Forms.Button(); + this.trainer_but = new System.Windows.Forms.Button(); this.SuspendLayout(); // // loadsave_but @@ -158,7 +160,7 @@ namespace BW_tool // medal_but // this.medal_but.Enabled = false; - this.medal_but.Location = new System.Drawing.Point(158, 107); + this.medal_but.Location = new System.Drawing.Point(12, 165); this.medal_but.Name = "medal_but"; this.medal_but.Size = new System.Drawing.Size(140, 23); this.medal_but.TabIndex = 9; @@ -199,11 +201,23 @@ namespace BW_tool this.join_but.UseVisualStyleBackColor = true; this.join_but.Click += new System.EventHandler(this.Join_butClick); // + // trainer_but + // + this.trainer_but.Enabled = false; + this.trainer_but.Location = new System.Drawing.Point(158, 107); + this.trainer_but.Name = "trainer_but"; + this.trainer_but.Size = new System.Drawing.Size(140, 23); + this.trainer_but.TabIndex = 13; + this.trainer_but.Text = "Trainer Info"; + this.trainer_but.UseVisualStyleBackColor = true; + this.trainer_but.Click += new System.EventHandler(this.Trainer_butClick); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(503, 192); + this.Controls.Add(this.trainer_but); this.Controls.Add(this.join_but); this.Controls.Add(this.key_but); this.Controls.Add(this.forest_but); diff --git a/BW_tool/MainForm.cs b/BW_tool/MainForm.cs index 50a7a38..c624023 100644 --- a/BW_tool/MainForm.cs +++ b/BW_tool/MainForm.cs @@ -67,6 +67,7 @@ namespace BW_tool forest_but.Enabled = true; key_but.Enabled = true; join_but.Enabled = true; + trainer_but.Enabled = true; } else if (save.BW) { @@ -82,6 +83,7 @@ namespace BW_tool forest_but.Enabled = true; key_but.Enabled = false; join_but.Enabled = false; + trainer_but.Enabled = true; } else versiontext.Text = "Invalid file"; @@ -99,6 +101,7 @@ namespace BW_tool forest_but.Enabled = false; key_but.Enabled = false; join_but.Enabled = false; + trainer_but.Enabled = false; } } void Save_butClick(object sender, EventArgs e) @@ -154,5 +157,10 @@ namespace BW_tool Form join = new Join_avenue(); join.ShowDialog(); } + void Trainer_butClick(object sender, EventArgs e) + { + Form trainer = new TrainerInfo(); + trainer.ShowDialog(); + } } }