private void BotWorker_DoWork(object sender, DoWorkEventArgs e) { if (_num == 0) { return; } _step = 1; if (_step != 1) { return; } var value = _num switch { 1 => new Position(325, 280), 2 => new Position(415, 280), 3 => new Position(515, 280), 4 => new Position(325, 350), 5 => new Position(415, 350), 6 => new Position(515, 350), 7 => new Position(325, 420), 8 => new Position(415, 420), 9 => new Position(515, 420), _ => new Position() }; Win32Bot.ClickInBg(Hayday, value.X, value.Y); Win32Bot.AwaitSleep(300); _step = 2; if (_step != 2) { return; } if (radMinAmount.Checked) { while (GetColor.GetColorFast(Hayday, 632, 298, 0xFFF8B0)) { Win32Bot.ClickInBg(Hayday, 632, 298); } } if (radMaxAmount.Checked) { while (GetColor.GetColorFast(Hayday, 791, 297, 0xFFF8B0)) { Win32Bot.ClickInBg(Hayday, 793, 300); } } Win32Bot.AwaitSleep(100); _step = 3; if (_step != 3) { return; } if (radMinPrice.Checked) { while (GetColor.GetColorFast(Hayday, 631, 387, 0xFFF8B0)) { Win32Bot.ClickInBg(Hayday, 677, 429); } } if (radMaxPrice.Checked) { while (GetColor.GetColorFast(Hayday, 789, 387, 0xFFF8B0)) { Win32Bot.ClickInBg(Hayday, 752, 429); } } Win32Bot.AwaitSleep(100); _step = 4; if (_step != 4) { return; } if (cbAutoSell.Checked) { Win32Bot.ClickInBg(Hayday, 707, 566); } _num = 0; _step = 0; BotWorker.CancelAsync(); } }