Exemple #1
0
        private void Parse()
        {
            updating = true;

            #region UpdateOwnedBox()
            if (CB_MonIndex.SelectedValue != null)
            {
                int ind = (int)CB_MonIndex.SelectedValue;

                //team preview
                int pbIndex = 0;
                foreach (PictureBox pb in new[] { PB_Team1, PB_Team2, PB_Team3, PB_Team4 })
                {
                    pb.Image = GetTeamImage(GetMonFrommSlot(pbIndex), pbIndex, (ltir == pbIndex));
                    pbIndex++;
                }

                //caught CHK
                CHK_CaughtMon.Checked = GetMon(ind).Caught;

                //level view
                if (GetMon(ind).Lollipops > db.Mons[ind].MaxLollipops || GetMon(ind).Level > 10 + db.Mons[ind].MaxLollipops)
                {
                    NUP_Lollipop.Maximum   = NUP_Level.Maximum = 63;
                    NUP_Lollipop.ForeColor = NUP_Level.ForeColor = Color.Red;
                }
                else
                {
                    NUP_Lollipop.Maximum   = db.Mons[ind].MaxLollipops;
                    NUP_Level.Maximum      = 10 + NUP_Lollipop.Maximum;
                    NUP_Lollipop.ForeColor = NUP_Level.ForeColor = SystemColors.WindowText;
                }
                NUP_Lollipop.Value = GetMon(ind).Lollipops;
                NUP_Level.Value    = GetMon(ind).Level;

                //Skill level
                for (int i = 0; i < TLP_Skills.ColumnCount; i++)
                {
                    for (int j = 0; j < TLP_Skills.RowCount; j++)
                    {
                        if (TLP_Skills.GetControlFromPosition(i, j) is RadioButton)
                        {
                            (TLP_Skills.GetControlFromPosition(i, j) as RadioButton).Checked = (GetMon(ind).CurrentSkill == j);
                        }
                        else if (TLP_Skills.GetControlFromPosition(i, j) is Label)
                        {
                            (TLP_Skills.GetControlFromPosition(i, j) as Label).Text = (db.Mons[ind].Skills[j] == 0 && j != 0) ? "" : db.SkillsList[db.Mons[ind].Skills[j] - 1];
                            TT_Skill.SetToolTip((TLP_Skills.GetControlFromPosition(i, j) as Label), (db.Mons[ind].Skills[j] > 0) ? db.SkillsTextList[db.Mons[ind].Skills[j] - 1] : "default");
                        }
                        else if (TLP_Skills.GetControlFromPosition(i, j) is NumericUpDown)
                        {
                            (TLP_Skills.GetControlFromPosition(i, j) as NumericUpDown).Maximum = GetMon(ind).SkillLevel[j] > 5 ? 7 : 5;
                            (TLP_Skills.GetControlFromPosition(i, j) as NumericUpDown).Value   = Math.Max(GetMon(ind).SkillLevel[j], 1);
                        }

                        (TLP_Skills.GetControlFromPosition(i, j) as Control).Visible = (GetMon(ind).Caught&& j < db.Mons[ind].SkillCount);  //visibility stuff for convenience
                    }
                }

                #region Visibility

                L_Level.Visible     = L_Skill.Visible = NUP_Level.Visible = PB_Skill.Visible = CHK_CaughtMon.Checked;
                PB_Lollipop.Visible = NUP_Lollipop.Visible = (CHK_CaughtMon.Checked && NUP_Lollipop.Maximum != 0);
                PB_Mon.Image        = GetCaughtImage(ind, CHK_CaughtMon.Checked);
                PB_MegaX.Visible    = CHK_MegaX.Visible = db.HasMega[ind][0];
                PB_MegaY.Visible    = CHK_MegaY.Visible = db.HasMega[ind][1];
                PB_MegaX.Image      = db.HasMega[ind][0] ? new Bitmap((Image)Properties.Resources.ResourceManager.GetObject("MegaStone" + db.Mons[ind].SpecieIndex.ToString("000") + (db.HasMega[ind][1] ? "_X" : string.Empty))) : new Bitmap(16, 16);
                PB_MegaY.Image      = db.HasMega[ind][1] ? new Bitmap((Image)Properties.Resources.ResourceManager.GetObject("MegaStone" + db.Mons[ind].SpecieIndex.ToString("000") + "_Y")) : new Bitmap(16, 16);
                CHK_MegaX.Checked   = (GetMon(ind).Stone & 1) != 0;
                CHK_MegaY.Checked   = (GetMon(ind).Stone & 2) != 0;
                PB_SpeedUpX.Image   = db.HasMega[ind][0] ? new Bitmap(ResizeImage((Image)Properties.Resources.ResourceManager.GetObject("mega_speedup"), 24, 24)) : new Bitmap(16, 16);
                PB_SpeedUpY.Image   = db.HasMega[ind][1] ? new Bitmap(ResizeImage((Image)Properties.Resources.ResourceManager.GetObject("mega_speedup"), 24, 24)) : new Bitmap(16, 16);
                RB_Skill1.Enabled   = (db.Mons[ind].SkillCount > 1);
                #endregion Visibility

                //Speedup values
                if (!(db.HasMega[ind][0] || db.HasMega[ind][1]) || db.MegaList.IndexOf(ind) == -1) //temporary fix while there are still some mega forms missing in megastone.bin
                {
                    NUP_SpeedUpX.Maximum = NUP_SpeedUpY.Maximum = NUP_SpeedUpX.Value = NUP_SpeedUpY.Value = 0;
                    NUP_SpeedUpX.Visible = NUP_SpeedUpY.Visible = (db.MegaList.IndexOf(ind) != -1);
                }
                else
                {
                    bool boolX = GetMon(ind).SpeedUpX > db.Megas[db.MegaList.IndexOf(ind)].Item2;
                    bool boolY = db.HasMega[ind][1] && GetMon(ind).SpeedUpY > db.Megas[db.MegaList.IndexOf(ind, db.MegaList.IndexOf(ind) + 1)].Item2;
                    NUP_SpeedUpX.ForeColor = boolX ? Color.Red : SystemColors.WindowText;
                    NUP_SpeedUpY.ForeColor = boolY ? Color.Red : SystemColors.WindowText;
                    NUP_SpeedUpX.Maximum   = boolX ? 127 : (db.HasMega[ind][0] ? db.Megas[db.MegaList.IndexOf(ind)].Item2 : 0);
                    NUP_SpeedUpY.Maximum   = boolY ? 127 : (db.HasMega[ind][1] ? db.Megas[db.MegaList.IndexOf(ind, db.MegaList.IndexOf(ind) + 1)].Item2 : 0);
                    NUP_SpeedUpX.Value     = db.HasMega[ind][0] ? GetMon(ind).SpeedUpX : 0;
                    NUP_SpeedUpY.Value     = db.HasMega[ind][1] ? GetMon(ind).SpeedUpY : 0;
                    NUP_SpeedUpX.Visible   = CHK_CaughtMon.Checked && CHK_MegaX.Visible && CHK_MegaX.Checked;
                    NUP_SpeedUpY.Visible   = CHK_CaughtMon.Checked && CHK_MegaY.Visible && CHK_MegaY.Checked; //Else NUP_SpeedUpY appears if the next mega in terms of offsets has been obtained
                }
                PB_SpeedUpX.Visible = NUP_SpeedUpX.Visible;
                PB_SpeedUpY.Visible = NUP_SpeedUpY.Visible;
            }
            #endregion

            #region UpdateResourceBox()
            rsItem          rsI   = GetRessources();
            NumericUpDown[] nup   = new NumericUpDown[] { NUP_Coins, NUP_Jewels, NUP_Hearts };
            var             val   = new[] { rsI.Coins, rsI.Jewels, rsI.Hearts };
            int[]           legit = new int[] { 99999, 150, 99 };
            int[]           max   = new int[] { 131071, 255, 127 };
            for (int i = 0; i < nup.Length; i++)
            {
                nup[i].Maximum   = (val[i] > legit[i]) ? max[i] : legit[i];
                nup[i].ForeColor = (val[i] > legit[i]) ? Color.Red : SystemColors.WindowText;
            }
            NUP_Coins.Value  = rsI.Coins;
            NUP_Jewels.Value = rsI.Jewels;
            NUP_Hearts.Value = rsI.Hearts;
            for (int i = 0; i < SI_Items.Items.Length; i++)
            {
                SI_Items.Items[i] = rsI.Items[i].Range();
            }
            for (int i = 0; i < SI_Items.Enchantments.Length; i++)
            {
                SI_Items.Enchantments[i] = rsI.Enhancements[i].Range();
            }
            ItemsGrid.Refresh();
            #endregion

            #region UpdateStageBox()
            int[]           index      = new int[] { (int)NUP_MainIndex.Value - 1, (int)NUP_ExpertIndex.Value - 1, (int)NUP_EventIndex.Value };
            PictureBox[]    stagesPics = new[] { PB_Main, PB_Expert, PB_Event };
            NumericUpDown[] nups       = new[] { NUP_MainScore, NUP_ExpertScore, NUP_EventScore };

            for (int i = 0; i < index.Length; i++)
            {
                nups[i].Value       = GetStage(index[i], i).Score;
                stagesPics[i].Image = GetStageImage(index[i], i);
            }
            #endregion

            updating = false;
        }
Exemple #2
0
        private void UpdateOwnedBox()
        {
            int ind = (int)CB_MonIndex.SelectedValue;

            //team preview
            int k = 1;

            foreach (PictureBox pb in new[] { PB_Team1, PB_Team2, PB_Team3, PB_Team4 })
            {
                pb.Image = GetTeamImage(GetTeam(k), (ltir == k));
                k++;
            }

            //caught CHK
            CHK_CaughtMon.Checked = GetMon(ind).Caught;

            //level view
            NUP_Lollipop.Maximum = db.Mons[ind].Item4;
            NUP_Lollipop.Value   = GetMon(ind).Lollipops;
            NUP_Level.Maximum    = 10 + NUP_Lollipop.Maximum;
            NUP_Level.Value      = GetMon(ind).Level;

            //Skill level
            for (int i = 0; i < TLP_Skills.ColumnCount; i++)
            {
                for (int j = 0; j < TLP_Skills.RowCount; j++)
                {
                    if (TLP_Skills.GetControlFromPosition(i, j) is RadioButton)
                    {
                        (TLP_Skills.GetControlFromPosition(i, j) as RadioButton).Checked = (GetMon(ind).CurrentSkill == j);
                    }
                    else if (TLP_Skills.GetControlFromPosition(i, j) is Label)
                    {
                        (TLP_Skills.GetControlFromPosition(i, j) as Label).Text = (db.Mons[(int)CB_MonIndex.SelectedValue].Item6[j] != 0 || j == 0) ? db.SkillsList[db.Mons[(int)CB_MonIndex.SelectedValue].Item6[j] - 1] : "";
                        TT_Skill.SetToolTip((TLP_Skills.GetControlFromPosition(i, j) as Label), (db.Mons[ind].Item6[j] > 0) ? db.SkillsTextList[db.Mons[ind].Item6[j] - 1] : "default");
                    }
                    else if (TLP_Skills.GetControlFromPosition(i, j) is NumericUpDown)
                    {
                        (TLP_Skills.GetControlFromPosition(i, j) as NumericUpDown).Value = Math.Max(GetMon(ind).SkillLevel[j], 1);
                    }

                    (TLP_Skills.GetControlFromPosition(i, j) as Control).Visible = (GetMon((int)CB_MonIndex.SelectedValue).Caught&& j < db.Mons[ind].Rest.Item2);  //visibility stuff for convenience
                }
            }

            //Speedup values
            if (db.MegaList.IndexOf(ind) != -1) //temporary fix while there are still some mega forms missing in megastone.bin
            {
                NUP_SpeedUpX.Maximum = db.HasMega[ind][0] ? db.Megas[db.MegaList.IndexOf(ind)].Item2 : 0;
                NUP_SpeedUpY.Maximum = db.HasMega[ind][1] ? db.Megas[db.MegaList.IndexOf(ind, db.MegaList.IndexOf(ind) + 1)].Item2 : 0;
                NUP_SpeedUpX.Value   = GetMon(ind).SpeedUpX;
                NUP_SpeedUpY.Value   = GetMon(ind).SpeedUpY;
            }
            else
            {
                NUP_SpeedUpX.Maximum = NUP_SpeedUpY.Maximum = 1;
                NUP_SpeedUpX.Value   = NUP_SpeedUpY.Value = 0;
            }

            #region Visibility

            L_Level.Visible      = L_Skill.Visible = NUP_Level.Visible = PB_Skill.Visible = CHK_CaughtMon.Checked;
            PB_Lollipop.Visible  = NUP_Lollipop.Visible = (CHK_CaughtMon.Checked && NUP_Lollipop.Maximum != 0);
            PB_Mon.Image         = GetCaughtImage(ind, CHK_CaughtMon.Checked);
            PB_MegaX.Visible     = CHK_MegaX.Visible = db.HasMega[ind][0];
            PB_MegaY.Visible     = CHK_MegaY.Visible = db.HasMega[ind][1];
            PB_MegaX.Image       = db.HasMega[ind][0] ? new Bitmap((Image)Properties.Resources.ResourceManager.GetObject("MegaStone" + db.Mons[ind].Item1.ToString("000") + (db.HasMega[ind][1] ? "_X" : string.Empty))) : new Bitmap(16, 16);
            PB_MegaY.Image       = db.HasMega[ind][1] ? new Bitmap((Image)Properties.Resources.ResourceManager.GetObject("MegaStone" + db.Mons[ind].Item1.ToString("000") + "_Y")) : new Bitmap(16, 16);
            CHK_MegaX.Checked    = (GetMon(ind).Stone & 1) != 0;
            CHK_MegaY.Checked    = (GetMon(ind).Stone & 2) != 0;
            NUP_SpeedUpX.Visible = PB_SpeedUpX.Visible = CHK_CaughtMon.Checked && CHK_MegaX.Visible && CHK_MegaX.Checked;
            NUP_SpeedUpY.Visible = PB_SpeedUpY.Visible = CHK_CaughtMon.Checked && CHK_MegaY.Visible && CHK_MegaY.Checked; //Else NUP_SpeedUpY appears if the next mega in terms of offsets has been obtained
            PB_SpeedUpX.Image    = db.HasMega[ind][0] ? new Bitmap(ResizeImage((Image)Properties.Resources.ResourceManager.GetObject("mega_speedup"), 24, 24)) : new Bitmap(16, 16);
            PB_SpeedUpY.Image    = db.HasMega[ind][1] ? new Bitmap(ResizeImage((Image)Properties.Resources.ResourceManager.GetObject("mega_speedup"), 24, 24)) : new Bitmap(16, 16);
            RB_Skill1.Enabled    = (db.Mons[ind].Rest.Item2 > 1);
            #endregion Visibility
        }