private void GenerateData_Click(object sender, EventArgs e) { 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); var s = GameInfo.Strings; 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, Raids.TID, Raids.SID); var row = CreateRaidRow(current_frame, res, s, 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 }
public static Image GetRaidResultSprite(RaidPKM raidPkm, bool active) { var sprite = SpriteUtil.GetSprite(raidPkm.Species, raidPkm.AltForm, raidPkm.Gender, 0, false, raidPkm.ShinyType > 0); if (raidPkm.IsGigantamax) { var gm = Resources.dyna; sprite = ImageUtil.LayerImage(sprite, gm, (sprite.Width - gm.Width) / 2, 0); } if (!active) { sprite = ImageUtil.ToGrayscale(sprite); } return(sprite); }
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); }
public static Image GetRaidResultSprite(RaidPKM raidPkm, bool active) { var sprite = SpriteUtil.GetSprite(raidPkm.Species, raidPkm.AltForm, raidPkm.Gender, 0, 0, false, raidPkm.ShinyType > 0 && raidPkm.ShinyType != 3, 8, isAltShiny: raidPkm.ShinyType == 2); if (raidPkm.IsGigantamax) { var gm = Resources.dyna; sprite = ImageUtil.LayerImage(sprite, gm, (sprite.Width - gm.Width) / 2, 0); } if (raidPkm.ShinyType == 3) { // No Shiny var icon = Resources.no_shiny; sprite = ImageUtil.LayerImage(sprite, icon, 0, 0, 0.7); } if (!active) { sprite = ImageUtil.ToGrayscale(sprite); } return(sprite); }