コード例 #1
0
ファイル: SAV_PokedexXY.cs プロジェクト: wbsr9876/PKHeX
        private void getEntry()
        {
            // Load Bools for the data
            int pk = species;

            L_Spinda.Visible = TB_Spinda.Visible = pk == 327;

            // Load Partitions
            for (int i = 0; i < 9; i++)
            {
                CP[i].Checked = specbools[i, pk - 1];
            }
            for (int i = 0; i < 7; i++)
            {
                CL[i].Checked = langbools[i, pk - 1];
            }

            if (pk < 650)
            {
                CHK_F1.Enabled = true; CHK_F1.Checked = foreignbools[pk - 1];
            }
            else
            {
                CHK_F1.Enabled = CHK_F1.Checked = false;
            }

            int gt = SAV.Personal[pk].Gender;

            CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = gt != 254;                 // Not Female-Only
            CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = !(gt == 0 || (gt == 255)); // Not Male-Only and Not Genderless

            CLB_FormsSeen.Items.Clear();
            CLB_FormDisplayed.Items.Clear();

            int fc = SAV.Personal[species].FormeCount;
            int f  = SaveUtil.getDexFormIndexXY(species, fc);

            if (f < 0)
            {
                return;
            }
            string[] forms = PKX.getFormList(species, Main.GameStrings.types, Main.GameStrings.forms, Main.gendersymbols);
            if (forms.Length < 1)
            {
                return;
            }

            // 0x26 packs of bools
            for (int i = 0; i < forms.Length; i++) // Seen
            {
                CLB_FormsSeen.Items.Add(forms[i], formbools[f + i + 0 * FormLen * 8]);
            }
            for (int i = 0; i < forms.Length; i++) // Seen Shiny
            {
                CLB_FormsSeen.Items.Add("* " + forms[i], formbools[f + i + 1 * FormLen * 8]);
            }

            for (int i = 0; i < forms.Length; i++) // Displayed
            {
                CLB_FormDisplayed.Items.Add(forms[i], formbools[f + i + 2 * FormLen * 8]);
            }
            for (int i = 0; i < forms.Length; i++) // Displayed Shiny
            {
                CLB_FormDisplayed.Items.Add("* " + forms[i], formbools[f + i + 3 * FormLen * 8]);
            }
        }
コード例 #2
0
ファイル: SAV6.cs プロジェクト: 0ver-flow/PKHeX
        protected override void setDex(PKM pkm)
        {
            if (PokeDex < 0)
            {
                return;
            }
            if (pkm.Species == 0)
            {
                return;
            }
            if (pkm.Species > MaxSpeciesID)
            {
                return;
            }
            if (Version == GameVersion.Unknown)
            {
                return;
            }

            int bit  = pkm.Species - 1;
            int lang = pkm.Language - 1; if (lang > 5)
            {
                lang--;                                        // 0-6 language vals
            }
            int origin   = pkm.Version;
            int gender   = pkm.Gender % 2; // genderless -> male
            int shiny    = pkm.IsShiny ? 1 : 0;
            int shiftoff = shiny * 0x60 * 2 + gender * 0x60 + 0x60;

            // Set the [Species/Gender/Shiny] Owned Flag
            Data[PokeDex + shiftoff + bit / 8 + 0x8] |= (byte)(1 << (bit % 8));

            // Owned quality flag
            if (origin < 0x18 && bit < 649 && !ORAS) // Species: 1-649 for X/Y, and not for ORAS; Set the Foreign Owned Flag
            {
                Data[PokeDex + 0x64C + bit / 8] |= (byte)(1 << (bit % 8));
            }
            else if (origin >= 0x18 || ORAS) // Set Native Owned Flag (should always happen)
            {
                Data[PokeDex + bit / 8 + 0x8] |= (byte)(1 << (bit % 8));
            }

            // Set the Display flag if none are set
            bool Displayed = false;

            Displayed |= (Data[PokeDex + 0x60 * 5 + bit / 8 + 0x8] & (byte)(1 << (bit % 8))) != 0;
            Displayed |= (Data[PokeDex + 0x60 * 6 + bit / 8 + 0x8] & (byte)(1 << (bit % 8))) != 0;
            Displayed |= (Data[PokeDex + 0x60 * 7 + bit / 8 + 0x8] & (byte)(1 << (bit % 8))) != 0;
            Displayed |= (Data[PokeDex + 0x60 * 8 + bit / 8 + 0x8] & (byte)(1 << (bit % 8))) != 0;
            if (!Displayed) // offset is already biased by 0x60, reuse shiftoff but for the display flags.
            {
                Data[PokeDex + shiftoff + 0x60 * 4 + bit / 8 + 0x8] |= (byte)(1 << (bit % 8));
            }

            // Set the Language
            if (lang < 0)
            {
                lang = 1;
            }
            Data[PokeDexLanguageFlags + (bit * 7 + lang) / 8] |= (byte)(1 << ((bit * 7 + lang) % 8));

            // Set Form flags
            int fc = Personal[pkm.Species].FormeCount;
            int f  = ORAS ? SaveUtil.getDexFormIndexORAS(pkm.Species, fc) : SaveUtil.getDexFormIndexXY(pkm.Species, fc);

            if (f >= 0)
            {
                int FormLen = ORAS ? 0x26 : 0x18;
                int FormDex = PokeDex + 0x368;
                bit = f + pkm.AltForm;
                // Set Seen Flag
                Data[FormDex + FormLen * shiny + bit / 8] |= (byte)(1 << (bit % 8));

                // Set Displayed Flag if necessary, check all flags
                bool FormDisplayed = false;
                for (int i = 0; i < fc; i++)
                {
                    bit            = f + i;
                    FormDisplayed |= (Data[FormDex + FormLen * 2 + bit / 8] & (byte)(1 << (bit % 8))) != 0; // Nonshiny
                    FormDisplayed |= (Data[FormDex + FormLen * 3 + bit / 8] & (byte)(1 << (bit % 8))) != 0; // Shiny
                }
                if (!FormDisplayed)
                {
                    bit = f + pkm.AltForm;
                    Data[FormDex + FormLen * (2 + shiny) + bit / 8] |= (byte)(1 << (bit % 8));
                }
            }

            // Set DexNav count (only if not encountered previously)
            if (ORAS && getEncounterCount(pkm.Species - 1) == 0)
            {
                setEncounterCount(pkm.Species - 1, 1);
            }
        }