# xiaogu-g2020/deltaforcemarketbot architecture

> Architecture diagram of the GitHub repository xiaogu-g2020/deltaforcemarketbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xiaogu-g2020/deltaforcemarketbot
- Repository: https://github.com/xiaogu-g2020/deltaforcemarketbot

## Overview

DeltaForceMarketBot is a desktop automation tool for buying items in the Delta Force in-game market. Users set price thresholds and purchase modes in the GUI, position the game on an item, then use F8/F9 to start or stop the worker. The worker reads the displayed price (or estimates it from balance changes), applies the normal or key-card buying rules, and asks the bot to buy, refresh, or reopen the item page. The README also documents convertible-item handling and balance-based pricing. The main source excerpt is partial, so uncertain worker details are omitted.

Main entry points: [`backend/BuyBot.py`](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/BuyBot.py) (BuyBot), [`DFMarketBot.py`](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py) (Purchase worker), [`GUI/AppGUI.py`](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/GUI/AppGUI.py) (Settings GUI), [`backend/utils.py`](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/utils.py) (Mouse automation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_controls["User controls"]
  node_gui["Settings GUI<br/>[AppGUI.py]"]
  node_hotkeys["F8/F9 monitor<br/>[DFMarketBot.py]"]
  node_keyboard["Keyboard hook<br/>[DFMarketBot.py]"]
end

subgraph group_runtime["Automation runtime"]
  node_app["Application setup<br/>[DFMarketBot.py]"]
  node_worker["Purchase worker<br/>[DFMarketBot.py]"]
end

subgraph group_perception["Price perception"]
  node_ocr["EasyOCR reader<br/>[BuyBot.py]"]
  node_screen["Screenshot helpers<br/>[utils.py]"]
end

subgraph group_interaction["Game interaction"]
  node_bot["BuyBot<br/>[BuyBot.py]"]
  node_mouse["Mouse automation<br/>[utils.py]"]
end

node_user(("User"))
node_game["Delta Force game"]

node_user -->|"sets options"| node_gui
node_app -->|"creates window"| node_gui
node_gui -->|"updates parameters"| node_worker
node_user -->|"presses F8/F9"| node_keyboard
node_keyboard -->|"reports keys"| node_hotkeys
node_hotkeys -->|"starts or stops"| node_worker
node_worker -->|"requests price and actions"| node_bot
node_bot -->|"captures price region"| node_screen
node_bot -->|"recognizes text"| node_ocr
node_bot -->|"captures balance region"| node_screen
node_bot -->|"moves and clicks"| node_mouse
node_worker -->|"reads displayed state"| node_game
node_mouse -->|"controls market UI"| node_game
node_bot -->|"presses Escape"| node_game

click node_gui "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/GUI/AppGUI.py"
click node_app "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py"
click node_hotkeys "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py"
click node_worker "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py"
click node_bot "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/BuyBot.py"
click node_ocr "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/BuyBot.py"
click node_screen "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/utils.py"
click node_mouse "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/utils.py"
click node_keyboard "https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py"

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_hotkeys,node_keyboard,node_user toneBlue
class node_app,node_worker toneAmber
class node_ocr,node_screen toneMint
class node_bot,node_mouse toneRose
class node_game toneIndigo
```

## Components

### User controls

- [Settings GUI](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/GUI/AppGUI.py): `GUI/AppGUI.py`
- [F8/F9 monitor](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py): `DFMarketBot.py`
- [Keyboard hook](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py): `DFMarketBot.py`

### Automation runtime

- [Application setup](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py): `DFMarketBot.py`
- [Purchase worker](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/DFMarketBot.py): `DFMarketBot.py`

### Price perception

- [EasyOCR reader](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/BuyBot.py): `backend/BuyBot.py`
- [Screenshot helpers](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/utils.py): `backend/utils.py`

### Game interaction

- [BuyBot](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/BuyBot.py): `backend/BuyBot.py`
- [Mouse automation](https://github.com/xiaogu-g2020/deltaforcemarketbot/blob/main/backend/utils.py): `backend/utils.py`

### Other components

- **User**
- **Delta Force game**

## Connections

- User → Settings GUI: sets options
- Application setup → Settings GUI: creates window
- Settings GUI → Purchase worker: updates parameters
- User → Keyboard hook: presses F8/F9
- Keyboard hook → F8/F9 monitor: reports keys
- F8/F9 monitor → Purchase worker: starts or stops
- Purchase worker → BuyBot: requests price and actions
- BuyBot → Screenshot helpers: captures price region
- BuyBot → EasyOCR reader: recognizes text
- BuyBot → Screenshot helpers: captures balance region
- BuyBot → Mouse automation: moves and clicks
- Purchase worker → Delta Force game: reads displayed state
- Mouse automation → Delta Force game: controls market UI
- BuyBot → Delta Force game: presses Escape
