diff --git a/BW_tool/BW_tool.csproj b/BW_tool/BW_tool.csproj index f507d3c..66f7703 100644 --- a/BW_tool/BW_tool.csproj +++ b/BW_tool/BW_tool.csproj @@ -58,6 +58,14 @@ Grotto.cs + + + Medals.cs + + + + TrainerRec.cs + MainForm.cs @@ -82,6 +90,12 @@ Grotto.cs + + Medals.cs + + + TrainerRec.cs + MainForm.cs diff --git a/BW_tool/Editors/Medals.Designer.cs b/BW_tool/Editors/Medals.Designer.cs new file mode 100644 index 0000000..f7b8f7f --- /dev/null +++ b/BW_tool/Editors/Medals.Designer.cs @@ -0,0 +1,489 @@ +/* + * Created by SharpDevelop. + * User: suloku + * Date: 03/03/2016 + * Time: 19:38 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +namespace BW_tool +{ + partial class Medals + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.NumericUpDown day; + private System.Windows.Forms.NumericUpDown month; + private System.Windows.Forms.NumericUpDown year; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox indexbox; + private System.Windows.Forms.Button exit_but; + private System.Windows.Forms.Button saveexit_but; + private System.Windows.Forms.CheckBox flag1box; + private System.Windows.Forms.CheckBox flag2box; + private System.Windows.Forms.CheckBox flag3box; + private System.Windows.Forms.CheckBox flag4box; + + /// + /// 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 + private void InitializeComponent() + { + this.day = new System.Windows.Forms.NumericUpDown(); + this.month = new System.Windows.Forms.NumericUpDown(); + this.year = new System.Windows.Forms.NumericUpDown(); + this.indexbox = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.exit_but = new System.Windows.Forms.Button(); + this.saveexit_but = new System.Windows.Forms.Button(); + this.flag1box = new System.Windows.Forms.CheckBox(); + this.flag2box = new System.Windows.Forms.CheckBox(); + this.flag3box = new System.Windows.Forms.CheckBox(); + this.flag4box = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.day)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.month)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.year)).BeginInit(); + this.SuspendLayout(); + // + // day + // + this.day.Location = new System.Drawing.Point(49, 39); + this.day.Maximum = new decimal(new int[] { + 31, + 0, + 0, + 0}); + this.day.Name = "day"; + this.day.Size = new System.Drawing.Size(46, 20); + this.day.TabIndex = 0; + this.day.ValueChanged += new System.EventHandler(this.DayValueChanged); + // + // month + // + this.month.Location = new System.Drawing.Point(140, 39); + this.month.Maximum = new decimal(new int[] { + 12, + 0, + 0, + 0}); + this.month.Name = "month"; + this.month.Size = new System.Drawing.Size(46, 20); + this.month.TabIndex = 1; + this.month.ValueChanged += new System.EventHandler(this.MonthValueChanged); + // + // year + // + this.year.Location = new System.Drawing.Point(229, 39); + this.year.Maximum = new decimal(new int[] { + 127, + 0, + 0, + 0}); + this.year.Name = "year"; + this.year.Size = new System.Drawing.Size(46, 20); + this.year.TabIndex = 2; + this.year.ValueChanged += new System.EventHandler(this.YearValueChanged); + // + // indexbox + // + this.indexbox.FormattingEnabled = true; + this.indexbox.Items.AddRange(new object[] { + " ======= Special Medaling medals =======", + "000 - First Step", + "001 - Participation Prize", + "002 - Rookie Medalist", + "003 - Elite Medalist", + "004 - Master Medalist", + "005 - Legend Medalist", + "006 - Top Medalist", + "======= Adventure Medal =======", + "007 - Light Walker", + "008 - Middle Walker", + "009 - Heavy Walker", + "010 - Honored Footprints", + "011 - Step-by-Step Saver", + "012 - Busy Saver", + "013 - Experienced Saver", + "014 - Wonder Writer", + "015 - Pokémon Center Fan", + "016 - Signboard Starter", + "017 - Signboard Savvy", + "018 - Graffiti Gazer", + "019 - Starter Cycling", + "020 - Easy Cycling", + "021 - Hard Cycling", + "022 - Pedaling Legend", + "023 - Old Rod Fisherman", + "024 - Good Rod Fisherman", + "025 - Super Rod Fisherman", + "026 - Mighty Fisher", + "027 - Normal-type Catcher", + "028 - Fire-type Catcher", + "029 - Water-type Catcher", + "030 - ElectricCollector", + "031 - Grass-type Catcher", + "032 - Ice-type Catcher", + "033 - Fighting-type Catcher", + "034 - Poison-type Catcher", + "035 - Ground-type Catcher", + "036 - Flying-type Catcher", + "037 - Psychic-type Catcher", + "038 - Bug-type Catcher", + "039 - Rock-type Catcher", + "040 - Ghost-type Catcher", + "041 - Dragon-type Catcher", + "042 - Dark-type Catcher", + "043 - Steel-type Catcher", + "044 - Unova Catcher", + "045 - National Catcher", + "046 - 30 Boxed", + "047 - 120 Boxed", + "048 - 360 Boxed", + "049 - Boxes Max", + "050 - Capturing Spree", + "051 - Vending Virtuoso", + "052 - Lucky Drink", + "053 - Evolution Hopeful", + "054 - Evolution Tech", + "055 - Evolution Expert", + "056 - Evolution Authority", + "057 - Ace Pilot", + "058 - Hustle Muscle", + "059 - Trash Master", + "060 - Dowsing Beginner", + "061 - Dowsing Specialist", + "062 - Dowsing Collector", + "063 - Dowsing Wizard", + "064 - Naming Champ", + "065 - Television Kid", + "066 - Regular Customer", + "067 - Moderate Customer", + "068 - Great Customer", + "069 - Indulgent Customer", + "070 - Super Rich", + "071 - Smart Shopper", + "072 - Sweet Home", + "073 - The First Passerby", + "074 - 30 Passersby", + "075 - 100 Passersby", + "076 - Heavy Traffic", + "077 - Pass Power+", + "078 - Pass Power++", + "079 - Pass Power+++", + "080 - Pass Power MAX", + "081 - Dozing Capture", + "082 - Sleeping Capture", + "083 - Deep Sleep Capture", + "084 - Sweet Dreamer", + "085 - Hidden Grotto Adept", + "086 - Egg Beginner", + "087 - Egg Breeder", + "088 - Egg Elite ", + "089 - Hatching Aficionado", + "090 - Day-Care Faithful", + "091 - Archeology Lover", + "092 - Pure Youth", + "093 - Lucky Colour", + "094 - Pokerus Discoverer", + "095 - Castelia Boss", + "096 - Rail Enthusiast", + "097 - Wailord Watcher", + "098 - Face Board Memorial", + "099 - Heavy Machinery Pro", + "Ruins Raider", + "Diamond Dust", + "Bridge Enthusiast", + "Around Unova", + "Great Adventurer", + "======= Battle Medal =======", + "Battle Learner", + "Battle Teacher", + "Battle Veteran", + "Battle Virtuoso", + "Link Battle Amateur", + "Link Battle Pioneer", + "Link Battle Expert", + "Born To Battle", + "Magikarp Award", + "Never Give Up", + "Noneffective Artist", + "Supereffective Savant", + "Subway Low Gear", + "Subway Accelerator", + "Subway Top Gear", + "Runaway Express", + "Single Express", + "Double Express", + "Multi Express", + "Test Novice", + "Test Fan", + "Test Enthusiast", + "Exam Genius", + "Exp. Millionaire", + "BP Wealthy", + "Superb Locator", + "Battle Repeater", + "Cruise Connoisseur", + "Driftveil Mightiest", + "Rental Champ", + "Mix Champ", + "Unova Mightiest", + "Kanto Mightiest", + "Johto Mightiest", + "Hoenn Mightiest", + "Sinnoh Mightiest", + "Mightiest Leader", + "World\'s Mightiest", + "Rental Master", + "Mix Master", + "All Types Champ", + "Tower Junior", + "Tower Master", + "Treehollow Junior", + "Treehollow Master", + "20 Victories", + "50 Victories", + "100 Victories", + "1,000 Wins", + "Undefeated: Easy", + "Undefeated: Hard", + "Pinpoint: Easy", + "Pinpoint: Hard", + "Quick Clear: Easy", + "Quick Clear: Hard", + "Battle Guru", + "======= Entertainment Medal =======", + "Beginning Trader", + "Occasional Trader", + "Frequent Trader", + "Great Trade-Up", + "Opposite Trader", + "Pen Pal", + "Talented Cast Member", + "Rising Star", + "Big Star", + "Superstar", + "Musical Prima Donna", + "Musical Star", + "10 Followers", + "First Friend", + "Broad Friendship", + "Extensive Friendship", + "Global Connection", + "Spin Trade Whiz", + "Feeling Master", + "Ace of Hearts", + "Ferris Wheel Fan", + "New Guide", + "Elite Guide", + "Veteran Guide", + "======= Challenge Medal =======", + "Guiding Champ", + "Shop Starter", + "Shop Builder", + "Shop Constructor", + "Extreme Developer", + "OK Souvenir Getter", + "Good Souvenir Getter", + "Great Souvenir Getter", + "Tycoon of Souvenirs", + "Avenue of Fame", + "Minigame Fan", + "Minigame Buff", + "Minigame Expert", + "Best Minigamer", + "Balloon Rookie", + "Balloon Technician", + "Balloon Expert", + "Balloon Conqueror", + "New Face Hero", + "Hero Movie Star", + "Cop Movie Master", + "UFO Movie Master", + "Monster Movie Master", + "Sci-Fi Movie Master", + "Romantic Movie Star", + "Fantasy Movie Master", + "Comedic Movie Star", + "Horror Movie Star", + "Robot Movie Master", + "Ghost Movie Master", + "Hero Ending", + "Popular Movie Star", + "Blockbuster Star", + "Masterpiece Star", + "First Cult Classic", + "Cult Classic Star", + "10 People Funfest", + "30 People Funfest", + "Scored 100", + "Scored 1,000", + "Mission Host Lv1", + "Mission Host Lv 2", + "Participant Lv 1", + "Participant Lv 2", + "Achiever Lv 1", + "Achiever Lv 2", + "Funfest Complete", + "Good Night", + "Beginning of Memory", + "Memory Master", + "Entertainment Master", + "Normal-type Champ", + "Fire-type Champ", + "Water-type Champ", + "Electric-type Champ", + "Grass-type Champ", + "Ice-type Champ", + "Fighting-type Champ", + "Poison-type Champ", + "Ground-type Champ", + "Flying-type Champ", + "Psychic-type Champ", + "Bug-type Champ", + "Rock-type Champ", + "Ghost-type Champ", + "Dragon-type Champ", + "Dark-type Champ", + "Steel-type Champ", + "One and Only", + "Supreme Challenger"}); + this.indexbox.Location = new System.Drawing.Point(12, 12); + this.indexbox.MaxDropDownItems = 10; + this.indexbox.Name = "indexbox"; + this.indexbox.Size = new System.Drawing.Size(263, 21); + this.indexbox.TabIndex = 4; + this.indexbox.SelectedIndexChanged += new System.EventHandler(this.ComboBox1SelectedIndexChanged); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(12, 41); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 20); + this.label1.TabIndex = 5; + this.label1.Text = "Day"; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(101, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(37, 23); + this.label2.TabIndex = 6; + this.label2.Text = "Month"; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(192, 41); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 23); + this.label3.TabIndex = 7; + this.label3.Text = "Year"; + // + // exit_but + // + this.exit_but.Location = new System.Drawing.Point(178, 184); + this.exit_but.Name = "exit_but"; + this.exit_but.Size = new System.Drawing.Size(97, 27); + this.exit_but.TabIndex = 8; + 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(178, 217); + this.saveexit_but.Name = "saveexit_but"; + this.saveexit_but.Size = new System.Drawing.Size(99, 29); + this.saveexit_but.TabIndex = 9; + this.saveexit_but.Text = "Save and Exit"; + this.saveexit_but.UseVisualStyleBackColor = true; + this.saveexit_but.Click += new System.EventHandler(this.Saveexit_butClick); + // + // flag1box + // + this.flag1box.Location = new System.Drawing.Point(70, 67); + this.flag1box.Name = "flag1box"; + this.flag1box.Size = new System.Drawing.Size(104, 24); + this.flag1box.TabIndex = 10; + this.flag1box.Text = "Flag 1"; + this.flag1box.UseVisualStyleBackColor = true; + this.flag1box.CheckedChanged += new System.EventHandler(this.Flag1boxCheckedChanged); + // + // flag2box + // + this.flag2box.Location = new System.Drawing.Point(140, 67); + this.flag2box.Name = "flag2box"; + this.flag2box.Size = new System.Drawing.Size(104, 24); + this.flag2box.TabIndex = 11; + this.flag2box.Text = "Flag 2"; + this.flag2box.UseVisualStyleBackColor = true; + this.flag2box.CheckedChanged += new System.EventHandler(this.Flag2boxCheckedChanged); + // + // flag3box + // + this.flag3box.Location = new System.Drawing.Point(70, 97); + this.flag3box.Name = "flag3box"; + this.flag3box.Size = new System.Drawing.Size(104, 24); + this.flag3box.TabIndex = 12; + this.flag3box.Text = "Flag 3"; + this.flag3box.UseVisualStyleBackColor = true; + this.flag3box.CheckedChanged += new System.EventHandler(this.Flag3boxCheckedChanged); + // + // flag4box + // + this.flag4box.Location = new System.Drawing.Point(140, 97); + this.flag4box.Name = "flag4box"; + this.flag4box.Size = new System.Drawing.Size(104, 24); + this.flag4box.TabIndex = 13; + this.flag4box.Text = "Flag 4"; + this.flag4box.UseVisualStyleBackColor = true; + this.flag4box.CheckedChanged += new System.EventHandler(this.Flag4boxCheckedChanged); + // + // Medals + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(289, 258); + this.Controls.Add(this.flag4box); + this.Controls.Add(this.flag3box); + this.Controls.Add(this.flag2box); + this.Controls.Add(this.flag1box); + this.Controls.Add(this.saveexit_but); + this.Controls.Add(this.exit_but); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.indexbox); + this.Controls.Add(this.year); + this.Controls.Add(this.month); + this.Controls.Add(this.day); + this.Name = "Medals"; + this.Text = "Medals"; + ((System.ComponentModel.ISupportInitialize)(this.day)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.month)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.year)).EndInit(); + this.ResumeLayout(false); + + } + } +} diff --git a/BW_tool/Editors/Medals.cs b/BW_tool/Editors/Medals.cs new file mode 100644 index 0000000..426f051 --- /dev/null +++ b/BW_tool/Editors/Medals.cs @@ -0,0 +1,179 @@ +/* + * Created by SharpDevelop. + * User: suloku + * Date: 03/03/2016 + * Time: 19:38 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace BW_tool +{ + /// + /// Description of Medals. + /// + public partial class Medals : Form + { + MEDAL medals; + public Medals() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + medals = new MEDAL(MainForm.save.getBlock(68)); + indexbox.SelectedIndex = 0; + day.Value = medals.Day; + month.Value = medals.Month; + year.Value = medals.Year; + flag1box.Checked = medals.Flag1; + flag2box.Checked = medals.Flag2; + flag3box.Checked = medals.Flag3; + flag4box.Checked = medals.Flag4; + + // + // TODO: Add constructor code after the InitializeComponent() call. + // + } + void ComboBox1SelectedIndexChanged(object sender, EventArgs e) + { + if (indexbox.SelectedIndex == 0) + { + indexbox.SelectedIndex = 1; + } + else if (indexbox.SelectedIndex == 8) + { + indexbox.SelectedIndex = 9; + } + else if (indexbox.SelectedIndex == 107) + { + indexbox.SelectedIndex = 108; + } + else if (indexbox.SelectedIndex == 164) + { + indexbox.SelectedIndex = 165; + } + else if (indexbox.SelectedIndex == 189) + { + indexbox.SelectedIndex = 190; + } + + if (indexbox.SelectedIndex > 0 && indexbox.SelectedIndex < 8) + { + medals.Index = (int)indexbox.SelectedIndex - 1; + } + else if (indexbox.SelectedIndex > 8 && indexbox.SelectedIndex < 107) + { + medals.Index = (int)indexbox.SelectedIndex - 2; + } + else if (indexbox.SelectedIndex > 107 && indexbox.SelectedIndex < 164) + { + medals.Index = (int)indexbox.SelectedIndex - 3; + } + else if (indexbox.SelectedIndex > 164 && indexbox.SelectedIndex < 189) + { + medals.Index = (int)indexbox.SelectedIndex - 4; + } + else if (indexbox.SelectedIndex > 189) + { + medals.Index = (int)indexbox.SelectedIndex - 5; + } + day.Value = medals.Day; + month.Value = medals.Month; + year.Value = medals.Year; + flag1box.Checked = medals.Flag1; + flag2box.Checked = medals.Flag2; + flag3box.Checked = medals.Flag3; + flag4box.Checked = medals.Flag4; + } + void DayValueChanged(object sender, EventArgs e) + { + medals.Day = (int)day.Value; + } + void MonthValueChanged(object sender, EventArgs e) + { + medals.Month = (int)month.Value; + } + void YearValueChanged(object sender, EventArgs e) + { + medals.Year = (int)year.Value; + } + void Exit_butClick(object sender, EventArgs e) + { + this.Close(); + } + void Saveexit_butClick(object sender, EventArgs e) + { + MainForm.save.setBlock(medals.Data, 68); + this.Close(); + } + void Flag1boxCheckedChanged(object sender, EventArgs e) + { + medals.Flag1 = flag1box.Checked; + } + void Flag2boxCheckedChanged(object sender, EventArgs e) + { + medals.Flag2 = flag2box.Checked; + } + void Flag3boxCheckedChanged(object sender, EventArgs e) + { + medals.Flag3 = flag3box.Checked; + } + void Flag4boxCheckedChanged(object sender, EventArgs e) + { + medals.Flag4 = flag4box.Checked; + } + public class MEDAL + { + internal int MedalSize = 4; + internal int Size = MainForm.save.getBlockLength(68); + + public byte[] Data; + public MEDAL(byte[] data = null) + { + Data = data ?? new byte[Size]; + } + private int index = 0; + public int Index { + get { return index/4; } + set { if ((value >= 0) && (value < 256)){ index = (int)(value*MedalSize);} } } + + private UInt16 build_date(int day, int month, int year) + { + + return (UInt16) ( ((day & 0x1F) << 11) | ((month & 0x0F) << 7) | (year & 0x7F) ); + } + + + public int Day { + get { return (BitConverter.ToUInt16(Data, index)) >> 11; } + set { BitConverter.GetBytes(build_date(value, Month, Year)).CopyTo(Data, index); } } + public int Month { + get { return (BitConverter.ToUInt16(Data, index) & 0x0780) >> 7; } + set { BitConverter.GetBytes(build_date(Day, value, Year)).CopyTo(Data, index); } } + public int Year { + get { return (BitConverter.ToUInt16(Data, index) & 0x007F); } + set { BitConverter.GetBytes(build_date(Day, Month, value)).CopyTo(Data, index); } } + public UInt16 Flags { + get { return BitConverter.ToUInt16(Data, index+0x02); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, index+0x2); } } + + public bool Flag1{ + get { return Convert.ToBoolean(Flags&0x1); } + //set { Flags = (UInt16)(Convert.ToByte(value) | (Flags & ~(0x1))); } } + set { if (value) Flags = (UInt16)(0x1 | (Flags & ~(0x4))); else Flags = (UInt16)(Flags & ~(0x1)); } } + public bool Flag2{ + get { return Convert.ToBoolean(Flags&0x2); } + set { if (value) Flags = (UInt16)(0x2 | (Flags & ~(0x4))); else Flags = (UInt16)(Flags & ~(0x2)); } } + public bool Flag3{ + get { return Convert.ToBoolean(Flags&0x4); } + set { if (value) Flags = (UInt16)(0x4 | (Flags & ~(0x4))); else Flags = (UInt16)(Flags & ~(0x4)); } } + public bool Flag4{ + get { return Convert.ToBoolean(Flags&0x8); } + set { if (value) Flags = (UInt16)(0x8 | (Flags & ~(0x4))); else Flags = (UInt16)(Flags & ~(0x8)); } } + } + } +} diff --git a/BW_tool/Editors/Medals.resx b/BW_tool/Editors/Medals.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/BW_tool/Editors/Medals.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/Editors/TrainerRec.Designer.cs b/BW_tool/Editors/TrainerRec.Designer.cs new file mode 100644 index 0000000..6fb7ac6 --- /dev/null +++ b/BW_tool/Editors/TrainerRec.Designer.cs @@ -0,0 +1,199 @@ +/* + * Created by SharpDevelop. + * User: suloku + * Date: 03/03/2016 + * Time: 17:31 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +namespace BW_tool +{ + partial class TrainerRec + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + private System.Windows.Forms.NumericUpDown record_value; + private System.Windows.Forms.ComboBox record_index; + + /// + /// 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.record_value = new System.Windows.Forms.NumericUpDown(); + this.record_index = new System.Windows.Forms.ComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.record_value)).BeginInit(); + this.SuspendLayout(); + // + // record_value + // + this.record_value.Location = new System.Drawing.Point(284, 50); + this.record_value.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.record_value.Name = "record_value"; + this.record_value.Size = new System.Drawing.Size(120, 20); + this.record_value.TabIndex = 0; + // + // record_index + // + this.record_index.FormattingEnabled = true; + this.record_index.Items.AddRange(new object[] { + "001", + "002", + "003", + "004", + "005 - Wild Pokémon Encounters", + "006 - Trainers Battled", + "007", + "008", + "009", + "010", + "011", + "012", + "013", + "014", + "015", + "016", + "017", + "018", + "019", + "020", + "021", + "022", + "023", + "024", + "025", + "026", + "027", + "028", + "029", + "030", + "031", + "032", + "033", + "034", + "035", + "036", + "037", + "038", + "039", + "040", + "041", + "042", + "043", + "044", + "045", + "046", + "047", + "048", + "049", + "050", + "051", + "052", + "053", + "054", + "055", + "056", + "057", + "058", + "059", + "060", + "061", + "062", + "063", + "064", + "065", + "066", + "067", + "068", + "069", + "070", + "071", + "072", + "073", + "074", + "075", + "076", + "077", + "078", + "079", + "080", + "081", + "082", + "083", + "084", + "085", + "086", + "087", + "088", + "089", + "090", + "091", + "092", + "093", + "094", + "095", + "096", + "097", + "098", + "099", + "100", + "101", + "102", + "103", + "104", + "105", + "106", + "107", + "108", + "109", + "110", + "111", + "112", + "113", + "114", + "115", + "116", + "117", + "118"}); + this.record_index.Location = new System.Drawing.Point(56, 49); + this.record_index.Name = "record_index"; + this.record_index.Size = new System.Drawing.Size(121, 21); + this.record_index.TabIndex = 1; + this.record_index.SelectedIndexChanged += new System.EventHandler(this.Record_indexSelectedIndexChanged); + // + // TrainerRec + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(712, 286); + this.Controls.Add(this.record_index); + this.Controls.Add(this.record_value); + this.Name = "TrainerRec"; + this.Text = "Trainer Card Records Editor"; + ((System.ComponentModel.ISupportInitialize)(this.record_value)).EndInit(); + this.ResumeLayout(false); + + } + } +} diff --git a/BW_tool/Editors/TrainerRec.cs b/BW_tool/Editors/TrainerRec.cs new file mode 100644 index 0000000..62281ca --- /dev/null +++ b/BW_tool/Editors/TrainerRec.cs @@ -0,0 +1,111 @@ +/* + * Created by SharpDevelop. + * User: suloku + * Date: 03/03/2016 + * Time: 17:31 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using System.Windows.Forms; + +/* Data shown in trainer card info + * +Times Linked +Link Battles +Link Battle Wins +Link Battle Losses +Link Trades +Wild Pokémon encounters +Trainers Battled +Feeling checks + + +----Not on trainer records + +People passed by +Usable Pass Powers +Musical Performances ? - Appears if not 0 +Poké Transfer High Score ? - Appears if not 0 +Battle Test High Score ? - Appears if not 0 +Cleared Funfest missions +Movie Shoots ? - Appears if not 0 +Wins at the PWT +Customers recommended to Join Avenue ? - Appears if not 0 +*/ + +namespace BW_tool +{ + /// + /// Description of TrainerRec. + /// + public partial class TrainerRec : Form + { + TR trainerrecords; + public TrainerRec() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + if ( MainForm.save.B2W2) + { + trainerrecords = new TR(MainForm.save.getBlockDec(38)); + }else + { + trainerrecords = new TR(MainForm.save.getBlockDec(38)); + } + record_index.SelectedIndex = 0; + record_value.Value = trainerrecords.WildCount; + // + // TODO: Add constructor code after the InitializeComponent() call. + // + } + public class TR + { + internal int Size = MainForm.save.B2W2? MainForm.save.getBlockLength(38) : MainForm.save.getBlockLength(38); //Update with BW 1 + + public byte[] Data; + public TR(byte[] data = null) + { + Data = data ?? new byte[Size]; + } + + // General Card Properties + public uint WildCount { + get { return BitConverter.ToUInt32(Data, 0x14); } + set { BitConverter.GetBytes((uint)value).CopyTo(Data, 0x14); } } + public uint TrBattles { + get { return BitConverter.ToUInt32(Data, 0x18); } + set { BitConverter.GetBytes((uint)value).CopyTo(Data, 0x18); } } + public UInt16 Feelings { + get { return BitConverter.ToUInt16(Data, 0x170); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x170); } } + public UInt16 Musical { + get { return BitConverter.ToUInt16(Data, 0x172); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x172); } } + public UInt16 BattleTest { + get { return BitConverter.ToUInt16(Data, 0x186); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x186); } } + public UInt16 MovieShoots { + get { return BitConverter.ToUInt16(Data, 0x194); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x194); } } + public UInt16 Customers { + get { return BitConverter.ToUInt16(Data, 0x18C); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x18C); } } + public UInt16 BattleWins { + get { return BitConverter.ToUInt16(Data, 0x120); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x120); } } + public UInt16 BattleLoses { + get { return BitConverter.ToUInt16(Data, 0x4C); } + set { BitConverter.GetBytes((UInt16)value).CopyTo(Data, 0x4C); } } + } + + + void Record_indexSelectedIndexChanged(object sender, EventArgs e) + { + record_value.Value = trainerrecords.WildCount; + } + } +} diff --git a/BW_tool/Editors/TrainerRec.resx b/BW_tool/Editors/TrainerRec.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/BW_tool/Editors/TrainerRec.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 eff0b10..6d98184 100644 --- a/BW_tool/MainForm.Designer.cs +++ b/BW_tool/MainForm.Designer.cs @@ -22,6 +22,8 @@ namespace BW_tool private System.Windows.Forms.Button chk_but; private System.Windows.Forms.Button chk_updt_but; private System.Windows.Forms.Button grotto_but; + private System.Windows.Forms.Button trainer_records_but; + private System.Windows.Forms.Button medal_but; /// /// Disposes resources used by the form. @@ -52,6 +54,8 @@ namespace BW_tool this.chk_but = new System.Windows.Forms.Button(); this.chk_updt_but = new System.Windows.Forms.Button(); this.grotto_but = new System.Windows.Forms.Button(); + this.trainer_records_but = new System.Windows.Forms.Button(); + this.medal_but = new System.Windows.Forms.Button(); this.SuspendLayout(); // // loadsave_but @@ -93,7 +97,7 @@ namespace BW_tool // dumper_but // this.dumper_but.Enabled = false; - this.dumper_but.Location = new System.Drawing.Point(12, 80); + this.dumper_but.Location = new System.Drawing.Point(323, 67); this.dumper_but.Name = "dumper_but"; this.dumper_but.Size = new System.Drawing.Size(92, 23); this.dumper_but.TabIndex = 4; @@ -126,7 +130,7 @@ namespace BW_tool // grotto_but // this.grotto_but.Enabled = false; - this.grotto_but.Location = new System.Drawing.Point(110, 80); + this.grotto_but.Location = new System.Drawing.Point(12, 78); this.grotto_but.Name = "grotto_but"; this.grotto_but.Size = new System.Drawing.Size(140, 23); this.grotto_but.TabIndex = 7; @@ -134,11 +138,35 @@ namespace BW_tool this.grotto_but.UseVisualStyleBackColor = true; this.grotto_but.Click += new System.EventHandler(this.Grotto_butClick); // + // trainer_records_but + // + this.trainer_records_but.Enabled = false; + this.trainer_records_but.Location = new System.Drawing.Point(12, 107); + this.trainer_records_but.Name = "trainer_records_but"; + this.trainer_records_but.Size = new System.Drawing.Size(140, 23); + this.trainer_records_but.TabIndex = 8; + this.trainer_records_but.Text = "Trainer Records"; + this.trainer_records_but.UseVisualStyleBackColor = true; + this.trainer_records_but.Click += new System.EventHandler(this.Trainer_records_butClick); + // + // medal_but + // + this.medal_but.Enabled = false; + this.medal_but.Location = new System.Drawing.Point(158, 107); + this.medal_but.Name = "medal_but"; + this.medal_but.Size = new System.Drawing.Size(140, 23); + this.medal_but.TabIndex = 9; + this.medal_but.Text = "Medals"; + this.medal_but.UseVisualStyleBackColor = true; + this.medal_but.Click += new System.EventHandler(this.Medal_butClick); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(503, 119); + this.ClientSize = new System.Drawing.Size(503, 147); + this.Controls.Add(this.medal_but); + this.Controls.Add(this.trainer_records_but); this.Controls.Add(this.grotto_but); this.Controls.Add(this.chk_updt_but); this.Controls.Add(this.chk_but); diff --git a/BW_tool/MainForm.cs b/BW_tool/MainForm.cs index aa9ce26..ccc36f9 100644 --- a/BW_tool/MainForm.cs +++ b/BW_tool/MainForm.cs @@ -46,6 +46,10 @@ namespace BW_tool int filesize = FileIO.load_file(ref savebuffer, ref path, dsfilter); if( filesize == SAV5.SIZERAW || filesize == SAV5.SIZERAW+122 ) { + //Convert DSV to SAV + if (filesize == SAV5.SIZERAW+122) + Array.Resize(ref savebuffer, SAV5.SIZERAW); + savegamename.Text = path; save = new SAV5(savebuffer); @@ -58,6 +62,8 @@ namespace BW_tool chk_updt_but.Enabled = true; save_but.Enabled = true; grotto_but.Enabled = true; + trainer_records_but.Enabled = true; + medal_but.Enabled = true; } else if (save.BW) { @@ -67,7 +73,9 @@ namespace BW_tool chk_but.Enabled = true; chk_updt_but.Enabled = true; save_but.Enabled = true; - //grotto_but.Enabled = false; + grotto_but.Enabled = false; + trainer_records_but.Enabled = false; + medal_but.Enabled = false; } else versiontext.Text = "Invalid file"; @@ -80,6 +88,8 @@ namespace BW_tool chk_updt_but.Enabled = false; save_but.Enabled = false; grotto_but.Enabled = false; + trainer_records_but.Enabled = false; + medal_but.Enabled = false; } } void Save_butClick(object sender, EventArgs e) @@ -110,5 +120,15 @@ namespace BW_tool Form grotto = new Grotto(); grotto.ShowDialog(); } + void Trainer_records_butClick(object sender, EventArgs e) + { + Form trainerrec = new TrainerRec(); + trainerrec.ShowDialog(); + } + void Medal_butClick(object sender, EventArgs e) + { + Form medals = new Medals(); + medals.ShowDialog(); + } } } diff --git a/BW_tool/SAV/FileIO.cs b/BW_tool/SAV/FileIO.cs index ab8a101..a9d0f6b 100644 --- a/BW_tool/SAV/FileIO.cs +++ b/BW_tool/SAV/FileIO.cs @@ -84,7 +84,7 @@ namespace BW_tool if (buffer == null) return; SaveFileDialog saveFD = new SaveFileDialog(); //saveFD.InitialDirectory = "c:\\"; - saveFD.Filter = "NDS save data|*.sav;*.dsv|All Files (*.*)|*.*"; + saveFD.Filter = "NDS RAW save data|*.sav|All Files (*.*)|*.*"; if (saveFD.ShowDialog() == DialogResult.OK) { System.IO.FileStream saveFile;