private void GenerateData_Click(object sender, EventArgs e) { if (seedBox.Text.Length == 0) { return; } ulong start_seed = ulong.Parse(seedBox.Text, System.Globalization.NumberStyles.HexNumber); uint start_frame = uint.Parse(startFrame.Text); uint end_frame = uint.Parse(endFrame.Text); ulong current_seed = Advance(start_seed, start_frame); RaidTemplate pkmn = (RaidTemplate)((ComboboxItem)speciesList.SelectedItem).Value; raidContent.Rows.Clear(); var rows = new List <DataGridViewRow>(); ((ISupportInitialize)raidContent).BeginInit(); for (uint current_frame = start_frame; current_frame <= start_frame + end_frame; current_frame++, current_seed += XOROSHIRO.XOROSHIRO_CONST) { RaidPKM res = pkmn.ConvertToPKM(current_seed, 0, 0); var row = CreateRaidRow(current_frame, res, GameStrings, current_seed); rows.Add(row); } raidContent.Rows.AddRange(rows.ToArray()); // Double buffering can make DGV slow in remote desktop if (!SystemInformation.TerminalServerSession) { raidContent.DoubleBuffered(true); } ((ISupportInitialize)raidContent).EndInit(); //raidContent }
private string GetCharacteristic(RaidPKM pkmn) { int charac = (int)(pkmn.EC % 6); for (int i = 0; i < 6; i++) { int k = (charac + i + 6) % 6; if (pkmn.IVs[iv_order[k]] == 31) { return(characteristics[k]); } } return(""); }
private DataGridViewRow CreateRaidRow(uint current_frame, RaidPKM res, GameStrings s, ulong current_seed) { var row = new DataGridViewRow(); row.CreateCells(raidContent); row.Cells[0].Value = current_frame.ToString(); row.Cells[1].Value = $"{res.IVs[0]:00}"; row.Cells[2].Value = $"{res.IVs[1]:00}"; row.Cells[3].Value = $"{res.IVs[2]:00}"; row.Cells[4].Value = $"{res.IVs[3]:00}"; row.Cells[5].Value = $"{res.IVs[4]:00}"; row.Cells[6].Value = $"{res.IVs[5]:00}"; row.Cells[7].Value = s.Natures[res.Nature]; row.Cells[8].Value = s.Ability[res.Ability]; row.Cells[9].Value = genders[res.Gender]; row.Cells[10].Value = shinytype[res.ShinyType]; row.Cells[11].Value = $"{current_seed:X16}"; return(row); }
private bool IsRowVisible(RaidPKM res) { if (res.IVs[0] < minHP.Value || res.IVs[0] > maxHP.Value) { return(false); } if (res.IVs[1] < minAtk.Value || res.IVs[1] > maxAtk.Value) { return(false); } if (res.IVs[2] < minDef.Value || res.IVs[2] > maxDef.Value) { return(false); } if (res.IVs[3] < minSpa.Value || res.IVs[3] > maxSpa.Value) { return(false); } if (res.IVs[4] < minSpd.Value || res.IVs[4] > maxSpd.Value) { return(false); } if (res.IVs[5] < MinSpe.Value || res.IVs[5] > maxSpe.Value) { return(false); } if (natureBox.SelectedIndex != 0 && natureBox.SelectedIndex - 1 != res.Nature) { return(false); } if (abilityBox.SelectedIndex != 0 && (int)((ComboboxItem)abilityBox.SelectedItem).Value != res.Ability) { return(false); } if (genderBox.SelectedIndex != 0 && (int)((ComboboxItem)genderBox.SelectedItem).Value != res.Gender) { return(false); } return((shinyBox.SelectedIndex == 1 && res.ShinyType > 0) || shinyBox.SelectedIndex - 2 == res.ShinyType || shinyBox.SelectedIndex == 0); }