# kingshotauto/kingshot-bot architecture

> Architecture diagram of the GitHub repository kingshotauto/kingshot-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kingshotauto/kingshot-bot
- Repository: https://github.com/kingshotauto/kingshot-bot

## Overview

KingshotAuto is a Windows desktop bot that automates Kingshot in LDPlayer. Users configure accounts and tasks in the GUI; cycle management schedules account runs, TaskManager executes task modules, and emulator control plus screen analysis support in-game actions. The graph preserves the documented task families and the separate multi-instance, recovery, and configuration capabilities. Source excerpts show only selected call paths, so documented workflow links use the README where needed; unsampled implementation details are not asserted.

Main entry points: [`Bot.Core/Tasks/TaskManager.cs`](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/TaskManager.cs) (Task manager), [`Bot.GUI/ViewModels/MainViewModel.cs`](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/ViewModels/MainViewModel.cs) (Main view model), [`Bot.Core/Tasks/Modules`](https://github.com/kingshotauto/kingshot-bot/tree/main/Bot.Core/Tasks/Modules) (Task modules), [`Bot.Core/LDPlayer/InstanceManager.cs`](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/LDPlayer/InstanceManager.cs) (Instance manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_gui["WPF interface<br/>[MainWindow.xaml.cs]"]
  node_mainvm["Main view model<br/>[MainViewModel.cs]"]
  node_configvm["Configuration editor<br/>[ConfigViewModel.cs]"]
end

subgraph group_orchestration["Run orchestration"]
  node_cycle["Cycle manager"]
  node_taskmanager["Task manager<br/>[TaskManager.cs]"]
end

subgraph group_automation["Game automation"]
  node_taskmodules["Task modules<br/>[Modules]"]
  node_accounttasks["Account switching"]
  node_farming["Farming<br/>[FarmingTask.cs]"]
  node_hunt["Auto hunt<br/>[AutoHuntTask.cs]"]
  node_other_tasks["Other task families<br/>[Modules]"]
end

subgraph group_emulator["Emulator and vision"]
  node_locator["Screen locator<br/>[LocatorService.cs]"]
  node_matching["Template matching"]
  node_ocr["Screen OCR<br/>[OCRService.cs]"]
  node_adb["ADB connections"]
  node_instance["Instance manager<br/>[InstanceManager.cs]"]
  node_helper["LDPlayer helper<br/>[LDPlayerHelper.cs]"]
end

subgraph group_support["Configuration and state"]
  node_configui["Configuration service"]
  node_models["Account settings<br/>[AccountSettings.cs]"]
  node_shield["Shield timer"]
end

node_player(("Bot operator"))
node_ldplayer(("LDPlayer emulator"))

node_player -->|"operates"| node_gui
node_gui -->|"presents"| node_mainvm
node_mainvm -->|"controls"| node_cycle
node_mainvm -->|"accesses"| node_taskmanager
node_mainvm -->|"uses"| node_configvm
node_configvm -.->|"edits"| node_configui
node_configui -->|"loads and saves"| node_models
node_cycle -->|"runs accounts"| node_taskmanager
node_taskmanager -->|"dispatches"| node_taskmodules
node_taskmanager -->|"executes"| node_accounttasks
node_taskmanager -->|"executes"| node_farming
node_taskmanager -->|"executes"| node_hunt
node_taskmodules -.->|"includes"| node_other_tasks
node_taskmodules -.->|"uses screen analysis"| node_locator
node_taskmodules -.->|"controls emulator"| node_adb
node_locator -->|"captures screen"| node_adb
node_locator -->|"matches templates"| node_matching
node_taskmodules -.->|"reads screen text"| node_ocr
node_adb -.->|"sends device commands"| node_ldplayer
node_instance -->|"locates console"| node_helper
node_instance -->|"uses connections"| node_adb
node_instance -.->|"starts instances"| node_ldplayer
node_mainvm -->|"manages instances"| node_instance
node_shield -->|"tracks shield settings"| node_models

click node_gui "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/Views/MainWindow.xaml.cs"
click node_mainvm "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/ViewModels/MainViewModel.cs"
click node_configvm "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/ViewModels/ConfigViewModel.cs"
click node_cycle "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Services/CycleManagementService.cs"
click node_taskmanager "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/TaskManager.cs"
click node_taskmodules "https://github.com/kingshotauto/kingshot-bot/tree/main/Bot.Core/Tasks/Modules"
click node_accounttasks "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/ChangeAccountTask.cs"
click node_farming "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/FarmingTask.cs"
click node_hunt "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/AutoHuntTask.cs"
click node_other_tasks "https://github.com/kingshotauto/kingshot-bot/tree/main/Bot.Core/Tasks/Modules"
click node_locator "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/LocatorService.cs"
click node_matching "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/ImageDetection/UnifiedTemplateMatchingService.cs"
click node_ocr "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/OCRService.cs"
click node_adb "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/LDPlayer/ADBConnectionManager.cs"
click node_instance "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/LDPlayer/InstanceManager.cs"
click node_helper "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/LDPlayerHelper.cs"
click node_configui "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Config/ConfigurationManager.cs"
click node_models "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Models/AccountSettings.cs"
click node_shield "https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Services/ShieldTimeManager.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gui,node_mainvm,node_configvm toneBlue
class node_cycle,node_taskmanager toneAmber
class node_taskmodules,node_accounttasks,node_farming,node_hunt,node_other_tasks toneMint
class node_locator,node_matching,node_ocr,node_adb,node_instance,node_helper toneRose
class node_configui,node_models,node_shield,node_player,node_ldplayer toneIndigo
```

## Components

### Desktop interface

- [WPF interface](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/Views/MainWindow.xaml.cs): `Bot.GUI/Views/MainWindow.xaml.cs`
- [Main view model](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/ViewModels/MainViewModel.cs): `Bot.GUI/ViewModels/MainViewModel.cs`
- [Configuration editor](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.GUI/ViewModels/ConfigViewModel.cs): `Bot.GUI/ViewModels/ConfigViewModel.cs`

### Run orchestration

- [Cycle manager](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Services/CycleManagementService.cs): `Bot.Core/Services/CycleManagementService.cs`
- [Task manager](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/TaskManager.cs): `Bot.Core/Tasks/TaskManager.cs`

### Game automation

- [Task modules](https://github.com/kingshotauto/kingshot-bot/tree/main/Bot.Core/Tasks/Modules): `Bot.Core/Tasks/Modules`
- [Account switching](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/ChangeAccountTask.cs): `Bot.Core/Tasks/Modules/ChangeAccountTask.cs`
- [Farming](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/FarmingTask.cs): `Bot.Core/Tasks/Modules/FarmingTask.cs`
- [Auto hunt](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Tasks/Modules/AutoHuntTask.cs): `Bot.Core/Tasks/Modules/AutoHuntTask.cs`
- [Other task families](https://github.com/kingshotauto/kingshot-bot/tree/main/Bot.Core/Tasks/Modules): `Bot.Core/Tasks/Modules`

### Emulator and vision

- [Screen locator](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/LocatorService.cs): `Bot.Core/Utils/LocatorService.cs`
- [Template matching](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/ImageDetection/UnifiedTemplateMatchingService.cs): `Bot.Core/ImageDetection/UnifiedTemplateMatchingService.cs`
- [Screen OCR](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/OCRService.cs): `Bot.Core/Utils/OCRService.cs`
- [ADB connections](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/LDPlayer/ADBConnectionManager.cs): `Bot.Core/LDPlayer/ADBConnectionManager.cs`
- [Instance manager](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/LDPlayer/InstanceManager.cs): `Bot.Core/LDPlayer/InstanceManager.cs`
- [LDPlayer helper](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Utils/LDPlayerHelper.cs): `Bot.Core/Utils/LDPlayerHelper.cs`

### Configuration and state

- [Configuration service](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Config/ConfigurationManager.cs): `Bot.Core/Config/ConfigurationManager.cs`
- [Account settings](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Models/AccountSettings.cs): `Bot.Core/Models/AccountSettings.cs`
- [Shield timer](https://github.com/kingshotauto/kingshot-bot/blob/main/Bot.Core/Services/ShieldTimeManager.cs): `Bot.Core/Services/ShieldTimeManager.cs`

### Other components

- **Bot operator**
- **LDPlayer emulator**

## Connections

- Bot operator → WPF interface: operates (evidence: `README.md`)
- WPF interface → Main view model: presents (evidence: `Bot.GUI/Views/MainWindow.xaml.cs`)
- Main view model → Cycle manager: controls (evidence: `Bot.GUI/ViewModels/MainViewModel.cs`)
- Main view model → Task manager: accesses (evidence: `Bot.GUI/ViewModels/MainViewModel.cs`)
- Main view model → Configuration editor: uses (evidence: `Bot.GUI/ViewModels/MainViewModel.cs`)
- Configuration editor → Configuration service: edits
- Configuration service → Account settings: loads and saves (evidence: `Bot.Core/Config/ConfigurationManager.cs`)
- Cycle manager → Task manager: runs accounts (evidence: `Bot.Core/Services/CycleManagementService.cs`)
- Task manager → Task modules: dispatches (evidence: `Bot.Core/Tasks/TaskManager.cs`)
- Task manager → Account switching: executes (evidence: `Bot.Core/Tasks/TaskManager.cs`)
- Task manager → Farming: executes (evidence: `Bot.Core/Tasks/TaskManager.cs`)
- Task manager → Auto hunt: executes (evidence: `Bot.Core/Tasks/TaskManager.cs`)
- Task modules → Other task families: includes
- Task modules → Screen locator: uses screen analysis (evidence: `README.md`)
- Task modules → ADB connections: controls emulator (evidence: `README.md`)
- Screen locator → ADB connections: captures screen (evidence: `Bot.Core/Utils/LocatorService.cs`)
- Screen locator → Template matching: matches templates (evidence: `Bot.Core/Utils/LocatorService.cs`)
- Task modules → Screen OCR: reads screen text (evidence: `README.md`)
- ADB connections → LDPlayer emulator: sends device commands (evidence: `README.md`)
- Instance manager → LDPlayer helper: locates console (evidence: `Bot.Core/LDPlayer/InstanceManager.cs`)
- Instance manager → ADB connections: uses connections (evidence: `Bot.Core/LDPlayer/InstanceManager.cs`)
- Instance manager → LDPlayer emulator: starts instances (evidence: `README.md`)
- Main view model → Instance manager: manages instances (evidence: `Bot.GUI/ViewModels/MainViewModel.cs`)
- Shield timer → Account settings: tracks shield settings (evidence: `Bot.Core/Services/ShieldTimeManager.cs`)
