Example #1
0
        private void setEntry()
        {
            if (species < 0)
            {
                return;
            }

            specbools[0, species - 1] = CHK_P1.Checked;
            specbools[1, species - 1] = CHK_P2.Checked;
            specbools[2, species - 1] = CHK_P3.Checked;
            specbools[3, species - 1] = CHK_P4.Checked;
            specbools[4, species - 1] = CHK_P5.Checked;
            specbools[5, species - 1] = CHK_P6.Checked;
            specbools[6, species - 1] = CHK_P7.Checked;
            specbools[7, species - 1] = CHK_P8.Checked;
            specbools[8, species - 1] = CHK_P9.Checked;
            if (CHK_F1.Enabled) // species < 650 // (1-649)
            {
                foreignbools[species - 1] = CHK_F1.Checked;
            }

            langbools[0, species - 1] = CHK_L1.Checked;
            langbools[1, species - 1] = CHK_L2.Checked;
            langbools[2, species - 1] = CHK_L3.Checked;
            langbools[3, species - 1] = CHK_L4.Checked;
            langbools[4, species - 1] = CHK_L5.Checked;
            langbools[5, species - 1] = CHK_L6.Checked;
            langbools[6, species - 1] = CHK_L7.Checked;

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

            if (f < 0)
            {
                return;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
            {
                formbools[f + i + 0 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
            {
                formbools[f + i + 1 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i + CLB_FormsSeen.Items.Count / 2);
            }

            editing = true;
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
            {
                formbools[f + i + 2 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
            {
                formbools[f + i + 3 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i + CLB_FormDisplayed.Items.Count / 2);
            }
            editing = false;
        }
Example #2
0
    private void SetEntry()
    {
        if (species < 0)
        {
            return;
        }

        var Dex = SAV.Zukan;

        Dex.SetCaught(species, CP[0].Checked);
        for (int i = 0; i < 4; i++)
        {
            Dex.SetSeen(species, i, CP[i + 1].Checked);
        }

        for (int i = 0; i < 4; i++)
        {
            Dex.SetDisplayed(species - 1, i, CP[i + 5].Checked);
        }

        if (species <= 493)
        {
            for (int i = 0; i < 7; i++)
            {
                Dex.SetLanguageFlag(species - 1, i, CL[i].Checked);
            }
        }

        int fc = SAV.Personal[species].FormCount;
        int f  = SAV is SAV5B2W2?DexFormUtil.GetDexFormIndexB2W2(species, fc) : DexFormUtil.GetDexFormIndexBW(species, fc);

        if (f < 0)
        {
            return;
        }

        for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
        {
            Dex.SetFormFlag(f + i, 0, CLB_FormsSeen.GetItemChecked(i));
        }
        for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
        {
            Dex.SetFormFlag(f + i, 1, CLB_FormsSeen.GetItemChecked(i + (CLB_FormsSeen.Items.Count / 2)));
        }

        editing = true;
        for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
        {
            Dex.SetFormFlag(f + i, 2, CLB_FormDisplayed.GetItemChecked(i));
        }
        for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
        {
            Dex.SetFormFlag(f + i, 3, CLB_FormDisplayed.GetItemChecked(i + (CLB_FormDisplayed.Items.Count / 2)));
        }
        editing = false;
    }
Example #3
0
        private void SetEntry()
        {
            if (species < 0)
            {
                return;
            }

            specbools[0, species - 1] = CHK_P1.Checked;
            specbools[1, species - 1] = CHK_P2.Checked;
            specbools[2, species - 1] = CHK_P3.Checked;
            specbools[3, species - 1] = CHK_P4.Checked;
            specbools[4, species - 1] = CHK_P5.Checked;
            specbools[5, species - 1] = CHK_P6.Checked;
            specbools[6, species - 1] = CHK_P7.Checked;
            specbools[7, species - 1] = CHK_P8.Checked;
            specbools[8, species - 1] = CHK_P9.Checked;

            langbools[0, species - 1] = CHK_L1.Checked;
            langbools[1, species - 1] = CHK_L2.Checked;
            langbools[2, species - 1] = CHK_L3.Checked;
            langbools[3, species - 1] = CHK_L4.Checked;
            langbools[4, species - 1] = CHK_L5.Checked;
            langbools[5, species - 1] = CHK_L6.Checked;
            langbools[6, species - 1] = CHK_L7.Checked;

            BitConverter.GetBytes((ushort)Math.Min(0xFFFF, Util.ToUInt32(MT_Count.Text))).CopyTo(SAV.Data, SAV.EncounterCount + (species - 1) * 2);

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

            if (f < 0)
            {
                return;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
            {
                formbools[f + i + 0 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
            {
                formbools[f + i + 1 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i + CLB_FormsSeen.Items.Count / 2);
            }

            editing = true;
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
            {
                formbools[f + i + 2 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
            {
                formbools[f + i + 3 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i + CLB_FormDisplayed.Items.Count / 2);
            }
            editing = false;
        }
Example #4
0
        private void SetEntry()
        {
            if (species < 0)
            {
                return;
            }

            Zukan.SetCaught(species, CP[0].Checked);
            for (int i = 0; i < 4; i++)
            {
                Zukan.SetSeen(species, i, CP[i + 1].Checked);
            }
            for (int i = 0; i < 4; i++)
            {
                Zukan.SetDisplayed(species - 1, i, CP[i + 5].Checked);
            }

            for (int i = 0; i < CL.Length; i++)
            {
                Zukan.SetLanguageFlag(species - 1, i, CL[i].Checked);
            }

            if (CHK_F1.Enabled) // species < 650 // (1-649)
            {
                Zukan.SetForeignFlag(species - 1, CHK_F1.Checked);
            }

            int fc = SAV.Personal[species].FormeCount;
            int f  = DexFormUtil.GetDexFormIndexORAS(species, fc);

            if (f < 0)
            {
                return;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
            {
                Zukan.SetFormFlag(f, 0, CLB_FormsSeen.GetItemChecked(i));
            }
            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
            {
                Zukan.SetFormFlag(f, 1, CLB_FormsSeen.GetItemChecked(i + (CLB_FormsSeen.Items.Count / 2)));
            }

            editing = true;
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
            {
                Zukan.SetFormFlag(f, 2, CLB_FormDisplayed.GetItemChecked(i));
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
            {
                Zukan.SetFormFlag(f, 3, CLB_FormDisplayed.GetItemChecked(i + (CLB_FormDisplayed.Items.Count / 2)));
            }
            editing = false;
        }
Example #5
0
        private void SetEntry()
        {
            if (species < 0)
            {
                return;
            }

            Zukan.SetCaught(species, CP[0].Checked);
            for (int i = 0; i < 4; i++)
            {
                Zukan.SetSeen(species, i, CP[i + 1].Checked);
            }
            for (int i = 0; i < 4; i++)
            {
                Zukan.SetDisplayed(species - 1, i, CP[i + 5].Checked);
            }

            for (int i = 0; i < CL.Length; i++)
            {
                Zukan.SetLanguageFlag(species - 1, i, CL[i].Checked);
            }

            ushort count = (ushort)Math.Min(0xFFFF, Util.ToUInt32(MT_Count.Text));

            Zukan.SetEncounterCount(species - 1, count);

            int fc = SAV.Personal[species].FormeCount;
            int f  = DexFormUtil.GetDexFormIndexORAS(species, fc);

            if (f < 0)
            {
                return;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
            {
                Zukan.SetFormFlag(f, 0, CLB_FormsSeen.GetItemChecked(i));
            }
            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
            {
                Zukan.SetFormFlag(f, 1, CLB_FormsSeen.GetItemChecked(i + (CLB_FormsSeen.Items.Count / 2)));
            }

            editing = true;
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
            {
                Zukan.SetFormFlag(f, 2, CLB_FormDisplayed.GetItemChecked(i));
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
            {
                Zukan.SetFormFlag(f, 3, CLB_FormDisplayed.GetItemChecked(i + (CLB_FormDisplayed.Items.Count / 2)));
            }
            editing = false;
        }
Example #6
0
        private void B_GiveAll_Click(object sender, EventArgs e)
        {
            if (CHK_L1.Enabled)
            {
                CHK_L1.Checked                         =
                    CHK_L2.Checked                     =
                        CHK_L3.Checked                 =
                            CHK_L4.Checked             =
                                CHK_L5.Checked         =
                                    CHK_L6.Checked     =
                                        CHK_L7.Checked = ModifierKeys != Keys.Control;
            }
            if (CHK_P1.Enabled)
            {
                CHK_P1.Checked = ModifierKeys != Keys.Control;
            }
            int index = LB_Species.SelectedIndex + 1;
            int gt    = SAV.Personal[index].Gender;

            bool canBeMale   = gt != PersonalInfo.RatioMagicFemale;
            bool canBeFemale = gt is not(PersonalInfo.RatioMagicMale or PersonalInfo.RatioMagicGenderless);

            CHK_P2.Checked = CHK_P4.Checked = canBeMale && ModifierKeys != Keys.Control;
            CHK_P3.Checked = CHK_P5.Checked = canBeFemale && ModifierKeys != Keys.Control;

            if (ModifierKeys == Keys.Control)
            {
                foreach (var chk in new[] { CHK_P6, CHK_P7, CHK_P8, CHK_P9 })
                {
                    chk.Checked = false;
                }
            }
            else if (!(CHK_P6.Checked || CHK_P7.Checked || CHK_P8.Checked || CHK_P9.Checked))
            {
                (gt != PersonalInfo.RatioMagicFemale ? CHK_P6 : CHK_P7).Checked = true;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count; i++)
            {
                CLB_FormsSeen.SetItemChecked(i, ModifierKeys != Keys.Control);
            }
            if (CLB_FormsSeen.Items.Count > 0 && CLB_FormDisplayed.CheckedItems.Count == 0)
            {
                CLB_FormDisplayed.SetItemChecked(0, ModifierKeys != Keys.Control);
            }

            if (Util.ToInt32(MT_Count.Text) == 0)
            {
                MT_Count.Text = "1";
            }
        }
Example #7
0
        private void SetEntry()
        {
            if (species < 0)
            {
                return;
            }

            for (int i = 0; i < 9; i++)
            {
                specbools[i, species - 1] = CP[i].Checked;
            }

            if (species <= 493)
            {
                for (int i = 0; i < 7; i++)
                {
                    langbools[i, species - 1] = CL[i].Checked;
                }
            }

            int fc = SAV.Personal[species].FormeCount;
            int f  = SAV.B2W2 ? SaveUtil.GetDexFormIndexB2W2(species, fc) : SaveUtil.GetDexFormIndexBW(species, fc);

            if (f < 0)
            {
                return;
            }

            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++) // Seen
            {
                formbools[f + i + 0 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormsSeen.Items.Count / 2; i++)  // Seen Shiny
            {
                formbools[f + i + 1 * FormLen * 8] = CLB_FormsSeen.GetItemChecked(i + CLB_FormsSeen.Items.Count / 2);
            }

            editing = true;
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++) // Displayed
            {
                formbools[f + i + 2 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i);
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count / 2; i++)  // Displayed Shiny
            {
                formbools[f + i + 3 * FormLen * 8] = CLB_FormDisplayed.GetItemChecked(i + CLB_FormDisplayed.Items.Count / 2);
            }
            editing = false;
        }
Example #8
0
        private void ModifyAllForms(object sender, EventArgs e)
        {
            for (int i = 0; i < CB_Species.Items.Count; i++)
            {
                LB_Species.SelectedIndex = i;
                if (CLB_FormsSeen.Items.Count == 0)
                {
                    continue;
                }

                if (sender == mnuForm1)
                {
                    if (CLB_FormsSeen.CheckedItems.Count == 0)
                    {
                        CLB_FormsSeen.SetItemChecked(0, true);
                    }

                    if (CLB_FormDisplayed.CheckedItems.Count == 0)
                    {
                        CLB_FormDisplayed.SetItemChecked(0, true);
                    }
                }
                else if (sender == mnuFormAll)
                {
                    for (int f = 0; f < CLB_FormsSeen.Items.Count; f++)
                    {
                        CLB_FormsSeen.SetItemChecked(f, true);
                    }
                    if (CLB_FormDisplayed.CheckedItems.Count == 0)
                    {
                        CLB_FormDisplayed.SetItemChecked(0, true);
                    }
                }
                else // none
                {
                    for (int f = 0; f < CLB_FormsSeen.Items.Count; f++)
                    {
                        CLB_FormsSeen.SetItemChecked(f, false);
                    }
                    for (int f = 0; f < CLB_FormDisplayed.Items.Count; f++)
                    {
                        CLB_FormDisplayed.SetItemChecked(f, false);
                    }
                }
            }
        }
Example #9
0
        private void modifyAllForms(object sender, EventArgs e)
        {
            if (sender == mnuFormNone)
            {
                formbools = new BitArray(new bool[formbools.Length]); // reset false
                getEntry();
                return;
            }

            for (int i = 0; i < CB_Species.Items.Count; i++)
            {
                LB_Species.SelectedIndex = i;
                if (CLB_FormsSeen.Items.Count == 0)
                {
                    continue;
                }

                if (sender == mnuForm1)
                {
                    if (CLB_FormsSeen.CheckedItems.Count == 0)
                    {
                        CLB_FormsSeen.SetItemChecked(0, true);
                    }

                    if (CLB_FormDisplayed.CheckedItems.Count == 0)
                    {
                        CLB_FormDisplayed.SetItemChecked(0, true);
                    }
                }
                else if (sender == mnuFormAll)
                {
                    for (int f = 0; f < CLB_FormsSeen.Items.Count; f++)
                    {
                        CLB_FormsSeen.SetItemChecked(f, true);
                    }
                    if (CLB_FormDisplayed.CheckedItems.Count == 0)
                    {
                        CLB_FormDisplayed.SetItemChecked(0, true);
                    }
                }
            }
        }
Example #10
0
        private void updateDisplayedForm(object sender, ItemCheckEventArgs e)
        {
            if (editing)
            {
                return;
            }

            // Only allow one form to be displayed if the user sets a new display value
            if (e.NewValue != CheckState.Checked)
            {
                return;
            }
            for (int i = 0; i < CLB_FormDisplayed.Items.Count; i++)
            {
                if (i != e.Index)
                {
                    CLB_FormDisplayed.SetItemChecked(i, false);
                }
                else if (sender == CLB_FormDisplayed)
                {
                    CLB_FormsSeen.SetItemChecked(e.Index, true); // ensure this form is seen
                }
            }
        }