Ejemplo n.º 1
0
        private void FormSelect_Load(object sender, EventArgs e)
        {
            renameControls();
            cboFormList.Items.Clear();


            lblChooseFormText.Text = lblChooseFormText.Text.Replace("{1}", data.Species.getName());
            // Checks if form change allowed
            if (allowedFormChanges.ContainsKey(data.Species.NatID))
            {
                // Get form 0:
                Pokemon form0 = PokemonTables.changePokemon(data.Species, data.Species.NatID);

                cboFormList.Items.Add(form0.getFormName());

                foreach (Pokemon p in form0.Forms)
                {
                    if (allowedFormChanges[data.Species.NatID].Contains(p.Form))
                    {
                        cboFormList.Items.Add(p.getFormName());
                    }
                }

                cboFormList.SelectedIndex = data.Species.Form == 0 ? 0 : Array.IndexOf(allowedFormChanges[data.Species.NatID], data.Species.Form) + 1;
            }
            else
            {
                cboFormList.Items.Add(data.Species.getFormName());
                cboFormList.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
        protected void createSpecialEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, byte[] regularData, byte[] affectedSlots, decimal[] percentage)
        {
            Pokemon p;
            short   speciesID;
            byte    minLv, maxLv;

            int nbSlots = data.Length / 4;

            if (percentage.Length < nbSlots)
            {
                throw new Exception("percentage is smaller than Encounter slot data.");
            }

            if (affectedSlots.Length < nbSlots)
            {
                throw new Exception("Number of affected slots is smaller than Encounter slot data.");
            }

            slotArray = new EncounterSlot[nbSlots];
            for (int s = 0; s < nbSlots; s++)
            {
                speciesID = BitConverter.ToInt16(data, 4 * s);
                p         = PokemonTables.getPokemon(speciesID, version);

                maxLv = regularData[8 * affectedSlots[s]];
                minLv = regularData[8 * affectedSlots[s] + 1];
                if (minLv == 0)
                {
                    minLv = maxLv;
                }
                slotArray[s] = new EncounterSlot(p, minLv, maxLv, percentage[affectedSlots[s]]);
            }
        }
Ejemplo n.º 3
0
        protected override void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray)
        {
            Pokemon p;
            short   speciesID;
            byte    minLv, maxLv;

            int nbSlots = data.Length / 8;

            if (percentArray.Length < nbSlots)
            {
                throw new Exception("percentArray is smaller than Encounter slot data.");
            }

            slotArray = new EncounterSlot[nbSlots];
            for (int i = 0; i < nbSlots; i++)
            {
                speciesID = BitConverter.ToInt16(data, 8 * i + 4);
                p         = PokemonTables.getPokemon(speciesID, version);

                maxLv = data[8 * i];
                minLv = data[8 * i + 1];
                if (minLv == 0)
                {
                    minLv = maxLv;
                }
                slotArray[i] = new EncounterSlot(p, minLv, maxLv, percentArray[i]);
            }
        }
Ejemplo n.º 4
0
        private void cboFormList_SelectedIndexChanged(object sender, EventArgs e)
        {
            data.Species = (cboFormList.SelectedIndex == 0) ? PokemonTables.changePokemon(data.Species, data.Species.NatID)
                                                            : PokemonTables.changePokemon(data.Species, data.Species.NatID).Forms[allowedFormChanges[data.Species.NatID][cboFormList.SelectedIndex - 1] - 1];

            // Change minisprite
            pctMinisprite.Image = (Image)Properties.Resources.ResourceManager.GetObject(
                "m" + data.Species.NatID +
                (Properties.Settings.Default.ShinySprites ? "s" : "") +
                (cboFormList.SelectedIndex == 0 ? "" : "_" + cboFormList.SelectedIndex));
        }
Ejemplo n.º 5
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (Properties.Settings.Default.Language == 0)
            {
                detectSystemLanguage();
            }

            // Load data
            PokemonTables.PopulatePokemonTables();
            Utils.loadEncounterSlotData();
            Utils.initializeMoves();

            Application.Run(new frmMainPage());
        }
        protected void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray)
        {
            Pokemon p;
            short   speciesID;

            int nbSlots = data.Length / 4;

            slotArray = new EncounterSlot[nbSlots];

            for (int i = 0; i < nbSlots; i++)
            {
                speciesID = BitConverter.ToInt16(data, 4 * i);
                p         = PokemonTables.getPokemon(speciesID, version);

                slotArray[i] = new EncounterSlot(p, data[4 * i + 2], data[4 * i + 2], percentArray[i]);
            }
        }
Ejemplo n.º 7
0
        protected override void createEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, decimal[] percentArray)
        {
            Pokemon p;
            short   speciesID;

            int nbSlots = data.Length / 4;

            if (percentArray.Length > nbSlots)
            {
                throw new Exception("percentArray is smaller than Encounter slot data.");
            }

            slotArray = new EncounterSlot[nbSlots];
            for (int i = 0; i < nbSlots; i++)
            {
                speciesID    = BitConverter.ToInt16(data, 4 * i);
                p            = PokemonTables.getPokemon(speciesID, version);
                slotArray[i] = new EncounterSlot(p, data[4 * i + 2], data[4 * i + 3], percentArray[i]);
            }
        }
Ejemplo n.º 8
0
        protected void createSpecialEncounterSlotArray(ref EncounterSlot[] slotArray, byte[] data, byte[] regularData, byte[] affectedSlots, decimal[] percentage)
        {
            Pokemon p;
            short   speciesID;

            int     nbSlots = affectedSlots.Length;
            decimal r       = data.Length / (decimal)(2 * nbSlots);

            if (percentage.Length < nbSlots)
            {
                throw new Exception("percentage is smaller than Encounter slot data.");
            }

            slotArray = new EncounterSlot[nbSlots];
            for (int s = 0; s < nbSlots; s++)
            {
                speciesID    = BitConverter.ToInt16(data, 2 * (int)(s * r));
                p            = PokemonTables.getPokemon(speciesID, version);
                slotArray[s] = new EncounterSlot(p, regularData[4 * affectedSlots[s]], regularData[4 * affectedSlots[s] + 1], percentage[affectedSlots[s]]);
            }
        }
Ejemplo n.º 9
0
        internal AreaMapSuMo(byte[] data, Version version)
        {
            if (data.Length % 384 != 0)
            {
                return;                         //All tables should be 384-byte long
            }
            int nbTables = data.Length / 384;

            Slots     = new EncounterSlot[nbTables][];
            SOS_Slots = new EncounterSlot[nbTables][][];
            for (int i = 0; i < nbTables; i++)
            {
                Slots[i] = new EncounterSlot[10];

                // Regular Slots
                for (int j = 0; j < 10; j++)
                {
                    Slots[i][j] = new EncounterSlot(
                        PokemonTables.getPokemon(BitConverter.ToInt16(data, 384 * i + 4 * j + 16 - 28 * (i % 2)), version),
                        data[384 * i + 4 - 28 * (i % 2)], data[384 * i + 5 - 28 * (i % 2)], data[384 * i + j + 6 - 28 * (i % 2)]);
                }

                // SOS Slots
                SOS_Slots[i] = new EncounterSlot[7][];
                for (int sos = 0; sos < 7; sos++)
                {
                    SOS_Slots[i][sos] = new EncounterSlot[10];
                    for (int j = 0; j < 10; j++)
                    {
                        SOS_Slots[i][sos][j] = new EncounterSlot(
                            PokemonTables.getPokemon(BitConverter.ToInt16(data, 384 * i + 4 * j + sos * 20 + 56 - 28 * (i % 2)), version),
                            data[384 * i + 4 - 28 * (i % 2)], data[384 * i + 5 - 28 * (i % 2)], data[384 * i + j + 6 - 28 * (i % 2)]);
                    }
                }
            }
        }