private void CB_Multi_SelectedIndexChanged(object sender, EventArgs e) { PB_Sprite.Image = (Image)Properties.Resources.ResourceManager.GetObject(Main.SAV.ORAS || Main.SAV.ORASDEMO ? "tr_" + Util.getIndex(CB_MultiplayerSprite).ToString("00") : "tr_00"); }
public SAV_Trainer() { InitializeComponent(); if (!Main.unicode) { try { TB_OTName.Font = PKX.getPKXFont(11); } catch (Exception e) { Util.Alert("Font loading failed...", e.ToString()); } } Util.TranslateInterface(this, Main.curlanguage); B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999"; CB_Gender.Items.Clear(); CB_Gender.Items.AddRange(Main.gendersymbols.Take(2).ToArray()); // m/f depending on unicode selection MaisonRecords = new[] { TB_MCSN, TB_MCSS, TB_MBSN, TB_MBSS, TB_MCDN, TB_MCDS, TB_MBDN, TB_MBDS, TB_MCTN, TB_MCTS, TB_MBTN, TB_MBTS, TB_MCRN, TB_MCRS, TB_MBRN, TB_MBRS, TB_MCMN, TB_MCMS, TB_MBMN, TB_MBMS, }; cba = new[] { CHK_Badge1, CHK_Badge2, CHK_Badge3, CHK_Badge4, CHK_Badge5, CHK_Badge6, CHK_Badge7, CHK_Badge8, }; pba = new [] { PB_Badge1, PB_Badge2, PB_Badge3, PB_Badge4, PB_Badge5, PB_Badge6, PB_Badge7, PB_Badge8, }; L_MultiplayerSprite.Enabled = CB_MultiplayerSprite.Enabled = Main.SAV.ORAS; L_Style.Visible = TB_Style.Visible = SAV.XY; if (!SAV.XY) { TC_Editor.TabPages.Remove(Tab_Appearance); } if (SAV.ORASDEMO) { TC_Editor.TabPages.Remove(Tab_Multiplayer); } if (SAV.MaisonStats < 0) { TC_Editor.TabPages.Remove(Tab_Maison); } editing = true; getComboBoxes(); getTextBoxes(); getBadges(); statdata = new[] { "0x000", "0x000", // Steps taken? "0x004", "0x004", // Minutes Played / Pokemon Encountered? "0x008", "0x008", "0x00C", "0x00C", "0x010", "0x010", "0x014", "0x014", "0x018", "0x018", "0x01C", "Pokémon Captured", "0x020", "0x020", "0x024", "Eggs Hatched", "0x028", "Pokémon Evolved", "0x02C", "0x02C", "0x030", "~People Passed", // I think the following ones are Passerby actions... "0x034", "0x034", "0x038", "0x038", "0x03C", "0x03C", "0x040", "Link Trades", "0x044", "Link Battles", "0x048", "Link Battle Wins", "0x04C", "0x04C", "0x050", "0x050", "0x054", "0x054", "0x058", "0x058", "0x05C", "0x05C", "0x060", "0x060", "0x064", "0x064", "0x068", "0x068", "0x06C", "0x06C", "0x070", "0x070", "0x074", "0x074", "0x078", "0x078", "0x07C", "0x07C", "0x080", "0x080", "0x084", "0x084", "0x088", "BP Earned", "0x08C", "0x08C", "0x090", "0x090", "0x094", "0x094", "0x098", "0x098", "0x09C", "0x09C", "0x0A0", "0x0A0", "0x0A4", "0x0A4", "0x0A8", "0x0A8", "0x0AC", "0x0AC", "0x0B0", "0x0B0", "0x0B4", "0x0B4", "0x0B8", "0x0B8", "0x0BC", "0x0BC", "0x0C0", "0x0C0", "0x0C4", "0x0C4", "0x0C8", "0x0C8", "0x0CC", "0x0CC", "0x0D0", "0x0D0", "0x0D4", "0x0D4", "0x0D8", "0x0D8", "0x0DC", "0x0DC", "0x0E0", "0x0E0", "0x0E4", "0x0E4", "0x0E8", "0x0E8", "0x0EC", "Nice! Received", "0x0F0", "Birthday Wishes", "0x0F4", "Total People Met Online", "0x0F8", "0x0F8", //"0x0FC", "Current Pokemiles", "0x100", "Obtained Pokemiles", "0x104", "0x104", "0x108", "0x108", "0x10C", "Super Training Clears", "0x110", "Judge Evaluations", "0x114", "0x114", "0x118", "0x118", // Link Trades? "0x11C", "Link Battle", // Wins", // ? "0x120", "0x120", // Link Battle Losses? "0x124", "0x124", "0x128", "0x128", "0x12C", "0x12C", "0x130", "0x130", "0x134", "0x134", "0x138", "0x138", "0x13C", "0x13C", "0x140", "Flags Captured", "0x144", "0x144", "0x148", "0x148", "0x14C", "0x14C", "0x150", "0x150", "0x154", "0x154", "0x158", "0x158", "0x15C", "0x15C", "0x160", "0x160", "0x164", "0x164", "0x168", "0x168", "0x16C", "0x16C", "0x170", "0x170", "0x174", "0x174", "0x178", "0x178", "0x17C", "0x17C", "0x180", "0x180", "0x184", "0x184", "0x188", "0x188", "0x18C", "0x18C", "0x190", "0x190", "0x194", "0x194", "0x198", "0x198", "0x19C", "0x19C", "0x1A0", "0x1A0", "0x1A4", "0x1A4", "0x1A8", "0x1A8", "0x1AC", "0x1AC", "0x1B0", "0x1B0", "0x1B4", "0x1B4", "0x1B8", "0x1B8", "0x1BC", "Battle Tests", "0x1C0", "0x1C0", "0x1C4", "0x1C4", "0x1C8", "0x1C8", "0x1CC", "0x1CC", "0x1D0", "0x1D0", "0x1D4", "0x1D4", "0x1D8", "0x1D8", "0x1DC", "0x1DC", "0x1E0", "0x1E0", "0x1E4", "0x1E4", "0x1E8", "0x1E8", "0x1EC", "0x1EC", "0x1F0", "0x1F0", "0x1F4", "0x1F4", "0x1F8", "0x1F8", "0x1FC", "0x1FC", "0x200", "0x200", "0x204", "0x204", "0x208", "0x208", "0x20C", "0x20C", "0x210", "0x210", "0x214", "0x214", "0x218", "0x218", "0x21C", "0x21C", "0x220", "0x220", "0x224", "0x224", "0x228", "0x228", "0x22C", "0x22C", "0x230", "0x230", "0x234", "0x234", "0x238", "0x238", "0x23C", "0x23C", "0x240", "0x240", "0x244", "0x244", "0x248", "0x248", "0x24C", "0x24C", "0x250", "0x250", "0x254", "0x254", "0x258", "0x258", }; // Offset, Title. Horrible implementation, but works. CB_Stats.Items.Clear(); for (int i = 0; i < statdata.Length / 2; i++) { CB_Stats.Items.Add(statdata[2 * i + 1]); } CB_Stats.SelectedIndex = 0; }
private void save() { SAV.Game = (byte)(CB_Game.SelectedIndex + 0x18); SAV.Gender = (byte)CB_Gender.SelectedIndex; SAV.TID = (ushort)Util.ToUInt32(MT_TID.Text); SAV.SID = (ushort)Util.ToUInt32(MT_SID.Text); SAV.Money = Util.ToUInt32(MT_Money.Text); SAV.SubRegion = Util.getIndex(CB_Region); SAV.Country = Util.getIndex(CB_Country); SAV.ConsoleRegion = Util.getIndex(CB_3DSReg); SAV.Language = Util.getIndex(CB_Language); SAV.OT = TB_OTName.Text; SAV.Saying1 = TB_Saying1.Text; SAV.Saying2 = TB_Saying2.Text; SAV.Saying3 = TB_Saying3.Text; SAV.Saying4 = TB_Saying4.Text; SAV.Saying5 = TB_Saying5.Text; // Copy Maison Data in if (SAV.MaisonStats > -1) { for (int i = 0; i < MaisonRecords.Length; i++) { SAV.setMaisonStat(i, ushort.Parse(MaisonRecords[i].Text)); } } // Copy Position if (GB_Map.Enabled) { SAV.M = (int)NUD_M.Value; SAV.X = (float)NUD_X.Value; SAV.Z = (float)NUD_Z.Value; SAV.Y = (float)NUD_Y.Value; } SAV.BP = ushort.Parse(TB_BP.Text); // Set Current PokéMiles SAV.setPSSStat(0xFC / 4, Util.ToUInt32(TB_PM.Text)); // Set Max Obtained Pokémiles SAV.setPSSStat(0x100 / 4, Util.ToUInt32(TB_PM.Text)); SAV.Style = byte.Parse(TB_Style.Text); // Copy Badges int badgeval = 0; for (int i = 0; i < 8; i++) { badgeval |= (cba[i].Checked ? 1 : 0) << i; } SAV.Badges = badgeval; // Save PlayTime SAV.PlayedHours = ushort.Parse(MT_Hours.Text); SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60; SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60; // Sprite SAV.Sprite = Convert.ToByte(CB_MultiplayerSprite.SelectedValue); // Appearance if (SAV.XY) { SAV.Data[SAV.TrainerCard + 0x30] = byte.Parse(MT_14030.Text); SAV.Data[SAV.TrainerCard + 0x31] = (byte)(byte.Parse(MT_HairColor.Text) | (byte.Parse(MT_Hat.Text) << 3)); SAV.Data[SAV.TrainerCard + 0x32] = byte.Parse(MT_14032.Text); SAV.Data[SAV.TrainerCard + 0x33] = byte.Parse(MT_14033.Text); SAV.Data[SAV.TrainerCard + 0x34] = byte.Parse(MT_14034.Text); SAV.Data[SAV.TrainerCard + 0x35] = byte.Parse(MT_14035.Text); SAV.Data[SAV.TrainerCard + 0x36] = byte.Parse(MT_14036.Text); SAV.Data[SAV.TrainerCard + 0x37] = byte.Parse(MT_14037.Text); SAV.Data[SAV.TrainerCard + 0x38] = byte.Parse(MT_14038.Text); SAV.Data[SAV.TrainerCard + 0x39] = byte.Parse(MT_14039.Text); SAV.Data[SAV.TrainerCard + 0x3A] = byte.Parse(MT_1403A.Text); SAV.Data[SAV.TrainerCard + 0x3B] = byte.Parse(MT_1403B.Text); SAV.Data[SAV.TrainerCard + 0x3C] = byte.Parse(MT_1403C.Text); SAV.Data[SAV.TrainerCard + 0x3D] = byte.Parse(MT_1403D.Text); SAV.Data[SAV.TrainerCard + 0x3E] = byte.Parse(MT_1403E.Text); SAV.Data[SAV.TrainerCard + 0x3F] = byte.Parse(MT_1403F.Text); } // Vivillon SAV.Vivillon = CB_Vivillon.SelectedIndex; int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds; seconds -= seconds % 86400; seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds; SAV.SecondsToStart = seconds; int fame = (int)(CAL_HoFDate.Value - new DateTime(2000, 1, 1)).TotalSeconds; fame -= fame % 86400; fame += (int)(CAL_HoFTime.Value - new DateTime(2000, 1, 1)).TotalSeconds; SAV.SecondsToFame = fame; SAV.LastSavedYear = CAL_LastSavedDate.Value.Year; SAV.LastSavedMonth = CAL_LastSavedDate.Value.Month; SAV.LastSavedDay = CAL_LastSavedDate.Value.Day; SAV.LastSavedHour = CAL_LastSavedTime.Value.Hour; SAV.LastSavedMinute = CAL_LastSavedTime.Value.Minute; }
private void save() { string OT_Name = TB_OTName.Text; //string RIV_Name = TB_Rival.Text; sav[TrainerCard + 0x04 + savshift] = (byte)(CB_Game.SelectedIndex + 0x18); sav[TrainerCard + 0x05 + savshift] = (byte)CB_Gender.SelectedIndex; uint TID = Util.ToUInt32(MT_TID.Text); uint SID = Util.ToUInt32(MT_SID.Text); uint money = Util.ToUInt32(MT_Money.Text); string saying1 = TB_Saying1.Text; string saying2 = TB_Saying2.Text; string saying3 = TB_Saying3.Text; string saying4 = TB_Saying4.Text; string saying5 = TB_Saying5.Text; uint _region = Util.ToUInt32(CB_Region.SelectedValue.ToString()); uint _country = Util.ToUInt32(CB_Country.SelectedValue.ToString()); uint _3dsreg = Util.ToUInt32(CB_3DSReg.SelectedValue.ToString()); uint _language = Util.ToUInt32(CB_Language.SelectedValue.ToString()); Array.Copy(BitConverter.GetBytes(TID), 0, sav, TrainerCard + 0x0 + savshift, 2); Array.Copy(BitConverter.GetBytes(SID), 0, sav, TrainerCard + 0x2 + savshift, 2); Array.Copy(BitConverter.GetBytes(money), 0, sav, Trainer2 + 0x8 + savshift, 4); Array.Copy(BitConverter.GetBytes(_region), 0, sav, TrainerCard + 0x26 + savshift, 1); Array.Copy(BitConverter.GetBytes(_country), 0, sav, TrainerCard + 0x27 + savshift, 1); Array.Copy(BitConverter.GetBytes(_3dsreg), 0, sav, TrainerCard + 0x2C + savshift, 1); Array.Copy(BitConverter.GetBytes(_language), 0, sav, TrainerCard + 0x2D + savshift, 1); byte[] OT = Encoding.Unicode.GetBytes(OT_Name); Array.Resize(ref OT, 0x1A); Array.Copy(OT, 0, sav, TrainerCard + 0x48 + savshift, 0x1A); //byte[] Rival = Encoding.Unicode.GetBytes(RIV_Name); //Array.Resize(ref Rival, 0x1A); //Array.Copy(Rival, 0, sav, 0x9610 + savshift, 0x1A); byte[] s1 = Encoding.Unicode.GetBytes(saying1); Array.Resize(ref s1, 0x22); Array.Copy(s1, 0, sav, TrainerCard + 0x7C + savshift, 0x22); byte[] s2 = Encoding.Unicode.GetBytes(saying2); Array.Resize(ref s2, 0x22); Array.Copy(s2, 0, sav, TrainerCard + 0x9E + savshift, 0x22); byte[] s3 = Encoding.Unicode.GetBytes(saying3); Array.Resize(ref s3, 0x22); Array.Copy(s3, 0, sav, TrainerCard + 0xC0 + savshift, 0x22); byte[] s4 = Encoding.Unicode.GetBytes(saying4); Array.Resize(ref s4, 0x22); Array.Copy(s4, 0, sav, TrainerCard + 0xE2 + savshift, 0x22); byte[] s5 = Encoding.Unicode.GetBytes(saying5); Array.Resize(ref s5, 0x22); Array.Copy(s5, 0, sav, TrainerCard + 0x104 + savshift, 0x22); // New stuff. // Copy Maison Data in MaskedTextBox[] tba = new MaskedTextBox[] { TB_MCSN, TB_MCSS, TB_MBSN, TB_MBSS, TB_MCDN, TB_MCDS, TB_MBDN, TB_MBDS, TB_MCTN, TB_MCTS, TB_MBTN, TB_MBTS, TB_MCRN, TB_MCRS, TB_MBRN, TB_MBRS, TB_MCMN, TB_MCMS, TB_MBMN, TB_MBMS, }; for (int i = 0; i < tba.Length; i++) { byte[] streak = BitConverter.GetBytes(Util.ToUInt32(tba[i].Text)); Array.Resize(ref streak, 2); Array.Copy(streak, 0, sav, Maison + 2 * i + savshift, 2); } // Copy Position byte[] m = BitConverter.GetBytes(Int16.Parse(TB_CoordM.Text)); Array.Resize(ref m, 2); Array.Copy(m, 0, sav, savshift + Trainer1 + 0x02, 2); byte[] x = BitConverter.GetBytes(Single.Parse(TB_CoordX.Text)); Array.Resize(ref x, 4); Array.Copy(x, 0, sav, savshift + Trainer1 + 0x10, 4); byte[] z = BitConverter.GetBytes(Single.Parse(TB_CoordZ.Text)); Array.Resize(ref z, 4); Array.Copy(z, 0, sav, savshift + Trainer1 + 0x14, 4); byte[] y = BitConverter.GetBytes(Single.Parse(TB_CoordY.Text)); Array.Resize(ref y, 4); Array.Copy(y, 0, sav, savshift + Trainer1 + 0x18, 4); byte[] bp = BitConverter.GetBytes(Util.ToUInt32(TB_BP.Text)); Array.Resize(ref bp, 2); Array.Copy(bp, 0, sav, savshift + 0x963C - 0xC * Convert.ToInt16(m_parent.savegame_oras), 2); byte[] pm = BitConverter.GetBytes(Util.ToUInt32(TB_PM.Text)); Array.Resize(ref pm, 4); Array.Copy(pm, 0, sav, savshift + psssatoffset + 0xFC, 4); Array.Copy(pm, 0, sav, savshift + psssatoffset + 0x100, 4); sav[0x694D + savshift] = Byte.Parse(TB_Style.Text); // Copy Badges badgeval = 0; CheckBox[] cba = { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, }; for (int i = 0; i < 8; i++) { badgeval |= (byte)(Convert.ToByte(cba[i].Checked) << i); } sav[0x960C + savshift] = badgeval; // Save PlayTime byte[] h = BitConverter.GetBytes(UInt16.Parse(MT_Hours.Text)); Array.Resize(ref h, 2); Array.Copy(h, 0, sav, savshift + 0x6C00, 2); sav[0x6C02 + savshift] = (byte)(UInt16.Parse(MT_Minutes.Text) % 60); sav[0x6C03 + savshift] = (byte)(UInt16.Parse(MT_Seconds.Text) % 60); // Sprite sav[TrainerCard + 0x07] = Convert.ToByte(CB_Multi.SelectedValue); sav[TrainerCard + 0x31] = (byte)(Byte.Parse(MT_HairColor.Text) + (Byte.Parse(MT_Hat.Text) << 3)); sav[TrainerCard + 0x30 + savshift] = Byte.Parse(MT_14030.Text); //sav[TrainerCard + 0x31 + savshift] = Byte.Parse(MT_14031.Text); sav[TrainerCard + 0x32 + savshift] = Byte.Parse(MT_14032.Text); sav[TrainerCard + 0x33 + savshift] = Byte.Parse(MT_14033.Text); sav[TrainerCard + 0x34 + savshift] = Byte.Parse(MT_14034.Text); sav[TrainerCard + 0x35 + savshift] = Byte.Parse(MT_14035.Text); sav[TrainerCard + 0x36 + savshift] = Byte.Parse(MT_14036.Text); sav[TrainerCard + 0x37 + savshift] = Byte.Parse(MT_14037.Text); sav[TrainerCard + 0x38 + savshift] = Byte.Parse(MT_14038.Text); sav[TrainerCard + 0x39 + savshift] = Byte.Parse(MT_14039.Text); sav[TrainerCard + 0x3A + savshift] = Byte.Parse(MT_1403A.Text); sav[TrainerCard + 0x3B + savshift] = Byte.Parse(MT_1403B.Text); sav[TrainerCard + 0x3C + savshift] = Byte.Parse(MT_1403C.Text); sav[TrainerCard + 0x3D + savshift] = Byte.Parse(MT_1403D.Text); sav[TrainerCard + 0x3E + savshift] = Byte.Parse(MT_1403E.Text); sav[TrainerCard + 0x3F + savshift] = Byte.Parse(MT_1403F.Text); // Vivillon sav[VivillonForm + savshift] = (byte)Util.ToUInt32(CB_Vivillon.SelectedValue.ToString()); }
private void CB_Multi_SelectedIndexChanged(object sender, EventArgs e) { PB_Sprite.Image = (Image)Properties.Resources.ResourceManager.GetObject((m_parent.savegame_oras) ? "tr_" + Util.getIndex(CB_Multi).ToString("00") : "tr_00"); }
public SAV_Trainer(Form1 frm1) { InitializeComponent(); try { TB_OTName.Font = PKX.getPKXFont(11); } catch (Exception e) { Util.Alert("Font loading failed...", e.ToString()); } Util.TranslateInterface(this, Form1.curlanguage); m_parent = frm1; Array.Copy(m_parent.savefile, sav, 0x100000); savindex = m_parent.savindex; savshift = savindex * 0x7F000; if (m_parent.savegame_oras) { psssatoffset = 0x24800; Maison += 0xA00; VivillonForm = 0x9644; this.Width = (int)((float)Width * (float)428 / (float)590); CB_Multi.Enabled = true; L_MultiplayerSprite.Enabled = true; // Multiplayer Sprite Label L_Style.Visible = false; // Style Label TB_Style.Visible = false; GB_Appear.Visible = false; } editing = true; getComboBoxes(); getTextBoxes(); getBadges(); statdata = new string[] { "0x000", "0x000", // Steps taken? "0x004", "0x004", // Minutes Played / Pokemon Encountered? "0x008", "0x008", "0x00C", "0x00C", "0x010", "0x010", "0x014", "0x014", "0x018", "0x018", "0x01C", "PKMN Captured", "0x020", "0x020", "0x024", "Eggs Hatched", "0x028", "PKMN Evolved", "0x02C", "0x02C", "0x030", "~People Passed", "0x034", "0x034", "0x038", "0x038", "0x03C", "0x03C", "0x040", "0x040", "0x044", "0x044", "0x048", "0x048", "0x04C", "0x04C", "0x050", "0x050", "0x054", "0x054", "0x058", "0x058", "0x05C", "0x05C", "0x060", "0x060", "0x064", "0x064", "0x068", "0x068", "0x06C", "0x06C", "0x070", "0x070", "0x074", "0x074", "0x078", "0x078", "0x07C", "0x07C", "0x080", "0x080", "0x084", "0x084", "0x088", "0x088", "0x08C", "0x08C", "0x090", "0x090", "0x094", "0x094", "0x098", "0x098", "0x09C", "0x09C", "0x0A0", "0x0A0", "0x0A4", "0x0A4", "0x0A8", "0x0A8", "0x0AC", "0x0AC", "0x0B0", "0x0B0", "0x0B4", "0x0B4", "0x0B8", "0x0B8", "0x0BC", "0x0BC", "0x0C0", "0x0C0", "0x0C4", "0x0C4", "0x0C8", "0x0C8", "0x0CC", "0x0CC", "0x0D0", "0x0D0", "0x0D4", "0x0D4", "0x0D8", "0x0D8", "0x0DC", "0x0DC", "0x0E0", "0x0E0", "0x0E4", "0x0E4", "0x0E8", "0x0E8", "0x0EC", "Nice! Received", "0x0F0", "0x0F0", "0x0F4", "Total People Met Online", "0x0F8", "0x0F8", "0x0FC", "Current Pokemiles", "0x100", "Obtained Pokemiles", "0x104", "0x104", "0x108", "0x108", "0x10C", "Super Training Clears", "0x110", "Times Judged", "0x114", "0x114", "0x118", "0x118", // Link Trades? "0x11C", "Link Battle", // Wins", // ? "0x120", "0x120", // Link Battle Losses? "0x124", "0x124", "0x128", "0x128", "0x12C", "0x12C", "0x130", "0x130", "0x134", "0x134", "0x138", "0x138", "0x13C", "0x13C", "0x140", "Flags Captured", "0x144", "0x144", "0x148", "0x148", "0x14C", "0x14C", "0x150", "0x150", "0x154", "0x154", "0x158", "0x158", "0x15C", "0x15C", "0x160", "0x160", "0x164", "0x164", "0x168", "0x168", "0x16C", "0x16C", "0x170", "0x170", "0x174", "0x174", "0x178", "0x178", "0x17C", "0x17C", "0x180", "0x180", "0x184", "0x184", "0x188", "0x188", "0x18C", "0x18C", "0x190", "0x190", "0x194", "0x194", "0x198", "0x198", "0x19C", "0x19C", "0x1A0", "0x1A0", "0x1A4", "0x1A4", "0x1A8", "0x1A8", "0x1AC", "0x1AC", "0x1B0", "0x1B0", "0x1B4", "0x1B4", "0x1B8", "0x1B8", "0x1BC", "Battle Tests", "0x1C0", "0x1C0", "0x1C4", "0x1C4", "0x1C8", "0x1C8", "0x1CC", "0x1CC", "0x1D0", "0x1D0", "0x1D4", "0x1D4", "0x1D8", "0x1D8", "0x1DC", "0x1DC", "0x1E0", "0x1E0", "0x1E4", "0x1E4", "0x1E8", "0x1E8", "0x1EC", "0x1EC", "0x1F0", "0x1F0", "0x1F4", "0x1F4", "0x1F8", "0x1F8", "0x1FC", "0x1FC", "0x200", "0x200", "0x204", "0x204", "0x208", "0x208", "0x20C", "0x20C", "0x210", "0x210", "0x214", "0x214", "0x218", "0x218", "0x21C", "0x21C", "0x220", "0x220", "0x224", "0x224", "0x228", "0x228", "0x22C", "0x22C", "0x230", "0x230", "0x234", "0x234", "0x238", "0x238", "0x23C", "0x23C", "0x240", "0x240", "0x244", "0x244", "0x248", "0x248", "0x24C", "0x24C", "0x250", "0x250", "0x254", "0x254", "0x258", "0x258", }; // Offset, Title. Horrible implementation, but works. CB_Stats.Items.Clear(); for (int i = 0; i < statdata.Length / 2; i++) { CB_Stats.Items.Add(statdata[2 * i + 1]); } CB_Stats.SelectedIndex = 0; }
private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); loadSAV((Util.Prompt(MessageBoxButtons.YesNo, "FlagDiff Researcher:", "Yes: Old Save" + Environment.NewLine + "No: New Save") == DialogResult.Yes) ? B_LoadOld : B_LoadNew, files[0]); }
private PKM preparePK2() { PK2 pk2 = pkm as PK2; if (pk2 == null) return null; pk2.Species = Util.getIndex(CB_Species); pk2.TID = Util.ToInt32(TB_TID.Text); pk2.EXP = Util.ToUInt32(TB_EXP.Text); pk2.HeldItem = Util.getIndex(CB_HeldItem); pk2.IsEgg = CHK_IsEgg.Checked; pk2.CurrentFriendship = Util.ToInt32(TB_Friendship.Text); pk2.Met_Level = Util.ToInt32(TB_MetLevel.Text); pk2.Met_Location = Util.getIndex(CB_MetLocation); pk2.Met_TimeOfDay = CB_MetTimeOfDay.SelectedIndex; pk2.EV_HP = Util.ToInt32(TB_HPEV.Text); pk2.EV_ATK = Util.ToInt32(TB_ATKEV.Text); pk2.EV_DEF = Util.ToInt32(TB_DEFEV.Text); pk2.EV_SPE = Util.ToInt32(TB_SPEEV.Text); pk2.EV_SPC = Util.ToInt32(TB_SPAEV.Text); if (CHK_Nicknamed.Checked) pk2.Nickname = TB_Nickname.Text; else pk2.setNotNicknamed(); pk2.Move1 = Util.getIndex(CB_Move1); pk2.Move2 = Util.getIndex(CB_Move2); pk2.Move3 = Util.getIndex(CB_Move3); pk2.Move4 = Util.getIndex(CB_Move4); pk2.Move1_PP = Util.getIndex(CB_Move1) > 0 ? Util.ToInt32(TB_PP1.Text) : 0; pk2.Move2_PP = Util.getIndex(CB_Move2) > 0 ? Util.ToInt32(TB_PP2.Text) : 0; pk2.Move3_PP = Util.getIndex(CB_Move3) > 0 ? Util.ToInt32(TB_PP3.Text) : 0; pk2.Move4_PP = Util.getIndex(CB_Move4) > 0 ? Util.ToInt32(TB_PP4.Text) : 0; pk2.Move1_PPUps = Util.getIndex(CB_Move1) > 0 ? CB_PPu1.SelectedIndex : 0; pk2.Move2_PPUps = Util.getIndex(CB_Move2) > 0 ? CB_PPu2.SelectedIndex : 0; pk2.Move3_PPUps = Util.getIndex(CB_Move3) > 0 ? CB_PPu3.SelectedIndex : 0; pk2.Move4_PPUps = Util.getIndex(CB_Move4) > 0 ? CB_PPu4.SelectedIndex : 0; pk2.IV_HP = Util.ToInt32(TB_HPIV.Text); pk2.IV_ATK = Util.ToInt32(TB_ATKIV.Text); pk2.IV_DEF = Util.ToInt32(TB_DEFIV.Text); pk2.IV_SPE = Util.ToInt32(TB_SPEIV.Text); pk2.IV_SPA = Util.ToInt32(TB_SPAIV.Text); pk2.OT_Name = TB_OT.Text; // Toss in Party Stats Array.Resize(ref pk2.Data, pk2.SIZE_PARTY); pk2.Stat_Level = Util.ToInt32(TB_Level.Text); pk2.Stat_HPCurrent = Util.ToInt32(Stat_HP.Text); pk2.Stat_HPMax = Util.ToInt32(Stat_HP.Text); pk2.Stat_ATK = Util.ToInt32(Stat_ATK.Text); pk2.Stat_DEF = Util.ToInt32(Stat_DEF.Text); pk2.Stat_SPE = Util.ToInt32(Stat_SPE.Text); pk2.Stat_SPA = Util.ToInt32(Stat_SPA.Text); pk2.Stat_SPD = Util.ToInt32(Stat_SPD.Text); if (HaX) { pk2.Stat_Level = (byte)Math.Min(Convert.ToInt32(MT_Level.Text), byte.MaxValue); } // Fix Moves if a slot is empty pk2.FixMoves(); return pk2; }
private void loadchks() { // Load Bools for the data int pk; try { pk = Util.getIndex(CB_Species); } catch { pk = LB_Species.SelectedIndex + 1; } CheckBox[] CP = { CHK_P1, CHK_P2, CHK_P3, CHK_P4, CHK_P5, CHK_P6, CHK_P7, CHK_P8, CHK_P9, CHK_P10, }; CheckBox[] CL = { CHK_L1, CHK_L2, CHK_L3, CHK_L4, CHK_L5, CHK_L6, CHK_L7, }; // Load Partitions for (int i = 0; i < 10; i++) { CP[i].Checked = specbools[i, pk - 1]; } for (int i = 0; i < 7; i++) { CL[i].Checked = langbools[i, pk - 1]; } if (pk < 650) { CHK_F1.Enabled = true; CHK_F1.Checked = foreignbools[pk - 1]; } else { CHK_F1.Enabled = CHK_F1.Checked = false; } if (pk > 721) { //CHK_P1.Checked = CHK_P1.Enabled = false; //CHK_P10.Checked = CHK_P10.Enabled = false; //CHK_P6.Enabled = CHK_P7.Enabled = CHK_P8.Enabled = CHK_P9.Enabled = false; for (int i = 0; i < 10; i++) { CP[i].Enabled = true; } for (int i = 0; i < 7; i++) { CL[i].Checked = CL[i].Enabled = false; } } else { CHK_P1.Enabled = true; CHK_P10.Enabled = true; int index = LB_Species.SelectedIndex + 1; PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(index); int gt = MonData.GenderRatio; CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = (gt != 254); // Not Female-Only CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = (gt != 0) && (gt != 255); // Not Male-Only and Not Genderless for (int i = 0; i < 7; i++) { CL[i].Enabled = true; } } }
private void saveChanges() { // Save back the Species Bools // Return to Byte Array for (int p = 0; p < 10; p++) { byte[] sdata = new byte[0x60]; for (int i = 0; i < 0x60 * 8; i++) { if (specbools[p, i]) { sdata[i / 8] |= (byte)(1 << i % 8); } } Array.Copy(sdata, 0, sav, Main.SaveGame.PokeDex + 8 + 0x60 * p, 0x60); } // Build new bool array for the Languages { bool[] languagedata = new bool[0x280 * 8]; for (int i = 0; i < 731; i++) { for (int l = 0; l < 7; l++) { languagedata[i * 7 + l] = langbools[l, i]; } } // Return to Byte Array byte[] ldata = new byte[languagedata.Length / 8]; for (int i = 0; i < languagedata.Length; i++) { if (languagedata[i]) { ldata[i / 8] |= (byte)(1 << i % 8); } } Array.Copy(ldata, 0, sav, Main.SaveGame.PokeDexLanguageFlags, 0x280); } // Return Foreign Array { byte[] foreigndata = new byte[0x52]; for (int i = 0; i < 0x52 * 8; i++) { if (foreignbools[i]) { foreigndata[i / 8] |= (byte)(1 << i % 8); } } Array.Copy(foreigndata, 0, sav, Main.SaveGame.PokeDex + 0x64C, 0x52); } // Store Spinda Spot uint PID = Util.getHEXval(TB_Spinda); Array.Copy(BitConverter.GetBytes(PID), 0, sav, Main.SaveGame.Spinda, 4); }