Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d48f820
Initial plan
Copilot Sep 2, 2025
7ddff40
Implement automatic ADB checking functionality
Copilot Sep 2, 2025
276acfa
Add command line option to skip ADB checking and update documentation
Copilot Sep 2, 2025
7a7238f
Merge pull request #1 from daminokun/copilot/fix-4e004baa-0a0f-448d-b…
daminokun Sep 2, 2025
fa4d73b
adb files is added
daminokun Sep 2, 2025
ab78ff2
Update README with ADB PATH setup instructions
daminokun Sep 2, 2025
45f18d1
Add screenshot manager functionality
daminokun Sep 2, 2025
de771e3
Refactor screenshot capture and error handling
daminokun Sep 2, 2025
2038ed0
Fix indentation in screenshot capture loop
daminokun Sep 2, 2025
459178d
Fix exception handling in bot.py
daminokun Sep 2, 2025
ee9a615
Fix exception handling in screenshot capture
daminokun Sep 2, 2025
bc3eb55
Refactor exception handling in screenshot capture
daminokun Sep 2, 2025
78631f4
Update bot.py
daminokun Sep 2, 2025
593c0ab
Rename screenshot_manger.py to screenshot_manager.py
daminokun Sep 2, 2025
db1ba44
Correct screenshot manager usage in bot.py
daminokun Sep 2, 2025
0131f46
Return new filename from save_new_screenshot
daminokun Sep 2, 2025
c75d64f
Correct indentation for while loop
daminokun Sep 2, 2025
cd665f0
Refactor screenshot capturing loop for clarity
daminokun Sep 2, 2025
a4c2f17
Update bot.py
daminokun Sep 2, 2025
8ed131e
Fix screenshot manager import and refactor loop
daminokun Sep 2, 2025
9e27991
Fix typo in screenshot manager import and usage
daminokun Sep 2, 2025
f8dce7f
Fix comment for screenshot_manager import
daminokun Sep 2, 2025
03c153f
Refactor game timer handling to use decision-making
daminokun Sep 2, 2025
a6a06b3
Fix indentation for game action decision
daminokun Sep 2, 2025
98822d7
Fix indentation issue in bot.py
daminokun Sep 2, 2025
84d76bc
Improve timer handling and game action decision
daminokun Sep 2, 2025
cd44172
Add files via upload
daminokun Sep 2, 2025
63eea4f
Fix activation command and ADB path instructions
daminokun Sep 2, 2025
cd40106
Adjust forfeit action position check
daminokun Sep 2, 2025
dc005d1
Add skip_adb_check parameter to run function
daminokun Sep 2, 2025
7b60fc6
Add files via upload
daminokun Sep 2, 2025
a7a7543
Add files via upload
daminokun Sep 3, 2025
d5be5a9
Add files via upload
daminokun Sep 3, 2025
27aca83
Add files via upload
daminokun Sep 3, 2025
97cd09e
Revise output examples and known issues in README
daminokun Sep 3, 2025
60d4543
Add files via upload
daminokun Sep 3, 2025
c261783
Update README.md
daminokun Sep 3, 2025
1b52787
Delete images/forfeit.png
daminokun Sep 4, 2025
4cdcac5
Refactor FindImageResult to use attr library
daminokun Sep 4, 2025
5430046
Enhance forfeit match logic in image decision maker
daminokun Sep 4, 2025
d0f60fb
Add matched region size to FindImageResult return
daminokun Sep 4, 2025
5f6e346
Inject Google Site Verification meta tag
daminokun Sep 8, 2025
f592831
Add files via upload
daminokun Sep 8, 2025
caa6309
Delete google19d24c84934fd462.txt
daminokun Sep 8, 2025
fb86d04
Update priority list in image_decision_maker.py
daminokun Sep 13, 2025
3f1bdb2
Refactor image matching and filtering logic
daminokun Sep 13, 2025
b622bde
Fix syntax error in return statement
daminokun Sep 13, 2025
3726edf
Add files via upload
daminokun Sep 13, 2025
c269dee
Delete images/vs.png
daminokun Sep 13, 2025
8268743
Delete images directory
daminokun Sep 13, 2025
519c885
Add files via upload
daminokun Sep 13, 2025
728f191
Delete images/start_button_text6.en.png
daminokun Sep 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
# Runs on pushes targeting the default branch
push:
branches: ["dev"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site

- name: Inject Google Site Verification Meta Tag
run: |
META_TAG='<meta name="google-site-verification" content="P0tgZn6jrR1dFFAZQXvbWa7RuK3ceEDkS2yhxihWyuw" />'
find ./_site -name "*.html" -exec sudo sed -i "s|</head>|$META_TAG\n</head>|g" {} +

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
90 changes: 77 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PVPokeLossBot

This only works on android. It uses [adb](https://developer.android.com/tools/adb) to connect to your phone.
It works fine on my Pixel 6a. If your phone's resolution differs too much, it might not detect the correct state.


## Summary

Expand All @@ -21,23 +21,36 @@ Using [venv](https://docs.python.org/3/library/venv.html), create a virtual envi

``` bash
python -m venv venv
source venv/bin/activate
venv/scripts/activate
```

### Install dependencies

``` bash
pip install -r requirements.txt
```
## Add ADB to Your System PATH

Locate the adb folder in the extracted folder (platform-tools).
Copy the path to the folder (e.g., C:\Users\<YourUser>\Downloads\PVPokeLossBot-dev\platform-tools).

On Windows:

Search “Edit the system environment variables” → Open “Environment Variables”.
Under “System variables”, find and select Path, then click “Edit”.
Click “New” and paste the path to your platform-tools folder.
Click OK to save and restart your terminal.

## Usage

Make sure you are in your venv if you used one.

``` bash
source venv/bin/activate
venv/scripts/activate
```

The bot automatically checks that ADB (Android Debug Bridge) is properly installed and can connect to your device before starting. Ensure your Android device is connected via USB with USB debugging enabled.

To run the bot, you can use the following command:

``` bash
Expand All @@ -50,6 +63,14 @@ Run it with `--verbose` to get more output.
python main.py --verbose
```

For advanced users, you can skip the automatic ADB connectivity check with:

``` bash
python main.py --skip-adb-check
```

**Note**: Only use `--skip-adb-check` if you're sure ADB is working properly, as the bot will fail if ADB commands don't work.

You can also configure the bot's settings by editing the `bot.py` file.
For example, you can adjust the time the bot will stay in the game before forfeiting.

Expand All @@ -59,17 +80,47 @@ PVPokeLossBot will output information about its actions and the results of the i
Below is an example of the output you may see while the bot is running:

``` bash
2023-01-20 09:45:10 Image start_button_text2.en.png matches with 99.99927282333374%
2023-01-20 09:45:15 Image welcome_to_gbl_button_text.en.png matches with 100.0%
2023-01-20 09:45:19 Image select_super_league.png matches with 100.0%
2023-01-20 09:45:24 Image confirm_party_search_button.en.png matches with 99.99873638153076%
2023-01-20 09:46:43 Image ingame_opponent_3_pokemon_left.png matches with 99.86531138420105%
2023-01-20 09:46:48 Image ingame_opponent_2_pokemon_left.png matches with 99.82503652572632%
2023-01-20 09:46:51 Timer has run out. Forfeit the game.
2025-09-03 12:18:06 Screenshot saved to screenshots\screenshot.png
2025-09-03 12:18:06 Screenshot hash: 5bccc269456fe924d0f50932dd13e472
2025-09-03 12:18:06 Running image matching...
2025-09-03 12:18:07 Template 'claim_rewards_button_text.en.png': match confidence 0.4624
2025-09-03 12:18:07 Template 'claim_rewards_button_text.png': match confidence 0.3119
2025-09-03 12:18:07 Template 'claim_rewards_button_text2.png': match confidence 0.4475
2025-09-03 12:18:07 Template 'confirm_game_result_all_games_played_button.png': match confidence 0.3542
2025-09-03 12:18:07 Template 'confirm_party_search_button.en.png': match confidence 0.9743
2025-09-03 12:18:07 Template 'confirm_party_search_button.png': match confidence 0.6756
2025-09-03 12:18:07 Template 'enemy_charge_attack.png': match confidence 0.2437
2025-09-03 12:18:07 Template 'forfeit.png': match confidence 0.9981
2025-09-03 12:18:07 Template 'forfeit_1.png': match confidence 0.5382
2025-09-03 12:18:07 Template 'max_number_of_games_played_text.en.png': match confidence 0.4017
2025-09-03 12:18:07 Template 'max_number_of_games_played_text.png': match confidence 0.2709
2025-09-03 12:18:07 Template 'max_number_of_games_played_text2.en.png': match confidence 0.2987
2025-09-03 12:18:07 Template 'reward_1_2_icon.png': match confidence 0.7334
2025-09-03 12:18:08 Template 'reward_1_icon.png': match confidence 0.5478
2025-09-03 12:18:08 Template 'reward_2_icon.png': match confidence 0.4625
2025-09-03 12:18:08 Template 'reward_3_icon.png': match confidence 0.3415
2025-09-03 12:18:08 Template 'reward_4_icon.png': match confidence 0.5072
2025-09-03 12:18:08 Template 'search_next_game_button_text.en.png': match confidence 0.4627
2025-09-03 12:18:08 Template 'search_next_game_button_text.png': match confidence 0.4302
2025-09-03 12:18:08 Template 'select_hypa_league.png': match confidence 0.3831
2025-09-03 12:18:08 Template 'select_master_league.png': match confidence 0.4631
2025-09-03 12:18:08 Template 'select_super_league.png': match confidence 0.4494
2025-09-03 12:18:08 Template 'start_button_text.en.png': match confidence 0.5020
2025-09-03 12:18:08 Template 'start_button_text.png': match confidence 0.5858
2025-09-03 12:18:08 Template 'start_button_text2.en.png': match confidence 0.7802
2025-09-03 12:18:09 Template 'start_button_text2.png': match confidence 0.6799
2025-09-03 12:18:09 Template 'start_button_text3.en.png': match confidence 0.6981
2025-09-03 12:18:09 Template 'start_button_text4.en.png': match confidence 0.7718
2025-09-03 12:18:09 Template 'start_button_text5.en.png': match confidence 0.7266
2025-09-03 12:18:09 Template 'start_button_yes.png': match confidence 0.6609
2025-09-03 12:18:09 Template 'welcome_to_gbl_button_text.en.png': match confidence 0.4897
2025-09-03 12:18:09 Template 'welcome_to_gbl_button_text.png': match confidence 0.4706
2025-09-03 12:18:09 Found images over threshold: [('forfeit.png', FindImageResult(val=0.9980706572532654, coords=(114, 228))), ('confirm_party_search_button.en.png', FindImageResult(val=0.9742874503135681, coords=(541, 2143)))]
2025-09-03 12:18:09 Tapping confirm_party_search_button.en.png at (541, 2143) (confidence 97.43%)
2025-09-03 12:18:09 ADB tap sent to coordinates (541, 2143)
```

Each line of output shows the date and time of the action, the image file name that was matched, and the match value as a percentage.
The bot will also output a message when the timer runs out and it forfeits the game.

## Adding New Images

Expand All @@ -85,10 +136,23 @@ python convert-to-greyscale.py
If you are using the bot in a different language than the one provided in the template images, you can contribute by adding new images for different languages.
You can create a pull request with the new images and the corresponding language identifier in the file name, for example, `start_button_text2.fr.png` for French.

## Adjust Forfeit Delay
Find this part in analyze_results_and_return_action (or wherever you handle the forfeit template):

``` bash
if image_file.startswith("forfeit"): # or your specific template name
return GameAction(
action=GameActions.tap_position,
position=find_image_result.coords,
delay_before_tap=3.0 # <--- CHANGE THIS VALUE
)
```
To change the delay:
Change 3.0 to any number of seconds you want (e.g., 5.0 for 5 seconds, 1.5 for 1.5 seconds).

## Known Issues

The bot may get stuck on the forfeit the game screen.
Pokemon Go has to be restarted manually.
Stuck after claiming Encounter reward since the bot is not made to catch pokemon

## The Secret to Farming Stardust in Pokemon Go: PVPokeLossBot's Elo Drop Strategy

Expand Down
Binary file added images/Yes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/claim_rank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/claim_rank_.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/enemy_charge_attack.png
Binary file not shown.
Binary file added images/forfeit_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/ingame_opponent_1_pokemon_left.png
Binary file not shown.
Binary file removed images/ingame_opponent_2_pokemon_left.png
Binary file not shown.
Binary file removed images/ingame_opponent_3_pokemon_left.png
Binary file not shown.
Binary file modified images/reward_1.1_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/select_great.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed images/select_league_limited.png
Binary file not shown.
File renamed without changes
Binary file added images/start_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/start_button_text6.en.png
Binary file not shown.
Binary file added images/start_button_yes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ def set_up_logging_configuration(log_level):

parser = argparse.ArgumentParser(description="PVPokeLossBot is a bot designed for the PVP mode of the mobile game Pokemon Go.")
parser.add_argument('--verbose', '-v', action='store_true', help='Enable verbose logging')
parser.add_argument('--skip-adb-check', action='store_true', help='Skip ADB connectivity check at startup (advanced users only)')

args = parser.parse_args()

set_up_logging_configuration(logging.DEBUG if args.verbose else logging.INFO)

try:
bot.run()
bot.run(skip_adb_check=args.skip_adb_check)
except KeyboardInterrupt:
print("")
print("Exiting program...")
Binary file added platform-tools/AdbWinApi.dll
Binary file not shown.
Binary file added platform-tools/AdbWinUsbApi.dll
Binary file not shown.
Loading