select pokemons by possition

This commit is contained in:
Radek Davidek 2025-12-08 13:06:08 +01:00
parent 5450f0e92f
commit 0cb117c35a
3 changed files with 43 additions and 11 deletions

View File

@ -1,12 +1,12 @@
#Pokémon GO Automatizace - Nastavení
#Thu Dec 04 16:03:55 CET 2025
#Mon Dec 08 13:05:40 CET 2025
autoklik.count=500
window.width=807
transfer.delay=0
window.height=743
autoklik.x=2380
autoklik.y=1124
transfer.count=30
window.x=930
transfer.count=12
window.x=866
autoklik.interval=100
window.y=22
window.y=237

BIN
pgo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -26,8 +26,8 @@ public class PokemonGoAutomation {
private BufferedImage t2Template; // Confirmation button template
private BufferedImage pok1Template; // Pokemon detection template
private BufferedImage includeTemplate; // Include button template
private static final int DELAY_BETWEEN_CLICKS = 200; // ms
private static final int DELAY_AFTER_ACTION = 500; // ms
private static final int DELAY_BETWEEN_CLICKS = 100; // ms
private static final int DELAY_AFTER_ACTION = 100; // ms
private int transferredPokemonCount = 0; // Počet transfernutých pokémonů
public PokemonGoAutomation() throws AWTException {
@ -162,7 +162,7 @@ public class PokemonGoAutomation {
* Hledá v oblasti od vrchu obrazovky do 75% výšky
* Může najít 9 Pokémonů
*/
private List<Point> detectPokemonsByTemplateMatching() {
private List<Point> detectPokemonsByTemplateMatching2() {
List<Point> positions = new ArrayList<>();
System.out.println("\n=== Detekce Pokémonů pomocí template matchingu (pok1.png) ===");
@ -561,7 +561,7 @@ public class PokemonGoAutomation {
return;
}
int pokemonThisRound = Math.min(9, totalPokemonCount - transferredCount);
int pokemonThisRound = Math.min(12, totalPokemonCount - transferredCount);
System.out.println("\n=== Iterace " + (transferredCount / 9 + 1) + " - Transferuji maximálně " + pokemonThisRound
+ " pokémonů ===");
@ -610,7 +610,7 @@ public class PokemonGoAutomation {
private int selectAllPokemonCount(int count) {
System.out.println("Začínám označovat " + count + " pokémonů (pouze template matching)...");
List<Point> positions = detectPokemonsByTemplateMatching();
List<Point> positions = getPossitionsAbsolute();
int maxPokemon = Math.min(count, positions.size());
System.out.println("Budu označovat " + maxPokemon + " pokémonů...");
@ -622,10 +622,9 @@ public class PokemonGoAutomation {
robot.mouseMove(pos.x, pos.y);
if (i == 0) {
robot.delay(500);
System.out.println(" -> Dlouhé podržení (aktivace multi-select)");
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(800);
robot.delay(600);
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.delay(DELAY_AFTER_ACTION);
} else {
@ -644,6 +643,39 @@ public class PokemonGoAutomation {
return maxPokemon;
}
private List<Point> getPossitionsAbsolute() {
List<Point> possitions = new ArrayList<>();
possitions.add(getAbsolutePoint(115, 240));
possitions.add(getAbsolutePoint(307, 240));
possitions.add(getAbsolutePoint(496, 240));
possitions.add(getAbsolutePoint(115, 460));
possitions.add(getAbsolutePoint(307, 460));
possitions.add(getAbsolutePoint(496, 460));
possitions.add(getAbsolutePoint(115, 680));
possitions.add(getAbsolutePoint(307, 680));
possitions.add(getAbsolutePoint(496, 680));
possitions.add(getAbsolutePoint(115, 900));
possitions.add(getAbsolutePoint(307, 900));
possitions.add(getAbsolutePoint(496, 900));
return possitions;
}
/**
* Převede relativní pozici v okně (0.0-1.0) na absolutní souřadnice obrazovky
* @param relativeX Relativní X pozice (0.0 = levý okraj, 1.0 = pravý okraj)
* @param relativeY Relativní Y pozice (0.0 = horní okraj, 1.0 = dolní okraj)
* @return Absolutní pozice na obrazovce
*/
private Point getAbsolutePoint(int relativeX, int relativeY) {
int absoluteX = windowBounds.x + relativeX;
int absoluteY = windowBounds.y + relativeY;
return new Point(absoluteX, absoluteY);
}
public static void main(String[] args) {
System.out.println("=== Pokémon GO Automatizační Nástroj ===");
System.out.println("Ujistěte se, že je aplikace Pokémon GO spuštěná...");