Exemple #1
0
        private void ReadInfo()
        {
            pkm = Main.SpeciesStat[entry];

            TB_BaseHP.Text  = pkm.HP.ToString("000");
            TB_BaseATK.Text = pkm.ATK.ToString("000");
            TB_BaseDEF.Text = pkm.DEF.ToString("000");
            TB_BaseSPE.Text = pkm.SPE.ToString("000");
            TB_BaseSPA.Text = pkm.SPA.ToString("000");
            TB_BaseSPD.Text = pkm.SPD.ToString("000");
            TB_HPEVs.Text   = pkm.EV_HP.ToString("0");
            TB_ATKEVs.Text  = pkm.EV_ATK.ToString("0");
            TB_DEFEVs.Text  = pkm.EV_DEF.ToString("0");
            TB_SPEEVs.Text  = pkm.EV_SPE.ToString("0");
            TB_SPAEVs.Text  = pkm.EV_SPA.ToString("0");
            TB_SPDEVs.Text  = pkm.EV_SPD.ToString("0");

            CB_Type1.SelectedIndex = pkm.Types[0];
            CB_Type2.SelectedIndex = pkm.Types[1];

            TB_CatchRate.Text = pkm.CatchRate.ToString("000");
            TB_Stage.Text     = pkm.EvoStage.ToString("0");

            CB_HeldItem1.SelectedIndex = pkm.Items[0];
            CB_HeldItem2.SelectedIndex = pkm.Items[1];
            CB_HeldItem3.SelectedIndex = pkm.Items[2];

            TB_Gender.Text      = pkm.Gender.ToString("000");
            TB_HatchCycles.Text = pkm.HatchCycles.ToString("000");
            TB_Friendship.Text  = pkm.BaseFriendship.ToString("000");

            CB_EXPGroup.SelectedIndex = pkm.EXPGrowth;

            CB_EggGroup1.SelectedIndex = pkm.EggGroups[0];
            CB_EggGroup2.SelectedIndex = pkm.EggGroups[1];

            CB_Ability1.SelectedIndex = pkm.Abilities[0];
            CB_Ability2.SelectedIndex = pkm.Abilities[1];
            CB_Ability3.SelectedIndex = pkm.Abilities[2];

            TB_FormeCount.Text  = pkm.FormeCount.ToString("000");
            TB_FormeSprite.Text = pkm.FormeSprite.ToString("000");

            TB_RawColor.Text       = pkm.Color.ToString("000");
            CB_Color.SelectedIndex = pkm.Color & 0xF;

            TB_BaseExp.Text = pkm.BaseEXP.ToString("000");
            TB_BST.Text     = pkm.BST.ToString("000");

            TB_Height.Text = ((decimal)pkm.Height / 100).ToString("00.00");
            TB_Weight.Text = ((decimal)pkm.Weight / 10).ToString("000.0");

            for (int i = 0; i < CLB_TMHM.Items.Count; i++)
            {
                CLB_TMHM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TMHM
            }
            for (int i = 0; i < CLB_MoveTutors.Items.Count; i++)
            {
                CLB_MoveTutors.SetItemChecked(i, pkm.TypeTutors[i]); // Bitflags for Tutors
            }
            if (pkm.SpecialTutors.Length > 0)
            {
                int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length };
                int   ctr = 0;
                for (int i = 0; i < len.Length; i++)
                {
                    for (int b = 0; b < len[i]; b++)
                    {
                        CLB_ORASTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]);
                    }
                }
            }
        }
Exemple #2
0
        private void B_Randomize_Click(object sender, EventArgs e)
        {
            Random rnd       = new Random();
            int    TMPercent = 35; // Average Learnable TMs is 35.260.

            ushort[] itemlist  = (Main.oras) ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY;
            ushort[] berrylist = Legal.Pouch_Berry_XY;
            Array.Resize(ref itemlist, itemlist.Length + berrylist.Length);
            Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length);

            int itemlen = itemlist.Length;
            int abillen = CB_Ability1.Items.Count;
            int typelen = CB_Type1.Items.Count;

            for (int i = 1; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species

                // Fiddle with TM Learnsets
                for (int t = 0; t < CLB_TMHM.Items.Count; t++)
                {
                    CLB_TMHM.SetItemChecked(t, rnd.Next(0, 100) < TMPercent);
                }


                // Abilities:
                int[] abils = new int[3];
                for (int a = 0; a < 3; a++) // Get 3 New Abilities, none being Wonder Guard (25)
                {
                    int newabil = rnd.Next(1, abillen); while (newabil == 25)
                    {
                        newabil = rnd.Next(1, abillen);
                    }
                    abils[a] = newabil;
                }
                CB_Ability1.SelectedIndex = rnd.Next(1, abillen);
                CB_Ability2.SelectedIndex = rnd.Next(1, abillen);
                CB_Ability3.SelectedIndex = rnd.Next(1, abillen);


                // Fiddle with Base Stats, don't muck with Shedinja.
                if (Convert.ToByte(byte_boxes[0].Text) == 1)
                {
                    CB_Ability1.SelectedIndex = CB_Ability2.SelectedIndex = CB_Ability3.SelectedIndex = 25;
                }
                else
                {
                    for (int z = 0; z < 6; z++)
                    {
                        byte_boxes[z].Text =
                            Math.Max(
                                5,
                                rnd.Next
                                (
                                    Convert.ToByte(byte_boxes[z].Text) * 3 / 4,
                                    (byte)Convert.ToByte(byte_boxes[z].Text) * 5 / 4)
                                )
                            .ToString("000");
                    }
                }

                // EV yield stays the same...

                // Items
                CB_HeldItem1.SelectedIndex = (CB_HeldItem1.SelectedIndex > 0) ? itemlist[rnd.Next(1, itemlen)] : 0;
                CB_HeldItem2.SelectedIndex = (CB_HeldItem2.SelectedIndex > 0) ? itemlist[rnd.Next(1, itemlen)] : 0;
                CB_HeldItem3.SelectedIndex = (CB_HeldItem3.SelectedIndex > 0) ? itemlist[rnd.Next(1, itemlen)] : 0;

                // Type
                if (rnd.Next(0, 100) < 50) // 50% chance to have either Single or Dual Typing
                {
                    CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen);
                }
                else
                {
                    CB_Type1.SelectedIndex = rnd.Next(0, typelen);
                    CB_Type2.SelectedIndex = rnd.Next(0, typelen);
                }
            }
            saveEntry();
            Util.Alert("All relevant Pokemon Personal Entries have been randomized!");
        }
Exemple #3
0
        private void readInfo()
        {
            byte[] array = new byte[Main.oras ? 0x50 : 0x40];
            Array.Copy(data, array.Length * entry, array, 0, array.Length);
            pkm = new PersonalInfo(array);

            TB_BaseHP.Text  = pkm.HP.ToString("000");
            TB_BaseATK.Text = pkm.ATK.ToString("000");
            TB_BaseDEF.Text = pkm.DEF.ToString("000");
            TB_BaseSPE.Text = pkm.SPE.ToString("000");
            TB_BaseSPA.Text = pkm.SPA.ToString("000");
            TB_BaseSPD.Text = pkm.SPD.ToString("000");
            TB_HPEVs.Text   = pkm.EV_HP.ToString("0");
            TB_ATKEVs.Text  = pkm.EV_ATK.ToString("0");
            TB_DEFEVs.Text  = pkm.EV_DEF.ToString("0");
            TB_SPEEVs.Text  = pkm.EV_SPE.ToString("0");
            TB_SPAEVs.Text  = pkm.EV_SPA.ToString("0");
            TB_SPDEVs.Text  = pkm.EV_SPD.ToString("0");

            CB_Type1.SelectedIndex = pkm.Types[0];
            CB_Type2.SelectedIndex = pkm.Types[1];

            TB_CatchRate.Text = pkm.CatchRate.ToString("000");
            TB_Stage.Text     = pkm.EvoStage.ToString("0");

            CB_HeldItem1.SelectedIndex = pkm.Items[0];
            CB_HeldItem2.SelectedIndex = pkm.Items[1];
            CB_HeldItem3.SelectedIndex = pkm.Items[2];

            TB_Gender.Text      = pkm.Gender.ToString("000");
            TB_HatchCycles.Text = pkm.HatchCycles.ToString("000");
            TB_Friendship.Text  = pkm.BaseFriendship.ToString("000");

            CB_EXPGroup.SelectedIndex = pkm.EXPGrowth;

            CB_EggGroup1.SelectedIndex = pkm.EggGroups[0];
            CB_EggGroup2.SelectedIndex = pkm.EggGroups[1];

            CB_Ability1.SelectedIndex = pkm.Abilities[0];
            CB_Ability2.SelectedIndex = pkm.Abilities[1];
            CB_Ability3.SelectedIndex = pkm.Abilities[2];

            TB_FormeCount.Text  = pkm.FormeCount.ToString("000");
            TB_FormeSprite.Text = pkm.FormeSprite.ToString("000");

            TB_RawColor.Text       = pkm.Color.ToString("000");
            CB_Color.SelectedIndex = pkm.Color & 0xF;

            TB_BaseExp.Text = pkm.BaseEXP.ToString("000");

            TB_Height.Text = (pkm.Height / 100).ToString("00.0");
            TB_Weight.Text = (pkm.Weight / 10).ToString("000.0");

            for (int i = 0; i < CLB_TMHM.Items.Count; i++)
            {
                CLB_TMHM.SetItemChecked(i, pkm.TMHM[i]); // Bitflags for TMHM
            }
            for (int i = 0; i < CLB_MoveTutors.Items.Count; i++)
            {
                CLB_MoveTutors.SetItemChecked(i, pkm.Tutors[i]); // Bitflags for Tutors
            }
            if (pkm.ORASTutors[0] != null)
            {
                int[] len = { tutor1.Length, tutor2.Length, tutor3.Length, tutor4.Length };
                int   ctr = 0;
                for (int i = 0; i < len.Length; i++)
                {
                    for (int b = 0; b < len[i]; b++)
                    {
                        CLB_OrasTutors.SetItemChecked(ctr++, pkm.ORASTutors[i][b]);
                    }
                }
            }
        }
Exemple #4
0
        private void readEntry()
        {
            int len = 0;

            if (mode == "ORAS")
            {
                len = 0x50;
            }
            else if (mode == "XY")
            {
                len = 0x40;
            }

            byte[] file = new byte[len];
            Array.Copy(data, len * entry, file, 0, len);
            TB_BaseHP.Text  = file[0].ToString("000");
            TB_BaseATK.Text = file[1].ToString("000");
            TB_BaseDEF.Text = file[2].ToString("000");
            TB_BaseSPE.Text = file[3].ToString("000");
            TB_BaseSPA.Text = file[4].ToString("000");
            TB_BaseSPD.Text = file[5].ToString("000");
            bst             = file[0] + file[1] + file[2] + file[3] + file[4] + file[5];

            int EVs = BitConverter.ToInt16(file, 0xA);

            TB_HPEVs.Text  = ((EVs >> 0) & 0x3).ToString("0");
            TB_ATKEVs.Text = ((EVs >> 2) & 0x3).ToString("0");
            TB_DEFEVs.Text = ((EVs >> 4) & 0x3).ToString("0");
            TB_SPEEVs.Text = ((EVs >> 6) & 0x3).ToString("0");
            TB_SPAEVs.Text = ((EVs >> 8) & 0x3).ToString("0");
            TB_SPDEVs.Text = ((EVs >> 10) & 0x3).ToString("0");

            CB_Type1.SelectedIndex = file[6];
            CB_Type2.SelectedIndex = file[7];

            TB_CatchRate.Text = file[8].ToString("000");
            TB_Stage.Text     = file[9].ToString("0");

            CB_HeldItem1.SelectedIndex = BitConverter.ToUInt16(file, 0xC);
            CB_HeldItem2.SelectedIndex = BitConverter.ToUInt16(file, 0xE);
            CB_HeldItem3.SelectedIndex = BitConverter.ToUInt16(file, 0x10);

            TB_Gender.Text      = file[0x12].ToString("000");
            TB_HatchCycles.Text = file[0x13].ToString("000");
            TB_Friendship.Text  = file[0x14].ToString("000");

            CB_EXPGroup.SelectedIndex = file[0x15];

            CB_EggGroup1.SelectedIndex = file[0x16];
            CB_EggGroup2.SelectedIndex = file[0x17];

            CB_Ability1.SelectedIndex = file[0x18];
            CB_Ability2.SelectedIndex = file[0x19];
            CB_Ability3.SelectedIndex = file[0x1A];

            TB_FormeCount.Text  = file[0x20].ToString("000");
            TB_FormeSprite.Text = BitConverter.ToUInt16(file, 0x1E).ToString("000");

            int color = file[0x21] & 0xF;

            TB_RawColor.Text       = file[0x21].ToString("000");
            CB_Color.SelectedIndex = color;

            TB_BaseExp.Text = BitConverter.ToUInt16(file, 0x22).ToString("000");

            TB_Height.Text = ((float)BitConverter.ToUInt16(file, 0x24) / 100).ToString("00.0");
            TB_Weight.Text = ((float)BitConverter.ToUInt16(file, 0x26) / 10).ToString("000.0");

            for (int i = 0; i < 16; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (i * 8 + j < CLB_TMHM.Items.Count)
                    {
                        CLB_TMHM.SetItemChecked(i * 8 + j, ((file[0x28 + i] >> j) & 0x1) == 1); //Bitflags for TMHM
                    }
                }
            }
            uint tutors = BitConverter.ToUInt32(file, 0x38);
            for (int t = 0; t < 8; t++)
            {
                if (t < CLB_MoveTutors.Items.Count)
                {
                    CLB_MoveTutors.SetItemChecked(t, ((tutors >> t) & 1) == 1);
                }
            }

            if (mode == "ORAS")
            {
                uint[] tutorm = new uint[4];
                for (int j = 0x40; j < 0x50; j += 4)
                {
                    tutorm[(j - 0x40) / 4] = BitConverter.ToUInt32(file, j);
                }

                int ofs = 0;
                for (int j = 0; j < tutorm.Length; j++)
                {
                    for (int i = 0; i < 32; i++)
                    {
                        if (ofs + i < CLB_OrasTutors.Items.Count)
                        {
                            CLB_OrasTutors.SetItemChecked(ofs + i, ((tutorm[j] >> i) & 1) == 1);
                        }
                    }
                    // hardcode this, bad, I know
                    if (j == 0)
                    {
                        ofs += tutor1.Length;
                    }
                    else if (j == 1)
                    {
                        ofs += tutor2.Length;
                    }
                    else if (j == 2)
                    {
                        ofs += tutor3.Length;
                    }
                    else
                    {
                        ofs += tutor4.Length;
                    }
                }
            }
            if (!dumping)
            {
                int[]  specForm = Personal.getSpecies(data, Main.oras, CB_Species.SelectedIndex);
                string filename = "_" + specForm[0] + ((CB_Species.SelectedIndex > 721) ? "_" + (specForm[1] + 1) : "");
                Bitmap rawImg   = (Bitmap)Properties.Resources.ResourceManager.GetObject(filename);
                Bitmap bigImg   = new Bitmap(rawImg.Width * 2, rawImg.Height * 2);
                for (int x = 0; x < rawImg.Width; x++)
                {
                    for (int y = 0; y < rawImg.Height; y++)
                    {
                        Color c = rawImg.GetPixel(x, y);
                        bigImg.SetPixel(2 * x, 2 * y, c);
                        bigImg.SetPixel(2 * x + 1, 2 * y, c);
                        bigImg.SetPixel(2 * x, 2 * y + 1, c);
                        bigImg.SetPixel(2 * x + 1, 2 * y + 1, c);
                    }
                }
                PB_MonSprite.Image = bigImg;
            }
        }