Skip to content

Manjushwarofficial/Standoff-2-Marketplace-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Standoff 2 Marketplace Sniper Bot

An AI-powered automated purchasing tool for the Standoff 2 marketplace that uses computer vision and machine learning to detect and instantly purchase desired items.

Table of Contents

Overview

The SO2 Sniper Bot is a desktop application that monitors a specified region of your screen in real-time, using a trained TensorFlow model to detect specific marketplace items. When a match is found with high confidence, it automatically executes a pre-configured sequence of clicks to complete the purchase instantly.
Version: 1.3.0 - Enhanced Stability[1]

Snapshots And Demo Video

image

Video Link : Click Here

Features

  • AI-Powered Detection: Uses TensorFlow CNN model for accurate item recognition
  • Real-Time Screen Monitoring: High-frequency scanning (1000Hz) for minimal latency
  • Instant Purchase Execution: Sub-second response time from detection to purchase
  • Visual Status Indicators: Real-time scan and purchase status lights
  • Auto-Refresh Capability: Configurable page refresh with single or double-click support
  • Custom Click Sequences: Record multi-step purchase workflows with timing control
  • Visual Configuration Preview: Overlay display showing scan area and click points
  • Template Save/Load: Store and reuse configurations for different items
  • Cross-Platform Support: Works on Windows, macOS, and Linux
  • CPU-Optimized Mode: Runs efficiently without requiring GPU acceleration
  • Enhanced Error Handling: Auto-recovery from scan errors with detailed logging

System Requirements

Hardware

  • CPU: Multi-core processor (Intel i5/AMD Ryzen 5 or better recommended)
  • RAM: Minimum 4GB (8GB recommended)
  • Display: 1920x1080 or higher resolution
  • Mouse: Any standard mouse for click automation

Software

  • Operating System:
    • Windows 10/11
    • macOS 10.15 or later
    • Linux (Ubuntu 20.04+ or equivalent)
  • Python: Version 3.9, 3.10, 3.11, or 3.12 (3.13+ not supported by TensorFlow)

Installation

Step 1: Install Python

Download and install Python 3.11 from python.org
For macOS users with Apple Silicon, we recommend using conda:

conda create -n so2bot python=3.11
conda activate so2bot

Step 2: Clone or Download the Repository

git clone https://github.com/yourusername/standoff-2-marketplace-bot.git
cd standoff-2-marketplace-bot

Step 3: Install Dependencies

For macOS (Apple Silicon):

pip install tensorflow-macos
pip install opencv-python pyautogui mss numpy PyQt5

For macOS (Intel) / Windows / Linux:

pip install -r requirements.txt

Step 4: Verify Installation

Run the bot to check if TensorFlow loads correctly:

python app.py

You should see initialization messages confirming TensorFlow is working.

Project Structure

STANDOFF-2-MARKETPLACE-BOT/
│
├── .vscode/                      # VSCode configuration
├── assets/                       # UI assets and resources
├── config_templates/             # Pre-configured setup templates
│
├── data/
│   ├── processed/                # Processed training data
│   │   ├── labeled_0_batch_1/    # Negative samples (batch 1)
│   │   ├── labeled_1_batch_1/    # Positive samples (batch 1)
│   │   ├── labeled_1_batch_2/    # Positive samples (batch 2)
│   │   └── labeled_1_batch_3/    # Positive samples (batch 3)
│   │
│   └── raw/                      # Raw training images
│       ├── labeled_0/            # Non-target items
│       ├── labeled_1/            # Target items
│       └── dataset.csv           # Image labels and metadata
│
├── models/
│   ├── sticker_sniper_model.h5   # Trained model (legacy)
│   └── sticker_sniper_v1.h5      # Current trained model
│
├── src/
│   ├── notebooks/
│   │   ├── .ipynb_checkpoints/
│   │   ├── dataset_formatting.ipynb       # Data preparation notebook
│   │   ├── model_training_and_testing.ipynb  # Model training workflow
│   │   ├── example_1.png through example_7.png  # Sample images
│   │   └── dataset.csv
│   │
│   └── scripts/
│       ├── .ipynb_checkpoints/
│       │   └── image_augmetation-checkpoint.py
│       ├── data_prep.py          # Data preprocessing utilities
│       └── image_augmetation.py  # Image augmentation pipeline
│
├── app.py                        # Main application entry point
├── README.md                     # This file
└── requirements.txt              # Python dependencies

How It Works

System Architecture

wmremove-transformed-2

Detection Process

  • Screen Capture: The bot continuously captures the defined scan region using the mss library
  • Preprocessing: Images are resized to 64x64 pixels and normalized
  • AI Inference: The TensorFlow CNN model analyzes the image
  • Confidence Threshold: Only predictions above 99.95% confidence trigger actions
  • Instant Execution: When a match is found, the first click executes immediately
  • Sequence Completion: Remaining clicks follow with user-defined delays

Model Architecture

The CNN model is trained to distinguish target marketplace items from non-target items:

  • Input: 64x64x3 RGB images
  • Architecture: Convolutional Neural Network (CNN)
  • Output: Binary classification (0 = no match, 1 = match)
  • Training Data: Positive and negative samples from actual marketplace screenshots[2]

Usage Guide

First-Time Setup

Step 1: Launch the Application

python app.py

You'll see the landing screen:
[PLACEHOLDER: Landing Screen Screenshot]
Click "ENTER CONSOLE" to access the configuration dashboard.

Step 2: Load Your AI Model
[PLACEHOLDER: Model Selection Screenshot]

  • Click "SELECT .H5 MODEL"
  • Navigate to models/ folder
  • Select sticker_sniper_v1.h5 (or your custom model)
  • Button text will update to show the loaded model name

Step 3: Define Scan Area
[PLACEHOLDER: Scan Area Selection Screenshot]

  • Click "SET SCAN AREA (Scroll to Resize)"
  • Your screen will become semi-transparent
  • Position your mouse over the marketplace item display area
  • Scroll or use Arrow Keys to adjust the region size
  • Click to confirm the selection

Best Practices:

  • Keep the scan area small (64x64 to 128x128 pixels) for best performance
  • Position it over the item thumbnail/icon area
  • Ensure the area captures distinctive visual features

Step 4: Record Purchase Sequence
[PLACEHOLDER: Click Sequence Recording Screenshot]

  • Click "RECORD ON SCREEN"
  • Your screen becomes semi-transparent
  • Click each button in order: Purchase → Confirm → Accept, etc.
  • After each click, enter the delay before the next step (e.g., 0.5 seconds)
  • Press Enter when finished

Example Sequence:

  • Step 1: Click "Buy Now" button (x: 960, y: 540) | Wait: 0.5s
  • Step 2: Click "Confirm Purchase" (x: 850, y: 620) | Wait: 0.3s
  • Step 3: Click "Accept" (x: 960, y: 650) | Wait: 0s

Step 5: Configure Auto-Refresh (Optional)
[PLACEHOLDER: Refresh Configuration Screenshot]

  • If your marketplace requires periodic page refreshes:
  • Click "SET REFRESH CLICK" (blue button)
  • Enter refresh interval in seconds (e.g., 5.0)
  • Choose single-click or double-click refresh
  • If double-click, set delay between clicks (e.g., 0.1s)
  • Click on the refresh button location on screen

Refresh Status Indicator:
✓ 2x (delay 0.1s) every 5.0s at (1850, 50)

The bot will automatically click this position every N seconds and pause refreshing when a match is found.
To remove refresh configuration, click the "✕" button.

Step 6: Preview Your Configuration
[PLACEHOLDER: Visual Config Overlay Screenshot]

  • Click "SHOW ACTIVE CONFIG" to see:
    • Green box: Scan area
    • Numbered circles: Click sequence (white)
    • Blue circle with "R": Refresh location (if configured)
  • Press any key or click to close the preview.

Step 7: Start Scanning
[PLACEHOLDER: Active Scanning Screenshot]

  • Click "START AUTO-SCAN" (green button)
  • Status indicators will activate:
    • Scan Indicator (left): Red when scanning
    • Purchase Indicator (right): Green when executing purchase
  • Status text shows: "Scanning Active..."
  • The bot is now monitoring your screen

To stop scanning:
Click the button again (now shows "SCANNING... Click to Stop")

Configuration

Status Indicators

Indicator Color Meaning
Scan Gray Idle
Scan Red Actively scanning
Purchase Gray No match detected
Purchase Green (pulsing) Match found - executing purchase

Saving and Loading Templates

Save Configuration:

  • Click "SAVE" button (top-right)
  • Choose filename (e.g., rare_sticker_config.json)
  • Configuration includes: scan area, click sequence, refresh settings

Load Configuration:

  • Click "LOAD" button (top-right)
  • Select a saved .json template
  • All settings restore instantly

Template Format:

{
    "roi": {
        "top": 400,
        "left": 800,
        "width": 64,
        "height": 64
    },
    "clicks": [
        {"x": 960, "y": 540, "delay": 0.5},
        {"x": 850, "y": 620, "delay": 0.3},
        {"x": 960, "y": 650, "delay": 0.0}
    ],
    "refresh": {
        "x": 1850,
        "y": 50,
        "interval": 5.0,
        "double_click": true,
        "click_delay": 0.1
    }
}

Training Your Own Model

Data Collection

Capture Training Images:

  • Take 100-200 screenshots of your target item (labeled_1)
  • Take 100-200 screenshots of other items (labeled_0)
  • Save as PNG files in data/raw/labeled_1/ and labeled_0/

Organize Dataset:

data/raw/
├── labeled_0/          # Non-target items
│   ├── item_001.png
│   ├── item_002.png
│   └── ...
└── labeled_1/          # Target items
    ├── target_001.png
    ├── target_002.png
    └── ...

Data Preprocessing

Open src/notebooks/dataset_formatting.ipynb:

  • Run all cells to:
    • Resize images to 64x64
    • Generate dataset.csv with labels
    • Split into train/validation sets

Data Augmentation

Run src/scripts/image_augmetation.py:

python src/scripts/image_augmetation.py

This creates augmented versions (rotations, flips, brightness adjustments) in data/processed/.

Model Training

Open src/notebooks/model_training_and_testing.ipynb:
Configure Training:

  • EPOCHS = 50
  • BATCH_SIZE = 32
  • LEARNING_RATE = 0.001

Run Training Cells:

  • Model architecture definition
  • Training loop with validation
  • Performance metrics visualization

Save Model:

model.save('models/my_custom_model.h5')

Model Evaluation

The notebook shows:

  • Training/validation accuracy curves
  • Confusion matrix
  • Sample predictions with confidence scores

Target Performance:

  • Validation accuracy: >99%
  • False positive rate: <0.1%[3]

Troubleshooting

TensorFlow Import Errors

Symptom: ❌ TensorFlow import failed
Error: Python 3.13 is too new for TensorFlow!

Solution: TensorFlow supports Python 3.9-3.12. Downgrade Python:

conda create -n so2bot python=3.11
conda activate so2bot
pip install tensorflow-macos  # macOS Apple Silicon
# OR
pip install tensorflow  # Windows/Linux/Intel Mac

macOS "Application Crashed" on Startup

Symptom: App crashes immediately when double-clicking.
Solution: This is a TensorFlow/PyQt5 import order issue. The code already handles this by importing TensorFlow BEFORE PyQt5. If it still crashes:

# Set environment variable
export KMP_DUPLICATE_LIB_OK=TRUE

# Run from terminal
python app.py

"Module not found" Errors

Symptom: ModuleNotFoundError: No module named 'cv2'
Solution: Install missing dependencies:

pip install opencv-python pyautogui mss numpy PyQt5 tensorflow

Bot Not Clicking / Permissions

Symptom: Bot detects items but doesn't execute clicks.

Solutions:
macOS:

  • System Preferences → Security & Privacy → Accessibility
  • Add Terminal (or Python) to allowed apps
  • Restart the bot

Windows:

  • Run PowerShell/Command Prompt as Administrator
  • Launch bot: python app.py

Linux:

sudo apt-get install python3-tk python3-dev

Low Detection Accuracy

Symptom: Bot triggers on wrong items or misses target items.

Solutions:

  • Retrain with more data: Collect 300+ images of target item. Include variations (different lighting, positions)
  • Adjust confidence threshold: Edit app.py, line ~280:
    if label == 1 and confidence > 0.9995:  # Increase to 0.9998 for stricter
  • Improve scan region: Use smaller, more focused scan area. Ensure it captures unique visual features
  • Check preprocessing: Verify training images match real-time captures. Test with match_N.png debug images saved during detection

High CPU Usage

Symptom: Bot uses 100% CPU continuously.

Solution:

  • Reduce scan frequency: Edit app.py, line ~294:
    time.sleep(0.001)  # Change to 0.005 or 0.01
  • Use smaller scan region: Reduce ROI size to 64x64 or 48x48
  • Close unnecessary applications

Performance Tips

Optimal Settings

  • Scan Region: Size: 64x64 to 96x96 pixels (matches training data). Position: Center on item thumbnail/icon
  • Click Sequence: Minimize delays (0.1-0.5s between steps). First click has 0ms delay for instant execution
  • Refresh Interval: Balance between data freshness and server load. Recommended: 3-10 seconds
  • Confidence Threshold: Default: 99.95% (0.9995). Increase for fewer false positives. Decrease if missing genuine matches

Hardware Recommendations

For best performance:

  • CPU: 4+ cores at 2.5GHz+
  • RAM: 8GB minimum
  • Display: Native resolution (no scaling)
  • Internet: Stable 10Mbps+ connection[4]

Reducing Latency

  • Disable GPU (already configured): os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
  • Close background applications
  • Use wired mouse (wireless can add 5-15ms latency)
  • Disable OS animations:
    • Windows: Settings → Ease of Access → Display → Disable animations
    • macOS: System Preferences → Accessibility → Display → Reduce motion

Limitations

Technical Limitations

  • Display Dependencies: Requires specific screen resolution and UI layout. Model must be retrained if game UI changes. Multi-monitor setups may require ROI adjustment
  • Reaction Time: Theoretical minimum: ~10-50ms from appearance to first click. Actual speed depends on: CPU, scan frequency, model inference time
  • Network latency still applies to server communication
  • False Positives: Model may occasionally misidentify similar-looking items. Adjust confidence threshold to balance speed vs accuracy
  • Platform Support: Tested on Windows 10/11, macOS 12+, Ubuntu 20.04+. Wayland display server on Linux may have compatibility issues

Gameplay Limitations

  • Server-Side Competition: Other players/bots may still purchase faster. Server may process requests in different order. Rate limiting may prevent rapid purchases
  • Item Availability: Bot only works for items visible on screen. Cannot predict new listings. Requires marketplace to be open
  • Account Safety: Using bots may violate game Terms of Service. Risk of account suspension or ban. Use at your own discretion[1]

Contributing

We welcome contributions! Here's how you can help:

Reporting Issues

  • Check existing issues first
  • Provide detailed description:
    • Operating system and version
    • Python version
    • Error messages (full traceback)
    • Steps to reproduce

Submitting Improvements

  • Fork the repository
  • Create feature branch: git checkout -b feature/amazing-feature
  • Commit changes: git commit -m 'Add amazing feature'
  • Push to branch: git push origin feature/amazing-feature
  • Open Pull Request

Areas for Improvement

  • Multi-item detection (scan for multiple targets simultaneously)
  • Cloud-based model training pipeline
  • Mobile device support (iOS/Android)
  • Advanced click patterns (drag, right-click, keyboard inputs)
  • Real-time performance monitoring dashboard
  • Automated A/B testing for confidence thresholds

License

This project is provided "as-is" for educational purposes.
MIT License - See LICENSE file for details.

Disclaimer

IMPORTANT - READ CAREFULLY:
This software is intended for educational and research purposes only. By using this software, you acknowledge and agree that:

Terms of Service Compliance:

  • Using automated tools may violate Standoff 2's Terms of Service
  • You are solely responsible for ensuring compliance with all applicable rules
  • The developers are not liable for any account penalties, suspensions, or bans

No Guarantees:

  • This software is provided "AS IS" without warranty of any kind
  • No guarantee of successful purchases or item acquisition
  • Performance may vary based on hardware, network, and game updates

Ethical Use:

  • Do not use this tool to manipulate markets or harm other players
  • Respect fair play principles within the gaming community
  • Consider the impact of automated tools on game economy

Legal Responsibility:

  • Users are responsible for all actions performed by this software
  • Developers are not liable for any damages, losses, or consequences
  • Use at your own risk

No Support for Malicious Use:
This project does not endorse or support:

  • Account theft or unauthorized access
  • Market manipulation or price fixing
  • Harassment or unfair advantage over other players

We strongly encourage ethical use and respectful participation in the gaming community.

Demo and Screenshots

Video Demonstration

[PLACEHOLDER: Demo Video Link]
Watch the full setup and operation walkthrough: https://youtu.be/YOUR_DEMO_VIDEO_ID

Interface Screenshots

  • Landing Screen: [PLACEHOLDER: Landing screen with version info]
  • Configuration Dashboard: [PLACEHOLDER: Dashboard showing all setup options]
  • Active Scanning: [PLACEHOLDER: Bot running with status indicators lit]
  • Visual Configuration Overlay: [PLACEHOLDER: Transparent overlay showing scan region and click points]

Support

Getting Help

Useful Resources

Acknowledgments

  • TensorFlow team for the ML framework
  • PyQt5 developers for the GUI framework
  • MSS library for efficient screen capture
  • PyAutoGUI for cross-platform automation
  • The open-source community

Changelog

Version 1.3.0 (Current)

  • Added real-time purchase status indicator
  • Enhanced error handling and logging
  • CPU-optimized TensorFlow mode
  • Auto-recovery from scan errors
  • Improved visual configuration overlay
  • Added refresh click functionality (single/double-click)

Version 1.2.0

  • Added template save/load functionality
  • Implemented visual configuration preview
  • Reduced scan loop latency to 1ms
  • Added debug image saving on match

Version 1.1.0

  • Initial public release
  • Basic scan and click automation
  • Custom ROI selection
  • Multi-step click sequences

Built with Python and TensorFlow | Made for Educational Purposes [5]

1 2 3 4 5 6 7 8 9 10

About

An AI-powered automated purchasing tool for the Standoff 2 marketplace that uses computer vision and machine learning to detect and instantly purchase desired items.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages