# Magic Garden Bot An advanced browser extension for automating and enhancing gameplay in **Magic Garden**. This bot injects a powerful utility sidebar directly into the game, offering automation features, real-time data visualization, and smart decision-making assistance. ## ✨ Key Features ### 🤖 Automation - **Auto Plant**: Automatically replants crops in empty tiles. - **Auto Harvest**: Harvests crops when they are ready. - **Smart Harvest**: Uses advanced decision logic (Bellman Equation) to wait for optimal crop mutations (e.g., waiting for specific weather conditions to maximize value) before harvesting. - **Auto Sell**: Automatically sells harvested resources to free up inventory space. - **Auto Feed Pets**: Keeps your equipped pets fed with the cheapest compatible food from your inventory. ### 🖥️ User Interface The bot features a clean, dark-themed UI that blends into the game. - **Control Panel**: A sidebar for toggling specific automation features on/off. - **Overlays**: Draggable, floating windows for deeper insight: - **Garden Overlay**: Visual representation of plot status. - **Inventory Overlay**: Filterable view of your items. - **Shop Overlay**: Quick view of shop contents. - **Players Overlay**: See other players in the vicinity. - **Pets Overlay**: Manage your pets, view hunger levels, and toggle auto-feed per pet. - **Model/Decision Overlay**: Visualizes the decision boundary for "Smart Harvest," showing potential value vs. current value. ### 🛠️ Visualizers & Logs - **Log Viewer**: Searchable log of bot actions and network traffic. - **Network Filtering**: specific filters to inspect socket message traffic. ## 🚀 Installation 1. Clone or download this repository. 2. Open Chrome (or a Chromium-based browser) and navigate to `chrome://extensions`. 3. Enable **Developer Mode** (toggle in the top right). 4. Click **Load unpacked**. 5. Select the `extension` folder from this project. 6. Navigate to [Magic Garden](https://magicgarden.gg/) (the bot will load automatically). ## 🎮 Usage ### Controls - **Toggle UI**: Press `Insert` or `Backquote` (`` ` ``) to show/hide the sidebar. - **Sidebar**: Click the arrow icons to expand/collapse sections. - **Overlays**: Windows are draggable. Close them with the `X` button. ### Configuration Automation settings are adjustable in the sidebar. "Smart Harvest" can be toggled to prioritize long-term value over immediate harvesting. ## 🏗️ Development ### Project Structure - `extension/manifest.json`: Extension configuration. - `extension/content_loader.js`: Entry point that injects the bot. - `extension/modules/`: Core logic modules. - `main.js`: Central loop and event orchestration. - `decision.js`: Logic for Smart Harvest valuations. - `ui/`: UI components and style definitions. - `ui_manager.js`: Manages the sidebar and overlays. - `overlays/`: Individual overlay implementations (Pets, Inventory, etc.). ### Permissions The extension requires: - `activeTab` & `scripting`: To inject the bot into the game page. - Host permissions for `magicgarden.gg`.