Example #1
0
        private void Button20002Search_Click(object sender, EventArgs e) => DynamicSearchRngDump(() =>
        {
            bool first = true;
            for (int i = 0; i < _rngDump.Length - 5; i++)
            {
                if (first)
                {
                    if (LevelUpStats.PerfectHpMpCount((uint)numericLevel.Value, ref _rngDump, i) >= 2)
                    {
                        first = false;
                        i    += 3;
                    }
                }
                else
                {
                    if (LevelUpStats.PerfectHpMpCount((uint)numericLevel.Value, ref _rngDump, i) >= 2)
                    {
                        _foundIndex = i - 4;
                        break;
                    }

                    i    -= 3;
                    first = true;
                }
            }
        });
Example #2
0
 private void SearchPerfectLevels(int minLevel) => DynamicSearchRngDump(() =>
 {
     for (int i = 0; i < _rngDump.Length - minLevel; i++)
     {
         if (LevelUpStats.PerfectHpMpCount((uint)numericLevel.Value, ref _rngDump, i) >= minLevel)
         {
             _foundIndex = i;
             break;
         }
     }
 });
Example #3
0
        private void SearchMenuHighestPerfect_Click(object sender, EventArgs e) => DynamicSearchRngDump(() =>
        {
            int highest      = 0;
            int highestIndex = -1;
            for (int i = 0; i < _rngDump.Length; i++)
            {
                int pAmount = LevelUpStats.PerfectHpMpCount((uint)numericLevel.Value, ref _rngDump, i);
                if (pAmount > highest)
                {
                    highest      = pAmount;
                    highestIndex = i;
                }
            }

            _foundIndex = highestIndex;
        });
Example #4
0
        private void SearchMenuHighestPerfect_Click(object sender, EventArgs e)
        {
            this.DynamicSearchRngDump(() =>
            {
                var highest      = 0;
                var highestIndex = -1;
                for (var i = 0; i < this._rngDump.Length; i++)
                {
                    var pAmount = LevelUpStats.PerfectHpMpCount((uint)this.numericLevel.Value, ref this._rngDump, i);
                    if (pAmount > highest)
                    {
                        highest      = pAmount;
                        highestIndex = i;
                    }
                }

                this._foundIndex = highestIndex;
            });
        }
Example #5
0
        private void Generate(bool forceRefresh = false)
        {
            if (_foundIndex == 0)
            {
                stepsToResult.Text = "You are at your search result!";
            }
            else if (_foundIndex > 0)
            {
                stepsToResult.Text = "Advances to search result: " + _foundIndex;
            }
            else
            {
                stepsToResult.Text = string.Empty;
            }

            if (_movement == 0 && !forceRefresh)
            {
                return;
            }

            for (int i = 0; i < _rVals.Length; i++)
            {
                RNG2002.RNGState p = _rng.Peek(i);
                _rVals[i] = new[] { p.value, (uint)p.mti, p.mt };
            }

            uint level = (uint)numericLevel.Value;

            for (int i = 0; i < dataGridView2.RowCount; i++)
            {
                dataGridView2.Rows[i].Cells[0].Value = i;
                dataGridView2.Rows[i].Cells[1].Value = _rVals[0][0] % 100;
                dataGridView2.Rows[i].Cells[2].Value = _rVals[0][0] < 0x1000000;
                dataGridView2.Rows[i].Cells[3].Value =
                    GetStealType(_rVals[0][0], _rVals[1][0], _rVals[2][0]);
                dataGridView2.Rows[i].Cells[4].Value = string.Join(" + ",
                                                                   GetStealTypeCuffs(_rVals[0][0], _rVals[1][0], _rVals[2][0]));

                int    pAmount = LevelUpStats.PerfectHpMpCount(level, ref _rVals);
                string pString;
                if (pAmount <= 0)
                {
                    pString = "False";
                }
                else if (pAmount == 1)
                {
                    pString = "True";
                }
                else
                {
                    pString = "True " + pAmount;
                }

                dataGridView2.Rows[i].Cells[5].Value = pString;
                dataGridView2.Rows[i].Cells[6].Value =
                    numericGil.Value == 0 ? 0 : 1 + _rVals[0][0] % numericGil.Value;
                dataGridView2.Rows[i].Cells[7].Value = _rVals[0][0];
                dataGridView2.Rows[i].Cells[8].Value = _rVals[0][1];
                dataGridView2.Rows[i].Cells[9].Value = _rVals[0][2];
                if (i == _foundIndex)
                {
                    dataGridView2.Rows[i].DefaultCellStyle.BackColor          = _defaultBackColor;
                    dataGridView2.Rows[i].DefaultCellStyle.SelectionBackColor = _defaultBackHighColor;

                    if (_movement <= i)
                    {
                        dataGridView2.Rows[i - _movement].DefaultCellStyle.BackColor          = HighlightBackColor;
                        dataGridView2.Rows[i - _movement].DefaultCellStyle.SelectionBackColor =
                            SelectionHighlightBackColor;
                    }
                }

                Array.Copy(_rVals, 1, _rVals, 0, _rVals.Length - 1);
                RNG2002.RNGState p = _rng.Peek(_rVals.Length + i);
                _rVals[_rVals.Length - 1] = new[] { p.value, (uint)p.mti, p.mt };
            }

            if (_foundIndex > -1)
            {
                _foundIndex -= _movement;
            }
            else
            {
                _foundIndex = -1;
            }
        }
Example #6
0
        private void Generate(bool forceRefresh = false)
        {
            if (this._foundIndex == 0)
            {
                this.stepsToResult.Text = "You are at your search result!";
            }
            else if (this._foundIndex > 0)
            {
                this.stepsToResult.Text = "Advances to search result: " + this._foundIndex;
            }
            else
            {
                this.stepsToResult.Text = string.Empty;
            }

            if (this._movement == 0 && !forceRefresh)
            {
                return;
            }

            for (var i = 0; i < this._rVals.Length; i++)
            {
                var p = this._rng.Peek(i);
                this._rVals[i] = new[] { p.value, (uint)p.mti, p.mt };
            }

            var level = (uint)this.numericLevel.Value;

            for (var i = 0; i < this.dataGridView2.RowCount; i++)
            {
                this.dataGridView2.Rows[i].Cells[0].Value = i;
                this.dataGridView2.Rows[i].Cells[1].Value = this._rVals[0][0] % 100;
                this.dataGridView2.Rows[i].Cells[2].Value = this._rVals[0][0] < 0x1000000;
                this.dataGridView2.Rows[i].Cells[3].Value =
                    GetStealType(this._rVals[0][0], this._rVals[1][0], this._rVals[2][0]);
                this.dataGridView2.Rows[i].Cells[4].Value = string.Join(" + ",
                                                                        GetStealTypeCuffs(this._rVals[0][0], this._rVals[1][0], this._rVals[2][0]));

                var    pAmount = LevelUpStats.PerfectHpMpCount(level, ref this._rVals);
                string pString;
                if (pAmount <= 0)
                {
                    pString = "False";
                }
                else if (pAmount == 1)
                {
                    pString = "True";
                }
                else
                {
                    pString = "True " + pAmount;
                }

                this.dataGridView2.Rows[i].Cells[5].Value = pString;
                this.dataGridView2.Rows[i].Cells[6].Value =
                    this.numericGil.Value == 0 ? 0 : 1 + this._rVals[0][0] % this.numericGil.Value;
                this.dataGridView2.Rows[i].Cells[7].Value = this._rVals[0][0];
                this.dataGridView2.Rows[i].Cells[8].Value = this._rVals[0][1];
                this.dataGridView2.Rows[i].Cells[9].Value = this._rVals[0][2];
                if (i == this._foundIndex)
                {
                    this.dataGridView2.Rows[i].DefaultCellStyle.BackColor          = _defaultBackColor;
                    this.dataGridView2.Rows[i].DefaultCellStyle.SelectionBackColor = _defaultBackHighColor;

                    if (this._movement <= i)
                    {
                        this.dataGridView2.Rows[i - this._movement].DefaultCellStyle.BackColor          = HighlightBackColor;
                        this.dataGridView2.Rows[i - this._movement].DefaultCellStyle.SelectionBackColor =
                            SelectionHighlightBackColor;
                    }
                }

                Array.Copy(this._rVals, 1, this._rVals, 0, this._rVals.Length - 1);
                var p = this._rng.Peek(this._rVals.Length + i);
                this._rVals[this._rVals.Length - 1] = new[] { p.value, (uint)p.mti, p.mt };
            }

            if (this._foundIndex > -1)
            {
                this._foundIndex -= this._movement;
            }
            else
            {
                this._foundIndex = -1;
            }
        }