Exemple #1
0
 private void handleStealCuffs(Steal steal, uint PRNG0, uint PRNG1, uint PRNG2, int column)
 {
     dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[column].Value = steal.checkStealCuffs(PRNG0, PRNG1, PRNG2);
 }
Exemple #2
0
        private void displayRNG(int start, int end)
        {
            IRNG displayRNG;

            if (cbPlatform.SelectedItem as string == "PS2")
            {
                displayRNG = new RNG1998();
            }
            else
            {
                displayRNG = new RNG2002();
            }
            //Clear datagridview
            dataGridView1.Rows.Clear();
            //Consume RNG seeds before our desired index
            //This can take obscene amounts of time.
            DateTime startTime = DateTime.Now;

            for (int i = 0; i < start; i++)
            {
                displayRNG.genrand();
            }
            DateTime endTime = DateTime.Now;

            toolStripStatusLabelPercent.Text = (endTime - startTime).Milliseconds.ToString();

            Steal steal      = new Steal();
            Steal stealCuffs = new Steal();

            int rarePosition      = 0;
            int rarePositionCuffs = 0;

            bool rareSteal      = false;
            bool rareStealCuffs = false;

            // Use these variables to check for first punch combo
            bool comboFound = false;
            int  comboPos   = 0;

            uint aVal1 = displayRNG.genrand();
            uint aVal2 = displayRNG.genrand();
            uint aVal3 = displayRNG.genrand();

            // We want to preserve the character index, since this loop is just for display:
            int indexStatic = group.GetIndex();

            group.ResetIndex();

            //group.ResetIndex();
            for (int index = start; index < end; index++)
            {
                // Index starting at 0
                int loopIndex = index - start;

                // Get the heal value once:
                int currentHeal = group.GetHealValue(aVal1);
                int nextHeal    = group.PeekHealValue(aVal2);

                // Put the next expected heal in the text box
                if (index == start + healVals.Count - 1)
                {
                    tbLastHeal.Text = nextHeal.ToString();
                }

                // Advance the RNG before starting the loop in case we want to skip an entry
                uint aVal1_temp = aVal1;
                uint aVal2_temp = aVal2;
                uint aVal3_temp = aVal3;
                aVal1 = aVal2;
                aVal2 = aVal3;
                aVal3 = displayRNG.genrand();

                // Skip the entry if it's too long ago
                if (loopIndex < healVals.Count - 5)
                {
                    continue;
                }

                //Start actually displaying
                dataGridView1.Rows.Add();

                // Color consumed RNG green
                if (index < start + healVals.Count)
                {
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGreen;
                }

                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Value = index;
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Value = currentHeal;
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value = randToPercent(aVal1_temp);

                handleSteal(steal, aVal1_temp, aVal2_temp, aVal3_temp, 3);
                handleStealCuffs(stealCuffs, aVal1_temp, aVal2_temp, aVal3_temp, 4);

                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[5].Value = (aVal1_temp < 0x1000000);

                // Check if the chests are in a position offset by a fixed amount
                if ((aVal1_temp % 100) < 3 && !rareSteal && loopIndex >= healVals.Count)
                {
                    rareSteal    = true;
                    rarePosition = loopIndex - healVals.Count;
                }

                if ((aVal1_temp % 100) < 6 && !rareStealCuffs && loopIndex >= healVals.Count)
                {
                    rareStealCuffs    = true;
                    rarePositionCuffs = loopIndex - healVals.Count;
                }

                // Check for combo during string of punches
                int comboCheck = loopIndex - healVals.Count - 5 + 1;
                if (comboCheck % 10 == 0 && comboCheck >= 0 && !comboFound &&
                    Combo.IsSucessful(aVal1_temp))
                {
                    comboFound = true;
                    comboPos   = comboCheck / 10;
                }
            }

            tbRare.Text      = rarePosition.ToString();
            tbRareCuffs.Text = rarePositionCuffs.ToString();

            tbCombo.Text = comboPos.ToString();

            tbLastHeal.Focus();
            tbLastHeal.SelectAll();

            group.SetIndex(indexStatic);
        }