Ejemplo n.º 1
0
        private void cmbPokemon_SelectedIndexChanged(object sender, EventArgs e)
        {
            // LoadDataFiles();
            BaseStat bs = basestats[cmbPokemon.SelectedIndex];

            numDex.Value   = bs.ID;
            numForme.Value = bs.FormID;
            numHP.Value    = bs.BaseHP;
            numATK.Value   = bs.BaseAttack;
            numDEF.Value   = bs.BaseDefense;
            numSPATK.Value = bs.BaseSpecialAttack;
            numSPDEF.Value = bs.BaseSpecialDefense;
            numSpeed.Value = bs.BaseSpeed;
            if (bs.Type1 == PokeType.None)
            {
                cmbType1.SelectedIndex = cmbType1.Items.Count - 1;
            }
            else
            {
                cmbType1.SelectedIndex = (int)bs.Type1;
            }
            if (bs.Type2 == PokeType.None)
            {
                cmbType2.SelectedIndex = cmbType2.Items.Count - 1;
            }
            else
            {
                cmbType2.SelectedIndex = (int)bs.Type2;
            }
            cmbAbility1.SelectedIndex = bs.Ability1 - 1;
            cmbAbility2.SelectedIndex = bs.Ability2 - 1;
            numGrowth.Value           = (int)bs.LevelingType;
            MoveList   = basestats[cmbPokemon.SelectedIndex].MoveList;
            MoveLevels = basestats[cmbPokemon.SelectedIndex].MoveLevels;
            lstSelectedMoves.Items.Clear();
            int i = 0;

            foreach (int moveid in MoveList)
            {
                lstSelectedMoves.Items.Add("Level: " + MoveLevels[i] + " Move: " + movenames[moveid]);
                i++;
            }
            txtDexEntry.Text     = bs.DexEntry;
            numGenderRatio.Value = bs.GenderValue;
        }
Ejemplo n.º 2
0
        private void importDexEntriesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileOpen = new OpenFileDialog();

            fileOpen.InitialDirectory = ".\\";
            fileOpen.Filter           = "CSV Files (*.csv)|*.csv|All files (*.*)|*.*";
            fileOpen.FilterIndex      = 0;
            fileOpen.RestoreDirectory = false; //true;
            //                if (fileOpen.ShowDialog () == DialogResult.Cancel)
            if (fileOpen.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string[] Entries = File.ReadAllLines(fileOpen.FileName);
            foreach (string s in Entries)
            {
                string[] ssplit = s.Split(',');
                BaseStat bsold  = GetBaseStats(ssplit[0]);
                if (ssplit.Length > 6)
                {
                    string DexEntry = "";
                    for (int i = 6; i <= (ssplit.Length - 1); i++)
                    {
                        if (i == 6)
                        {
                            DexEntry = ssplit[6];
                        }
                        else
                        {
                            DexEntry = DexEntry + "," + ssplit[i];
                        }
                    }
                    if (DexEntry.Substring(0, 1) == "\"")
                    {
                        DexEntry = DexEntry.Substring(1, (DexEntry.Length - 1));
                    }
                    if (DexEntry.Substring((DexEntry.Length - 1), 1) == "\"")
                    {
                        DexEntry = DexEntry.Substring(0, (DexEntry.Length - 1));
                    }
                    BaseStat bs = new BaseStat()
                    {
                        ID                 = bsold.ID,
                        Name               = bsold.Name,
                        BaseHP             = bsold.BaseHP,
                        BaseAttack         = bsold.BaseAttack,
                        BaseDefense        = bsold.BaseDefense,
                        BaseSpecialAttack  = bsold.BaseSpecialAttack,
                        BaseSpecialDefense = bsold.BaseSpecialDefense,
                        BaseSpeed          = bsold.BaseSpeed,
                        LevelingType       = bsold.LevelingType,
                        FormID             = bsold.FormID,
                        GenderValue        = bsold.GenderValue,
                        Type1              = bsold.Type1,
                        Type2              = bsold.Type2,
                        CatchRate          = bsold.CatchRate,
                        ExpYield           = bsold.ExpYield,
                        EffortYield        = bsold.EffortYield,
                        Item1              = bsold.Item1,
                        Item2              = bsold.Item2,
                        Ability1           = bsold.Ability1,
                        Ability2           = bsold.Ability2,
                        Ability3           = bsold.Ability3,
                        DexEntry           = DexEntry,
                        MoveLevels         = bsold.MoveLevels,
                        MoveList           = bsold.MoveList
                    };
                    SetBaseStats(bs.ID, 0, bs);
                }
            }
        }
Ejemplo n.º 3
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BaseStat bs = new BaseStat()
            {
                ID                 = (int)numDex.Value,
                Name               = GetBaseStats((int)numDex.Value, (byte)numForme.Value).Name,
                BaseHP             = (byte)numHP.Value,
                BaseAttack         = (byte)numATK.Value,
                BaseDefense        = (byte)numDEF.Value,
                BaseSpecialAttack  = (byte)numSPATK.Value,
                BaseSpecialDefense = (byte)numSPDEF.Value,
                BaseSpeed          = (byte)numSpeed.Value,
                LevelingType       = (LevelUpType)numGrowth.Value,
                FormID             = (byte)numForme.Value,
                GenderValue        = (byte)numGenderRatio.Value,
                CatchRate          = GetBaseStats((int)numDex.Value, (byte)numForme.Value).CatchRate,
                ExpYield           = GetBaseStats((int)numDex.Value, (byte)numForme.Value).ExpYield,
                EffortYield        = GetBaseStats((int)numDex.Value, (byte)numForme.Value).EffortYield,
                Item1              = GetBaseStats((int)numDex.Value, (byte)numForme.Value).Item1,
                Item2              = GetBaseStats((int)numDex.Value, (byte)numForme.Value).Item2,
                Ability1           = (byte)(cmbAbility1.SelectedIndex + 1),
                Ability2           = (byte)(cmbAbility2.SelectedIndex + 1),
                Ability3           = GetBaseStats((int)numDex.Value, (byte)numForme.Value).Ability3,
                DexEntry           = txtDexEntry.Text,
                MoveLevels         = MoveLevels,
                MoveList           = MoveList,
                Egg_Groups         = GetBaseStats((int)numDex.Value, (byte)numForme.Value).Egg_Groups
            };

            if (cmbType1.SelectedIndex == 18)
            {
                bs.Type1 = (PokeType)255;
            }
            else
            {
                bs.Type1 = (PokeType)(cmbType1.SelectedIndex);
            }
            if (cmbType2.SelectedIndex == 18)
            {
                bs.Type2 = (PokeType)255;
            }
            else
            {
                bs.Type2 = (PokeType)(cmbType2.SelectedIndex);
            }
            SetBaseStats(bs.ID, bs.FormID, bs);
            //string[] pokedata = File.ReadAllLines("basestats.csv");
            //int index = Find(bs.ID, bs.FormID);
            //pokedata[index] = bs.ToString();
            //File.WriteAllLines("basestats.csv", pokedata);
            //string pokedata = "";
            //foreach (BaseStat b in basestats)
            //{
            //    pokedata += b.ToString() + "\r\n";
            //}
            //File.WriteAllText("basestats.csv", pokedata);
            byte[] data = ObjectToByteArray(basestats);
            File.WriteAllBytes("basestats.dat", data);
            LoadDataFiles();
            MoveLevels = bs.MoveLevels;
            MoveList   = bs.MoveList;
        }
Ejemplo n.º 4
0
        public static void SetBaseStats(int id, byte form, BaseStat bs)
        {
            int index = Find(id, form);

            basestats[index] = bs;
        }
Ejemplo n.º 5
0
        public static BaseStat LoadBasePokemon(BinaryReader reader)
        {
            //ID byte
            //name
            //dexentry
            //hp byte
            //form byte
            //attack
            //defense
            //speed
            //spatk
            //spdef
            //type1
            //type2
            //catchrate
            //expyield
            //effortyield ushort
            //item1 uint
            //item2 uint
            //gendervalue byte
            //levelingtype byte
            //hasalternative bool
            //ability1 ushort
            //ability2 ushort
            //ability3 ushort
            //MoveList int[]
            //MoveLevels int[]
            //egggroups byte[]

            BaseStat stat = new BaseStat();

            stat.ID                 = reader.ReadInt32();
            stat.Name               = reader.ReadString();
            stat.DexEntry           = reader.ReadString();
            stat.BaseHP             = reader.ReadByte();
            stat.FormID             = reader.ReadByte();
            stat.BaseAttack         = reader.ReadByte();
            stat.BaseDefense        = reader.ReadByte();
            stat.BaseSpeed          = reader.ReadByte();
            stat.BaseSpecialAttack  = reader.ReadByte();
            stat.BaseSpecialDefense = reader.ReadByte();
            stat.Type1              = (PokeType)reader.ReadByte();
            stat.Type2              = (PokeType)reader.ReadByte();
            stat.CatchRate          = reader.ReadByte();
            stat.ExpYield           = reader.ReadByte();
            stat.EffortYield        = reader.ReadUInt16();
            stat.Item1              = reader.ReadUInt32();
            stat.Item2              = reader.ReadUInt32();
            stat.GenderValue        = reader.ReadByte();
            stat.LevelingType       = (LevelUpType)reader.ReadByte();
            stat.HasAlternate       = reader.ReadBoolean();
            stat.Ability1           = reader.ReadUInt16();
            stat.Ability2           = reader.ReadUInt16();
            stat.Ability3           = reader.ReadUInt16();
            int num = 0;

            //MoveList
            num           = reader.ReadInt32();
            stat.MoveList = new int[num];
            for (int i = 0; i < num; i++)
            {
                stat.MoveList[i] = reader.ReadInt32();
            }
            //MoveLevels
            num             = reader.ReadInt32();
            stat.MoveLevels = new int[num];
            for (int i = 0; i < num; i++)
            {
                stat.MoveLevels[i] = reader.ReadInt32();
            }
            //Egg Groups
            num             = reader.ReadInt32();
            stat.Egg_Groups = new byte[num];
            for (int i = 0; i < num; i++)
            {
                stat.Egg_Groups[i] = reader.ReadByte();
            }

            return(stat);
        }