Skip to content

nedsion/rok-auto

Repository files navigation

Rise of Kingdoms Automation

An automation tool for Rise of Kingdoms mobile game using ADB (Android Debug Bridge) and LDPlayer emulator with a PyQt5 GUI interface.

Features

  • 🎮 Automated gameplay actions for Rise of Kingdoms
  • 🖥️ PyQt5-based GUI for easy control
  • 📱 Support for LDPlayer Android emulator
  • 🤖 2Captcha integration for captcha solving
  • 🔄 Multi-threaded worker system for concurrent operations
  • 📸 Screenshot capture and image processing
  • ⚙️ Configurable automation options

Prerequisites

  • Python 3.7+
  • LDPlayer Android Emulator
  • ADB (Android Debug Bridge)
  • 2Captcha API key (for captcha solving)

Installation

  1. Clone the repository:
git clone https://github.com/nedsion/rok-auto.git
cd rok-auto
  1. Create and activate a virtual environment:
python -m venv .venv
.venv\Scripts\activate
  1. Install required dependencies:
pip install -r requirements.txt
  1. Configure the application:
    • Edit config.json to set your LDPlayer installation path:
    {
        "LD_PATH": "D:\\LDPlayer\\LDPlayer3.0"
    }
    • Update config.py with your 2Captcha API key

Configuration

config.json

  • LD_PATH: Path to your LDPlayer installation directory

config.py

Key configuration options:

  • TWO_CAPTCHA_API_KEY: Your 2Captcha API key for automated captcha solving
  • GAME_PACKAGE: Package name of the game (default: com.rok.gp.vn)
  • PATH_SCREEN_SHOT_FOLDER: Directory for storing screenshots
  • TIME_WAIT_TO_OPEN_GAME: Wait time for game to launch (seconds)
  • TIME_WAIT_TO_SOLVE_CAPTCHA_MAX/MIN: Captcha solving timeout range

Usage

  1. Launch LDPlayer emulator
  2. Run the main application:
python main.py
  1. The GUI will open where you can:
    • Select emulator instances
    • Configure automation actions
    • Set delay times between actions
    • Monitor execution logs
    • Start/stop automation tasks

Project Structure

.
├── main.py                 # Main GUI application
├── rok_core.py            # Core automation logic
├── adb_helper.py          # ADB connection helper
├── LD_helper.py           # LDPlayer integration
├── LD_ADB_helper.py       # Alternative ADB helper
├── uia_helper.py          # UI automation helper
├── helper_2captcha.py     # 2Captcha integration
├── config.py              # Configuration constants
├── config.json            # User configuration file
├── requirements.txt       # Python dependencies
├── images/                # Image assets
├── output/                # Output directory
│   ├── config.json
│   ├── images/
│   └── screenshot/
├── screenshot/            # Screenshot storage
└── test/                  # Test files

Core Components

RiseOfKingDom Class (rok_core.py)

Main automation engine that handles:

  • Device connection via ADB
  • Screenshot capture and processing
  • Image recognition
  • Captcha detection and solving
  • Game action automation

Worker Class (main.py)

Multi-threaded worker for executing automation tasks:

  • Asynchronous task execution
  • Progress updates via signals
  • Configurable actions and delays

LDHelper Class (LD_helper.py)

LDPlayer emulator management:

  • Launch/quit emulator instances
  • ADB device enumeration
  • Process management

Dependencies

Key packages:

  • PyQt5: GUI framework
  • adbutils: ADB communication
  • opencv-python: Image processing
  • numpy: Numerical operations
  • requests: HTTP client for API calls
  • Pillow: Image manipulation

See requirements.txt for complete list.

License Verification

The application includes license key verification functionality that connects to:

https://nedsion.xyz/api/license/?key=<your-key>

Screenshots

Screenshots are automatically saved to the screenshot/ directory during automation runs.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Disclaimer

This tool is for educational purposes only. Use at your own risk. Automated gameplay may violate the game's Terms of Service.

Support

For issues and questions, please create an issue on the GitHub repository.

Author

nedsion

Repository

https://github.com/nedsion/rok-auto

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages