Exemplo n.º 1
0
        private void InitializeFields()
        {
            pk1         = JP_Mode ? new JPK1() : new PK1();
            pk1.Species = (byte)PK1.SpeciesType.Rhydon;
            pk1.Move_1  = (byte)PK1.MoveType.Pound;

            PopulateFields(pk1);
            {
                if (JP_Mode)
                {
                    TB_OT.Text       = "サイドン";
                    TB_Nickname.Text = "サイドン";
                }
                else
                {
                    TB_OT.Text       = "Rhydon";
                    TB_Nickname.Text = "RHYDON";
                }
                TB_TID.Text           = 12345.ToString();
                pk1.OT_Name           = RBY_Encoding.GetBytes(TB_OT.Text, JP_Mode);
                pk1.Nickname          = RBY_Encoding.GetBytes(TB_Nickname.Text, JP_Mode);
                pk1.TID               = 12345;
                CB_PPu1.SelectedIndex = CB_PPu2.SelectedIndex = CB_PPu3.SelectedIndex = CB_PPu4.SelectedIndex = 0;
            }
            SetStatusEditing();
        }
Exemplo n.º 2
0
        private void set(int index, PK1 to_set)
        {
            if (index >= pokemonlist.Count)
            {
                index = pokemonlist.Count++;
            }
            else
            {
                string currentpk = RBY_Encoding.GetString(pokemonlist[index].Nickname, pokemonlist[index] is JPK1) + " (" + pokemonlist[index].EXP.ToString() + " EXP)";
                string newpk     = RBY_Encoding.GetString(to_set.Nickname, to_set is JPK1) + " (" + to_set.EXP.ToString() + " EXP)";
                if (Util.Prompt(
                        MessageBoxButtons.YesNo, "Replace?" + Environment.NewLine + Environment.NewLine +
                        "Actual: " + currentpk + Environment.NewLine +
                        "New: " + newpk) != DialogResult.Yes)
                {
                    return;
                }
            }
            pokemonlist[index] = to_set;
            update(index);

            MainForm mf = FindForm() as MainForm;

            mf.SetStatusSet(index);
        }
Exemplo n.º 3
0
        public PK1 Clone()
        {
            PK1 new_pk1 = (this is JPK1) ? new JPK1() : new PK1();

            Array.Copy(Data, 0, new_pk1.Data, 0, Data.Length);
            Array.Copy(otname, 0, new_pk1.otname, 0, otname.Length);
            Array.Copy(nick, 0, new_pk1.nick, 0, nick.Length);
            return(new_pk1);
        }
Exemplo n.º 4
0
        public void PopulateFields(PK1 pk, bool focus = true)
        {
            pk1 = pk ?? new PK1();

            if (focus)
            {
                Tab_Main.Focus();
            }

            pk1.Current_Level = (byte)Tables.getLevel(pk1.Species, pk1.EXP);
            if (pk1.Level == 100)
            {
                pk1.EXP = Tables.getEXP(pk1.Current_Level, pk1.Species);
            }
            pk1.Level = pk1.Current_Level;

            changingFields           = true;
            CB_Species.SelectedValue = (int)pk1.Species;

            TB_TID.Text      = pk1.TID.ToString("00000");
            TB_OT.Text       = RBY_Encoding.GetString(pk1.OT_Name, JP_Mode);
            TB_Nickname.Text = RBY_Encoding.GetString(pk1.Nickname, JP_Mode);

            TB_HPDV.Text  = pk1.DV_HP.ToString();
            TB_ATKDV.Text = pk1.DV_ATK.ToString();
            TB_DEFDV.Text = pk1.DV_DEF.ToString();
            TB_SPDDV.Text = pk1.DV_SPD.ToString();
            TB_SPCDV.Text = pk1.DV_SPC.ToString();

            TB_HPSTATEXP.Text  = pk1.STATEXP_HP.ToString();
            TB_ATKSTATEXP.Text = pk1.STATEXP_ATK.ToString();
            TB_DEFSTATEXP.Text = pk1.STATEXP_DEF.ToString();
            TB_SPCSTATEXP.Text = pk1.STATEXP_SPC.ToString();
            TB_SPDSTATEXP.Text = pk1.STATEXP_SPD.ToString();

            TB_EXP.Text   = pk1.EXP.ToString();
            TB_Level.Text = pk1.Current_Level.ToString();

            CB_Move1.SelectedValue = (int)pk1.Move_1;
            CB_Move2.SelectedValue = (int)pk1.Move_2;
            CB_Move3.SelectedValue = (int)pk1.Move_3;
            CB_Move4.SelectedValue = (int)pk1.Move_4;

            CB_PPu1.SelectedIndex = pk1.PPUP_1;
            CB_PPu2.SelectedIndex = pk1.PPUP_2;
            CB_PPu3.SelectedIndex = pk1.PPUP_3;
            CB_PPu4.SelectedIndex = pk1.PPUP_4;
            TB_PP1.Text           = pk1.PP_1.ToString();
            TB_PP2.Text           = pk1.PP_2.ToString();
            TB_PP3.Text           = pk1.PP_3.ToString();
            TB_PP4.Text           = pk1.PP_4.ToString();
            changingFields        = false;
            updateStats();

            SetStatusViewing();
        }
Exemplo n.º 5
0
 private void set(int index, PK1 to_set)
 {
     if (index < pokemonlist.Count)
     {
         pokemonlist[index] = to_set;
         update(index);
     }
     else
     {
         pokemonlist.Count++;
         pokemonlist[pokemonlist.Count - 1] = to_set;
         update(pokemonlist.Count - 1);
     }
 }
Exemplo n.º 6
0
        private void HandleSet(object sender, EventArgs e)
        {
            int              index  = getSlot(sender);
            MainForm         mf     = FindForm() as MainForm;
            PK1              to_set = mf.pk1;
            PokemonListPanel PLC    = (((sender as ToolStripItem)?.GetCurrentParent() as ContextMenuStrip)?.SourceControl).Parent as PokemonListPanel;

            if (PLC == this)
            {
                PLC.set(index, to_set);
                if (mf.modify_dex)
                {
                    mf.sav.Pokedex_Seen[Tables.ID_To_Dex[to_set.Species]]       =
                        mf.sav.Pokedex_Caught[Tables.ID_To_Dex[to_set.Species]] = true;
                }
            }
        }
Exemplo n.º 7
0
 public static Bitmap GetPartySprite(PK1 pk)
 {
     return(UseFancySprites
         ? (Resources.ResourceManager.GetObject($"_{Tables.ID_To_Dex[pk.Species]}_0") as Image ?? new Bitmap(16, 16)).Clone() as Bitmap
         : GetPartySprite(Tables.ID_To_Sprite[pk.Species]));
 }
Exemplo n.º 8
0
        private void HandleDragDrop(object sender, DragEventArgs e)
        {
            Control c = sender as Control;

            if (!(c.FindForm() is MainForm))
            {
                return;
            }
            MainForm mf = c.FindForm() as MainForm;

            if (mf.getInChildForm())
            {
                return;
            }
            if (!(c.Parent is PokemonListPanel))
            {
                return;
            }
            PokemonListPanel parent = c.Parent as PokemonListPanel;
            int slot = getSlot(sender);

            // Check for In-Dropped files
            object[] files = (object[])e.Data.GetData(DataFormats.FileDrop);
            if (e.Effect == DragDropEffects.Copy)
            {
                if (files.Length <= 0)
                {
                    return;
                }
                FileInfo fi = new FileInfo((string)files[0]);
                if ((int)fi.Length == PokemonList.GetDataLength(PokemonList.CapacityType.Single) && !mf.JP_Mode)
                {
                    byte[] data = File.ReadAllBytes((string)files[0]);
                    if (data[0] == 1 && data[2] == 0xFF && data[1] == data[3]) // PK1
                    {
                        parent.set(slot, new PokemonList(data)[0]);
                    }
                    else
                    {
                        mf.openFile((string)files[0]);
                    }
                }
                else if ((int)fi.Length == PokemonList.GetDataLength(PokemonList.CapacityType.Single, true) && mf.JP_Mode)
                {
                    byte[] data = File.ReadAllBytes((string)files[0]);
                    if (data[0] == 1 && data[2] == 0xFF && data[1] == data[3]) // JPK1
                    {
                        parent.set(slot, new PokemonList(data, PokemonList.CapacityType.Single, true)[0]);
                    }
                    else
                    {
                        mf.openFile((string)files[0]);
                    }
                }
                else
                {
                    mf.openFile((string)files[0]);
                }
            }
            else if (e.Effect == DragDropEffects.Move)
            {
                if (files.Length != 1)
                {
                    return;
                }
                if (sender_parent == null)
                {
                    FileInfo fi = new FileInfo((string)files[0]);
                    if ((int)fi.Length == PokemonList.GetDataLength(PokemonList.CapacityType.Single) && !mf.JP_Mode)
                    {
                        byte[] data = File.ReadAllBytes((string)files[0]);
                        if (data[0] == 1 && data[2] == 0xFF && data[1] == data[3]) // PK1
                        {
                            parent.set(slot, new PokemonList(data)[0]);
                        }
                        else
                        {
                            mf.openFile((string)files[0]);
                        }
                    }
                    else if ((int)fi.Length == PokemonList.GetDataLength(PokemonList.CapacityType.Single, true) && mf.JP_Mode)
                    {
                        byte[] data = File.ReadAllBytes((string)files[0]);
                        if (data[0] == 1 && data[2] == 0xFF && data[1] == data[3]) // JPK1
                        {
                            parent.set(slot, new PokemonList(data, PokemonList.CapacityType.Single, true)[0]);
                        }
                        else
                        {
                            mf.openFile((string)files[0]);
                        }
                    }
                    else
                    {
                        mf.openFile((string)files[0]);
                    }
                }
                else
                {
                    PK1 temp  = parent.pokemonlist[slot];
                    int count = parent.pokemonlist.Count;
                    parent.set(slot, sender_parent.pokemonlist[sender_slot]);
                    if (slot < count)
                    {
                        sender_parent.set(sender_slot, temp);
                    }
                }
            }
        }
Exemplo n.º 9
0
 public PokemonList(PK1 pk)
     : this(CapacityType.Single, pk is JPK1)
 {
     this[0] = pk;
     Count   = 1;
 }