Esempio n. 1
0
        private void setPokemon()
        {
            if (pkEntry < 0 || dumping)
            {
                return;
            }

            // Each File is 16 Bytes.
            Maison7.Pokemon pkm = new Maison7.Pokemon(pkFiles[pkEntry])
            {
                Species = (ushort)CB_Species.SelectedIndex,
                HP      = CHK_HP.Checked,
                ATK     = CHK_ATK.Checked,
                DEF     = CHK_DEF.Checked,
                SPE     = CHK_Spe.Checked,
                SPA     = CHK_SpA.Checked,
                SPD     = CHK_SpD.Checked,
                Nature  = (byte)CB_Nature.SelectedIndex,
                Item    = (ushort)CB_Item.SelectedIndex,
                Move1   = CB_Move1.SelectedIndex,
                Move2   = CB_Move2.SelectedIndex,
                Move3   = CB_Move3.SelectedIndex,
                Move4   = CB_Move4.SelectedIndex,
                Form    = (ushort)NUD_Form.Value,
            };

            byte[] data = pkm.Write();
            pkFiles[pkEntry] = data;
        }
Esempio n. 2
0
        private void getPokemon()
        {
            if (pkEntry < 0 || dumping)
            {
                return;
            }
            Maison7.Pokemon pkm = new Maison7.Pokemon(pkFiles[pkEntry]);

            // Get
            CB_Move1.SelectedIndex  = pkm.Moves[0];
            CB_Move2.SelectedIndex  = pkm.Moves[1];
            CB_Move3.SelectedIndex  = pkm.Moves[2];
            CB_Move4.SelectedIndex  = pkm.Moves[3];
            CHK_HP.Checked          = pkm.HP;
            CHK_ATK.Checked         = pkm.ATK;
            CHK_DEF.Checked         = pkm.DEF;
            CHK_Spe.Checked         = pkm.SPE;
            CHK_SpA.Checked         = pkm.SPA;
            CHK_SpD.Checked         = pkm.SPD;
            CB_Nature.SelectedIndex = pkm.Nature;
            CB_Item.SelectedIndex   = pkm.Item;
            NUD_Form.Value          = pkm.Form;

            CB_Species.SelectedIndex = pkm.Species; // Loaded last in order to refresh the sprite with all info.
            // Last 2 Bytes are unused.
        }
Esempio n. 3
0
        private void B_DumpPKs_Click(object sender, EventArgs e)
        {
            //File.WriteAllBytes("maiz", pkFiles.SelectMany(t => t).ToArray());
            string[] stats  = { "HP", "ATK", "DEF", "Spe", "SpA", "SpD" };
            string   result = "";

            for (int i = 0; i < pkFiles.Length; i++)
            {
                var pk = new Maison7.Pokemon(pkFiles[i]);
                if (pk.Species == 0)
                {
                    continue;
                }

                result += "======" + Environment.NewLine;
                result += $"{i} - {specieslist[pk.Species]}" + Environment.NewLine;
                result += "======" + Environment.NewLine;
                result += $"Held Item: {itemlist[pk.Item]}" + Environment.NewLine;
                result += $"Nature: {natures[pk.Nature]}" + Environment.NewLine;
                result += $"Move 1: {movelist[pk.Move1]}" + Environment.NewLine;
                result += $"Move 2: {movelist[pk.Move2]}" + Environment.NewLine;
                result += $"Move 3: {movelist[pk.Move3]}" + Environment.NewLine;
                result += $"Move 4: {movelist[pk.Move4]}" + Environment.NewLine;

                var EVstr = string.Join(",", pk.EVs.Select((iv, x) => iv ? stats[x] : string.Empty).Where(x => !string.IsNullOrWhiteSpace(x)));
                result += $"EV'd in: {(pk.EVs.Any() ? EVstr : "None")}" + Environment.NewLine;

                if (pk.Form > 0)
                {
                    result += $"Form: {pk.Form}" + Environment.NewLine;
                }

                result += Environment.NewLine;
            }
            SaveFileDialog sfd = new SaveFileDialog {
                FileName = "Maison Pokemon.txt", Filter = "Text File|*.txt"
            };

            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            File.WriteAllText(sfd.FileName, result, Encoding.Unicode);
        }