Exemple #1
0
        private void formClosing(object sender, FormClosingEventArgs e)
        {
            while (threads > 0) { Util.Alert("Please wait for all operations to finish first."); }

            updateStatus(Environment.NewLine + Environment.NewLine + "Saving data and closing the program...");
            try
            {
                if (TB_Path.Text.Length > 0) File.WriteAllText("config.ini", TB_Path.Text);
                if (!GB_RomFS.Enabled) return; // No data/threads need to be addressed if we haven't loaded anything.

                // Set the GameText back as other forms may have edited it.
                updateStatus(String.Format("GARC Get: {0} @ {1}... ", "gametext", getGARCFileName("gametext")));
                threadSet(RomFS + getGARCFileName("gametext"), "gametext", false);
                while (threads > 0) Thread.Sleep(100);

                Thread.Sleep(200); // Small gap between beeps for faster computers.

                updateStatus(String.Format("GARC Get: {0} @ {1}... ", "personal", getGARCFileName("personal")));
                threadSet(RomFS + getGARCFileName("personal"), "personal", false);
                while (threads > 0) Thread.Sleep(100);

                if (Directory.Exists("gametext")) Directory.Delete("gametext", true);
                if (Directory.Exists("personal")) Directory.Delete("personal", true);
            }
            catch { }
        }
Exemple #2
0
        private void getEntry()
        {
            if (loaded)
            {
                if (Main.oras && entry == 384 && !dumping) // Current Mon is Rayquaza
                {
                    Util.Alert("Rayquaza is special and uses a different activator for its evolution. If it knows Dragon Ascent, it can Mega Evolve", "Don't edit its evolution table if you want to keep this functionality.");
                }

                byte[] data = File.ReadAllBytes(files[entry]);

                foreach (ComboBox CB in forme_spec)
                {
                    Personal.setForms(entry, CB, AltForms);
                }

                for (int i = 0; i < 3; i++)
                {
                    ushort method = BitConverter.ToUInt16(data, 2 + (i * 8));
                    ushort form   = BitConverter.ToUInt16(data, i * 8);
                    int    item   = (int)(BitConverter.ToUInt16(data, 4 + i * 8));
                    checkbox_spec[i].Checked    = (method == 1);
                    forme_spec[i].SelectedIndex = form;
                    item_spec[i].SelectedValue  = (int)item;
                }
            }
        }
Exemple #3
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            if (!CHK_Category.Checked && !CHK_Type.Checked)
            {
                return;
            }
            Random rnd = new Random();

            for (int i = 0; i < CB_Move.Items.Count; i++)
            {
                CB_Move.SelectedIndex = i; // Get new Move
                if (i == 165 || i == 174)
                {
                    continue;                       // Don't change Struggle or Curse
                }
                // Change Damage Category if Not Status
                if (CB_Category.SelectedIndex > 0 && CHK_Category.Checked) // Not Status
                {
                    CB_Category.SelectedIndex = rnd.Next(1, 3);
                }

                // Change Move Type
                if (CHK_Type.Checked)
                {
                    CB_Type.SelectedIndex = rnd.Next(0, 18);
                }
            }
            Util.Alert("Moves have been randomized!");
        }
Exemple #4
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Randomize all Move Types and Categories?", "Everything else will stay the same."))
            {
                return;
            }
            Random rnd = new Random();

            for (int i = 0; i < CB_Move.Items.Count; i++)
            {
                CB_Move.SelectedIndex = i; // Get new Move
                if (i == 165 || i == 174)
                {
                    continue;                       // Don't change Struggle or Curse
                }
                // Change Damage Category if Not Status
                if (CB_Category.SelectedIndex > 0) // Not Status
                {
                    CB_Category.SelectedIndex = rnd.Next(1, 3);
                }

                // Change Move Type
                CB_Type.SelectedIndex = rnd.Next(0, 18);
            }
            Util.Alert("Moves have been randomized!");
        }
Exemple #5
0
 public Mart()
 {
     InitializeComponent();
     if (Main.ExeFSPath == null)
     {
         Util.Alert("No exeFS code to load."); Close();
     }
     string[] files = Directory.GetFiles(Main.ExeFSPath);
     if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code"))
     {
         Util.Alert("No .code.bin detected."); Close();
     }
     data = File.ReadAllBytes(files[0]);
     if (data.Length % 0x200 != 0)
     {
         Util.Alert(".code.bin not decompressed. Aborting."); Close();
     }
     offset      = Util.IndexOfBytes(data, new byte[] { 0x00, 0x72, 0x6F, 0x6D, 0x3A, 0x2F, 0x44, 0x6C, 0x6C, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4D, 0x65, 0x6E, 0x75, 0x2E, 0x63, 0x72, 0x6F, 0x00 }, 0x400000, 0) + 0x17;
     codebin     = files[0];
     itemlist[0] = "";
     setupDGV();
     foreach (string s in locations)
     {
         CB_Location.Items.Add(s);
     }
     CB_Location.SelectedIndex = 0;
 }
Exemple #6
0
        private void getEntry()
        {
            if (!loaded)
            {
                return;
            }
            if (Main.Config.ORAS && entry == 384 && !dumping) // Current Mon is Rayquaza
            {
                Util.Alert("Rayquaza is special and uses a different activator for its evolution. If it knows Dragon Ascent, it can Mega Evolve", "Don't edit its evolution table if you want to keep this functionality.");
            }

            byte[] data = files[entry];

            foreach (ComboBox CB in forme_spec)
            {
                FormUtil.setForms(entry, CB, AltForms);
            }

            me = new MegaEvolutions(data);
            for (int i = 0; i < 3; i++)
            {
                checkbox_spec[i].Checked    = me.Method[i] == 1;
                item_spec[i].SelectedValue  = (int)me.Argument[i];
                forme_spec[i].SelectedIndex = me.Form[i];
            }
        }
        private void B_ModifyAll(object sender, EventArgs e)
        {
            for (int i = 1; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species

                if (CHK_NoEV.Checked)
                {
                    for (int z = 0; z < 6; z++)
                    {
                        ev_boxes[z].Text = 0.ToString();
                    }
                }
                if (CHK_LowCatch.Checked)
                {
                    TB_CatchRate.Text = 3.ToString("000");
                }
                if (CHK_Growth.Checked)
                {
                    CB_EXPGroup.SelectedIndex = 5;
                }
                if (CHK_EXP.Checked)
                {
                    TB_BaseExp.Text = (Convert.ToUInt16(TB_BaseExp.Text) / (100 / NUD_EXP.Value)).ToString("000");
                }

                if (CHK_QuickHatch.Checked)
                {
                    TB_HatchCycles.Text = 1.ToString();
                }
            }
            CB_Species.SelectedIndex = 1;
            Util.Alert("All species modified to specification!");
        }
Exemple #8
0
        // Main Form Methods
        private void L_About_Click(object sender, EventArgs e)
        {
            if (ModifierKeys == Keys.Control && RomFS != null)
            {
                string s = "Game Type: " + ((oras) ? "ORAS" : "XY") + Environment.NewLine;
                for (int i = 0; i < allGARCs.Length; i++)
                    s += String.Format(Environment.NewLine + "{0} - {1}", allGARCs[i], getGARCFileName(allGARCs[i]));
                if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?"))
                    try { Clipboard.SetText(s); }
                    catch { Util.Alert("Unable to copy to Clipboard."); }
            }
            else
                Util.Alert
                    (
                    "pk3DS: A package of Pokémon X/Y/OR/AS tools by various contributors.",

                    "GARCTool (Backbone): Kaphotics" + Environment.NewLine +
                    "Text Editing (xytext): Kaphotics" + Environment.NewLine +
                    "Wild Editor (**WE): SciresM & Kaphotics" + Environment.NewLine +
                    "Trainer Editor (**TE): SciresM, Kaphotics, and KazoWAR" + Environment.NewLine +
                    "Personal Editor: SciresM" + Environment.NewLine +
                    "Mega Evolution Editor (MEE): Huntereb & SciresM",

                    "After integrating standalone tools, the following editors were implemented:" + Environment.NewLine +
                    "Evolutions, Moves, Items, Maison, and ExeFS Editors: Kaphotics",

                    "Big thanks to the ProjectPokemon community!"
                    );
        }
Exemple #9
0
        // ExeFS Subform Items
        private void rebuildExeFS(object sender, EventArgs e)
        {
            if (ExeFS == null)
            {
                return;
            }
            if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") != DialogResult.Yes)
            {
                return;
            }

            string[] files = Directory.GetFiles(ExeFS);
            int      file  = 0; if (files[1].Contains("code"))
            {
                file = 1;
            }
            SaveFileDialog sfd = new SaveFileDialog {
                FileName = "exefs.bin", Filter = "Binary File|*.*"
            };

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                new Thread(() =>
                {
                    threads++;
                    new BLZCoder(new[] { "-en", files[file] }, pBar1);
                    Util.Alert("Compressed!");
                    ExeFSTool.set(Directory.GetFiles(ExeFS), sfd.FileName);
                    threads--;
                }).Start();
            }
        }
Exemple #10
0
 public Tutors()
 {
     InitializeComponent();
     if (Main.ExeFS == null)
     {
         Util.Alert("No exeFS code to load."); Close();
     }
     string[] files = Directory.GetFiles(Main.ExeFS);
     if (!File.Exists(files[0]) || !Path.GetFileNameWithoutExtension(files[0]).Contains("code"))
     {
         Util.Alert("No .code.bin detected."); Close();
     }
     data = File.ReadAllBytes(files[0]);
     if (data.Length % 0x200 != 0)
     {
         Util.Alert(".code.bin not decompressed. Aborting."); Close();
     }
     codebin     = files[0];
     movelist[0] = "";
     setupDGV();
     foreach (string s in locations)
     {
         CB_Location.Items.Add(s);
     }
     CB_Location.SelectedIndex = 0;
     Util.Alert("Changes made do not reflect ingame.", "Still needs more research.");
 }
Exemple #11
0
        // RomFS Subform Items
        private void rebuildRomFS(object sender, EventArgs e)
        {
            if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
            if (RomFS != null)
            {
                if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") == DialogResult.Yes)
                {
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.FileName = "romfs.bin";
                    sfd.Filter = "Binary File|*.*";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        new Thread(() =>
                        {
                            updateStatus(Environment.NewLine + "Building RomFS binary. Please wait until the program finishes.");

                            threads++;
                            RomFSTool.BuildRomFS(sfd.FileName, RomFS, RTB_Status, pBar1);
                            threads--;

                            updateStatus("RomFS binary saved." + Environment.NewLine);
                            Util.Alert("Wrote RomFS binary:", sfd.FileName);
                        }).Start();
                    }
                }
            }
        }
Exemple #12
0
        private void B_Import_Click(object sender, EventArgs e)
        {
            if (files.Length <= 0)
            {
                return;
            }
            OpenFileDialog Dump = new OpenFileDialog {
                Filter = "Text File|*.txt"
            };
            DialogResult odr = Dump.ShowDialog();

            if (odr != DialogResult.OK)
            {
                return;
            }
            string path = Dump.FileName;

            if (!importTextFile(path))
            {
                return;
            }

            // Reload the form with the new data.
            changeEntry(null, null);
            Util.Alert("Imported Text from Input Path:", path);
        }
Exemple #13
0
        private void clickSet(object sender, EventArgs e)
        {
            int slot = getSlot(sender);

            if (CB_Species.SelectedIndex == 0)
            {
                Util.Alert("Can't set empty slot."); return;
            }

            var pk = prepareTP7();
            var tr = Trainers[index];

            if (slot < tr.NumPokemon)
            {
                tr.Pokemon[slot] = pk;
            }
            else
            {
                tr.Pokemon.Add(pk);
                slot = tr.Pokemon.Count - 1;
                Trainers[index].NumPokemon = (int)(++NUD_NumPoke.Value);
            }

            getQuickFiller(pba[slot], pk);
            getSlotColor(slot, Properties.Resources.slotSet);
        }
Exemple #14
0
        private void insertFile(string path)
        {
            if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Overwrite image?"))
            {
                return;
            }
            byte[] data = File.ReadAllBytes(path);
            byte[] bclim;

            if (Path.GetExtension(path) == ".bclim") // bclim opened
            {
                var img = CTR.BCLIM.analyze(data, path);
                if (img.Width != PB_Image.Width || img.Height != PB_Image.Height)
                {
                    Util.Alert("Image sizes do not match.",
                               $"Width: {img.Width} - {PB_Image.Width}\nHeight: {img.Height} - {PB_Image.Height}");
                    return;
                }
                bclim = data;
            }
            else // image
            {
                using (Stream BitmapStream = new MemoryStream(data))
                {
                    Image img = Image.FromStream(BitmapStream);
                    if (img.Width != PB_Image.Width || img.Height != PB_Image.Height)
                    {
                        Util.Alert("Image sizes do not match.",
                                   $"Width: {img.Width} - {PB_Image.Width}\nHeight: {img.Height} - {PB_Image.Height}");
                        return;
                    }
                    bclim = CTR.BCLIM.IMGToBCLIM(img, '9');
                }
            }

            string filename = CB_File.Text;
            int    entry    = -1;
            // Find entry in darc
            var darc = darcs[CB_DARC.SelectedIndex];

            for (int i = 0; i < darc.Entries.Length; i++)
            {
                if (darc.FileNameTable[i].FileName == filename)
                {
                    entry = i;
                    break;
                }
            }
            if (entry < 0)
            {
                throw new Exception("File not found!?");
            }

            CTR.DARC.insertFile(ref darc, entry, bclim);
            darcs[CB_DARC.SelectedIndex] = darc;

            // Trigger reloading of the image
            changeFile(null, null);
        }
Exemple #15
0
 public void restoreGARCs(bool oras_define, params string[] g)
 {
     oras = oras_define;
     foreach (string s in g)
     {
         string dest = RomFS + getGARCFileName(s);
         string src = "backup" + Path.DirectorySeparatorChar + s + String.Format(" ({0})", getGARCFileName(s).Replace(Path.DirectorySeparatorChar.ToString(), ""));
         File.Copy(src, dest, true);
     }
     Util.Alert(g.Length + " files restored.");
 }
Exemple #16
0
 private void B_Personal_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     new Thread(() =>
     {
         string[] files = { "personal" };
         fileGet(files, false, true);
         Invoke((Action)(() => { new Personal().ShowDialog(); }));
         fileSet(files, true);
     }).Start();
 }
Exemple #17
0
 private void B_StoryText_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     new Thread(() =>
     {
         string[] files = { "storytext" };
         fileGet(files);
         Invoke((Action)(() => { new xytext(Directory.GetFiles("storytext")).ShowDialog(); }));
         fileSet(files);
     }).Start();
 }
Exemple #18
0
 private void B_Mart_Click(object sender, EventArgs e)
 {
     if (threads > 0)
     {
         Util.Alert("Please wait for all operations to finish first."); return;
     }
     if (ExeFS != null)
     {
         new Mart().Show();
     }
 }
Exemple #19
0
 private void B_EggMove_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     new Thread(() =>
     {
         string[] files = { "eggmove" };
         fileGet(files);
         Invoke((Action)(() => { new EggMove().ShowDialog(); }));
         fileSet(files);
     }).Start();
 }
Exemple #20
0
 private void B_Wild_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     new Thread(() =>
     {
         string[] files = { "encdata" };
         fileGet(files, false);
         if (oras) { Invoke((Action)(() => { new RSWE().ShowDialog(); })); }
         else { Invoke((Action)(() => { new XYWE().ShowDialog(); })); }
         fileSet(files);
     }).Start();
 }
Exemple #21
0
        private void B_Export_Click(object sender, EventArgs e)
        {
            B_Save_Click(sender, e);

            Directory.CreateDirectory("encdata");
            foreach (var Map in Areas)
            {
                var packed = getMapData(Map.Tables);
                File.WriteAllBytes(Path.Combine("encdata", Map.FileNumber.ToString()), packed);
            }
            Util.Alert("Exported all tables!");
        }
Exemple #22
0
        private void calcStats()
        {
            int[] moveTypes = Moves.getTypes();

            byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());

            int movectr = 0;
            int max     = 0;
            int spec    = 0;
            int stab    = 0;
            int species = 0;

            for (int i = 0; i < 722; i++)
            {
                byte[] movedata = File.ReadAllBytes(files[i]);
                if (movedata.Length <= 2)
                {
                    continue;
                }
                int movecount = BitConverter.ToUInt16(movedata, 0);
                if (movecount == 65535 || movecount < 0)
                {
                    continue;
                }
                species++;
                movectr += movecount; // Average Moves
                if (max < movecount)
                {
                    max = movecount; spec = i;
                }                                                   // Max Moves (and species)
                for (int m = 1; m < movedata.Length / 2; m++)
                {
                    int move = BitConverter.ToUInt16(movedata, m * 2);
                    if (move == 65535)
                    {
                        movectr--;
                        continue;
                    }
                    int movetype = moveTypes[move];
                    if (movetype == personalData[6 + (Main.oras ? 0x50 : 0x40) * i] ||
                        movetype == personalData[7 + (Main.oras ? 0x50 : 0x40) * i])
                    {
                        stab++;
                    }
                }
            }
            Util.Alert(String.Format("Moves Learned: {0}\r\nMost Learned: {1} @ {2}\r\nStab Count: {3}\r\nSpecies with EggMoves: {4}",
                                     movectr, max,
                                     spec, stab, species));
        }
Exemple #23
0
 private void B_Trainer_Click(object sender, EventArgs e)
 {
     if (threads > 0)
     {
         Util.Alert("Please wait for all operations to finish first."); return;
     }
     new Thread(() =>
     {
         string[] files = { "trdata", "trpoke" };
         fileGet(files);
         Invoke((Action)(() => new RSTE().ShowDialog()));
         fileSet(files);
     }).Start();
 }
Exemple #24
0
        private void openQuick(string path)
        {
            FileInfo fi = new FileInfo(path);
            if (!Directory.Exists(path)) return;

            if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
            if (fi.Name.Contains("code.bin"))
            {
                if (fi.Length % 0x200 == 0 && (Util.Prompt(MessageBoxButtons.YesNo, "Detected Decompressed code.bin.", "Compress? File will be replaced.") == DialogResult.Yes))
                    new Thread(() => { threads++; new blz.BLZCoder(new string[] { "-en", path }, pBar1); threads--; Util.Alert("Compressed!"); }).Start();
                else if (Util.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code.bin.", "Decompress? File will be replaced.") == DialogResult.Yes)
                    new Thread(() => { threads++; new blz.BLZCoder(new string[] { "-d", path }, pBar1); threads--; Util.Alert("Decompressed!"); }).Start();
                return;
            }
            else
            {
                // Check for ROMFS/EXEFS
                string[] folders = Directory.GetDirectories(path);
                int count = folders.Length;
                if (count != 2 && count != 1) return; // Only want exefs & romfs (can have exheader there too, it's not a folder)
                {
                    // First file should be 'exe'
                    if (new FileInfo(folders[0]).Name.ToLower().Contains("exe") && Directory.Exists(folders[0]))
                        checkIfExeFS(folders[0]);
                    if (new FileInfo(folders[count - 1]).Name.ToLower().Contains("rom") && Directory.Exists(folders[count - 1]))
                        checkIfRomFS(folders[count - 1]);

                    GB_RomFS.Enabled = (RomFS != null);
                    GB_ExeFS.Enabled = (RomFS != null && ExeFS != null);
                    B_MoveTutor.Enabled = oras; // Default false unless loaded
                    if (RomFS != null)
                    { L_Game.Text = (oras) ? "Game Loaded: ORAS" : "Game Loaded: XY"; TB_Path.Text = path; }
                    else if (ExeFS != null)
                    { L_Game.Text = "ExeFS loaded - no RomFS"; TB_Path.Text = path; }
                    else
                    { L_Game.Text = "No Game Loaded"; TB_Path.Text = ""; }

                    if (RomFS != null)
                    {
                        // Trigger Data Loading
                        updateStatus("Data found! Loading persistent data for subforms...", false);
                        changeLanguage(null, null);
                    }

                    // Method finished.
                    System.Media.SystemSounds.Asterisk.Play();
                }
            }
        }
Exemple #25
0
 private void B_MoveTutor_Click(object sender, EventArgs e)
 {
     if (threads > 0)
     {
         Util.Alert("Please wait for all operations to finish first."); return;
     }
     if (!oras)
     {
         Util.Alert("No Tutors for X/Y."); return;
     }                                                        // Already disabled button...
     if (ExeFS != null)
     {
         new Tutors().Show();
     }
 }
Exemple #26
0
        private void B_Maison_Click(object sender, EventArgs e)
        {
            if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
            DialogResult dr = Util.Prompt(MessageBoxButtons.YesNoCancel, "Edit Super Maison instead of Normal Maison?", "Yes = Super, No = Normal, Cancel = Abort");
            if (dr == DialogResult.Cancel) return;

            new Thread(() =>
            {
                bool super = (dr == DialogResult.Yes);
                string[] files = { (super) ? "maisontrS" : "maisontrN", (super) ? "maisonpkS" : "maisonpkN" };
                fileGet(files);
                Invoke((Action)(() => { new Maison(super).ShowDialog(); }));
                fileSet(files);
            }).Start();
        }
Exemple #27
0
        private void B_RandAll_Click(object sender, EventArgs e)
        {
            /*
             * 3111 Egg Moves Learned by 290 Species (10.73 avg)
             * 18 is the most
             * 1000 moves learned were STAB (32.1%)
             */
            Random rnd = new Random();

            int[] banned = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(); // Struggle, Hyperspace Fury, Dark Void

            // Move Stats
            Move[] moveTypes = Main.Config.Moves;

            // Set up Randomized Moves
            int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
            Util.Shuffle(randomMoves);
            int ctr = 0;

            for (int i = 0; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species
                int count   = dgv.Rows.Count - 1;
                int species = Util.getIndex(CB_Species);
                if (CHK_Expand.Checked && (int)NUD_Moves.Value > count)
                {
                    dgv.Rows.AddCopies(count, (int)NUD_Moves.Value - count);
                }

                for (int j = 1; j < dgv.Rows.Count - 1; j++)
                {
                    // Assign New Moves
                    bool forceSTAB = CHK_STAB.Checked && rnd.Next(0, 99) < NUD_STAB.Value;
                    int  move      = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);

                    while (banned.Contains(move) || /* Invalid */
                           (forceSTAB && !Main.SpeciesStat[species].Types.Contains(moveTypes[move].Type))) // STAB is required
                    {
                        move = Randomizer.getRandomSpecies(ref randomMoves, ref ctr);
                    }

                    // Assign Move
                    dgv.Rows[j].Cells[0].Value = movelist[move];
                }
            }
            CB_Species.SelectedIndex = 0;
            Util.Alert("All Pokemon's Egg Up Moves have been randomized!");
        }
Exemple #28
0
        private void calcStats()
        {
            Move[] MoveData = Moves.getMoves();

            byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());

            int movectr = 0;
            int max     = 0;
            int spec    = 0;
            int stab    = 0;
            int species = 0;

            for (int i = 0; i < 722; i++)
            {
                byte[] movedata = File.ReadAllBytes(files[i]);
                if (movedata.Length <= 2)
                {
                    continue;
                }
                int movecount = BitConverter.ToUInt16(movedata, 0);
                if (movecount == 65535 || movecount < 0)
                {
                    continue;
                }
                species++;
                movectr += movecount; // Average Moves
                if (max < movecount)
                {
                    max = movecount; spec = i;
                }                                                   // Max Moves (and species)
                for (int m = 1; m < movedata.Length / 2; m++)
                {
                    int move = BitConverter.ToUInt16(movedata, m * 2);
                    if (move == 65535)
                    {
                        movectr--;
                        continue;
                    }
                    if (MoveData[move].Type == personalData[6 + (Main.oras ? 0x50 : 0x40) * i] ||
                        MoveData[move].Type == personalData[7 + (Main.oras ? 0x50 : 0x40) * i])
                    {
                        stab++;
                    }
                }
            }
            Util.Alert(
                $"Moves Learned: {movectr}\r\nMost Learned: {max} @ {spec}\r\nSTAB Count: {stab}\r\nSpecies with EggMoves: {species}");
        }
Exemple #29
0
 public void restoreGARCs(bool oras_define, params string[] g)
 {
     oras = oras_define;
     foreach (string s in g)
     {
         string dest = RomFS + getGARCFileName(s);
         string src  = "backup" + Path.DirectorySeparatorChar + s + String.Format(" ({0})", getGARCFileName(s).Replace(Path.DirectorySeparatorChar.ToString(), ""));
         File.Copy(src, dest, true);
         if (s == "personal" || s == "gametext")
         {
             Util.Alert("In order to restore " + s + ", restart the program. While exiting, hold the Control Key to prevent writebacks.");
         }
         // Reload the persistent data.
     }
     Util.Alert(g.Length + " files restored.");
 }
Exemple #30
0
        private void B_Difficulty_Click(object sender, EventArgs e)
        {
            for (int i = 1; i < CB_Species.Items.Count; i++)
            {
                CB_Species.SelectedIndex = i; // Get new Species
                TB_BaseExp.Text          = (Convert.ToUInt16(TB_BaseExp.Text) / 2).ToString("000");
                for (int z = 0; z < 6; z++)
                {
                    ev_boxes[z].Text = 0.ToString();
                }

                CB_EXPGroup.SelectedIndex = 5;
            }
            saveEntry();
            Util.Alert("EXP Yield reduced by 50%, Level Growth Type set to Slow, and EV yields set to 0. Good luck!");
        }