Lemontropia-Suite/docs/CODEBASE_AUDIT_REPORT.md

487 lines
28 KiB
Markdown

# Lemontropia Suite - Comprehensive Codebase Audit Report
**Date:** 2026-02-11
**Auditor:** Sub-agent Analysis
**Project Path:** `/home/impulsivefps/.openclaw/workspace/projects/Lemontropia-Suite`
---
## 📊 EXECUTIVE SUMMARY
| Category | Count | Status |
|----------|-------|--------|
| **Total Features Implemented** | 28 | ✅ |
| **Wired to Main UI** | 14 | ✅ Connected |
| **Partially Wired** | 3 | ⚠️ Needs Work |
| **Orphaned (Not Wired)** | 11 | 🔌 Not Connected |
---
## 🔍 COMPLETE FEATURE INVENTORY
### 1. CORE MODULES (`core/`)
| Module | Description | Status | Wiring |
|--------|-------------|--------|--------|
| `database.py` | SQLite database management | ✅ Implemented | ✅ Auto-initialized on startup |
| `project_manager.py` | Project CRUD operations | ✅ Implemented | ✅ Full UI integration |
| `log_watcher.py` | Chat.log parsing & events | ✅ Implemented | ✅ Active during sessions |
| `hunting_session.py` | Session state management | ✅ Implemented | ✅ Via project_manager |
| `session_cost_tracker.py` | Cost tracking calculations | ✅ Implemented | ⚠️ Partial (HUD uses simplified) |
| `armor_system.py` | Armor protection calculations | ✅ Implemented | ✅ Via Armor selectors |
| `armor_decay.py` | Armor decay formulas | ✅ Implemented | ✅ Integrated |
| `entropia_nexus.py` | Nexus API client | ✅ Implemented | ✅ Used by gear selectors |
| `nexus_api.py` | Extended Nexus API | ✅ Implemented | ✅ Used by gear selectors |
| `nexus_full_api.py` | Full Nexus API with models | ✅ Implemented | ✅ Used by loadout manager |
| `healing_tools.py` | Healing/FAP calculations | ✅ Implemented | ✅ Via healing selector |
| `attachments.py` | Weapon attachment stats | ✅ Implemented | ✅ Via attachment selector |
| `loadout_db.py` | Loadout database storage | ✅ Implemented | ✅ Used by loadout manager |
### 2. UI COMPONENTS (`ui/`)
| Component | Description | Status | Wiring |
|-----------|-------------|--------|--------|
| `main_window.py` | Primary application window | ✅ Implemented | ✅ Root component |
| `hud_overlay_clean.py` | In-game HUD overlay | ✅ Implemented | ✅ Menu + auto-show on session |
| `hud_overlay.py` | Legacy HUD (superseded) | ✅ Implemented | ❌ Not used (clean version preferred) |
| `loadout_manager_simple.py` | Simplified loadout editor | ✅ Implemented | ✅ Tools menu |
| `loadout_manager.py` | Full loadout manager (legacy) | ✅ Implemented | ❌ Superseded by simple version |
| `loadout_selection_dialog_simple.py` | Pre-session loadout picker | ✅ Implemented | ✅ Auto-shows on Start Session |
| `loadout_selection_dialog.py` | Legacy selection dialog | ✅ Implemented | ❌ Not used |
| `gear_selector.py` | Generic gear selector | ✅ Implemented | ✅ Tools > Select Gear |
| `weapon_selector.py` | Weapon picker | ✅ Implemented | ✅ Via gear selector |
| `armor_selector.py` | Armor picker | ✅ Implemented | ✅ Via gear selector |
| `armor_set_selector.py` | Full armor set picker | ✅ Implemented | ❌ Not directly wired |
| `armor_selection_dialog.py` | Armor selection dialog | ✅ Implemented | ❌ Not directly wired |
| `healing_selector.py` | FAP/Healing picker | ✅ Implemented | ✅ Via gear selector |
| `attachment_selector.py` | Weapon attachments | ✅ Implemented | ✅ Via weapon selector |
| `enhancer_selector.py` | Weapon enhancers | ✅ Implemented | ✅ Via weapon selector |
| `plate_selector.py` | Armor plate picker | ✅ Implemented | ✅ Via armor selector |
| `mindforce_selector.py` | Mindforce chips | ✅ Implemented | ⚠️ Exists but rarely used |
| `accessories_selector.py` | Hunting accessories | ✅ Implemented | ❌ Not wired to main UI |
| `icon_price_dialogs.py` | Icon browser + Price tracker | ✅ Implemented | ❌ **ORPHANED** |
### 3. FEATURE MODULES (`modules/`)
| Module | Description | Status | Wiring |
|--------|-------------|--------|--------|
| `icon_manager.py` | Download/cache item icons | ✅ Implemented | ❌ **ORPHANED** |
| `market_prices.py` | Price tracking & profit calc | ✅ Implemented | ❌ **ORPHANED** |
| `loot_analyzer.py` | Loot breakdown analysis | ✅ Implemented | ❌ **ORPHANED** |
| `crafting_tracker.py` | Crafting session tracker | ✅ Implemented | ❌ **ORPHANED** |
| `game_vision.py` | Screen capture & OCR | ✅ Implemented | ❌ **ORPHANED** |
| `notifications.py` | Discord/Telegram alerts | ✅ Implemented | ❌ **ORPHANED** |
| `auto_screenshot.py` | Auto-capture on events | ✅ Implemented | ❌ **ORPHANED** |
---
## 🔌 WIRING DIAGRAM
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ LEMONTROPIA SUITE MAIN UI │
│ (main_window.py) │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ FILE MENU SESSION MENU VIEW MENU │ │
│ │ ├── New Project ├── Start ├── Show/Hide HUD │ │
│ │ ├── Open Project ├── Stop └── Settings │ │
│ │ └── Exit └── Pause │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ TOOLS MENU │ │
│ │ └── Select Gear ───────────────────────────┐ │ │
│ │ ├── Weapon ───────► weapon_selector.py │ │ │
│ │ ├── Armor ────────► armor_selector.py │ │ │
│ │ ├── Finder ───────► gear_selector.py │ │ │
│ │ └── Medical Tool ─► healing_selector.py│ │ │
│ │ │ │
│ │ └── Loadout Manager ──► loadout_manager_simple.py ◄────┐ │ │
│ │ (Opens for editing/saving loadouts) │ │ │
│ │ │ │ │
│ │ [ORPHANED - NO MENU ENTRY]: │ │ │
│ │ ├── Icon Browser ─────► icon_price_dialogs.py │ │ │
│ │ ├── Price Tracker ────► icon_price_dialogs.py │ │ │
│ │ ├── Loot Analyzer ────► loot_analyzer.py │ │ │
│ │ ├── Crafting Tracker ─► crafting_tracker.py │ │ │
│ │ └── Notification Config► notifications.py │ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────┐ ┌─────────────────────┐ ┌────────────────┐ │
│ │ PROJECT PANEL │ │ SESSION PANEL │ │ LOG PANEL │ │
│ │ ───────────── │ │ ───────────── │ │ ───────── │ │
│ │ List of projects │ │ Start/Stop/Pause │ │ Event log │ │
│ │ Create/View Stats │ │ Status display │ │ Real-time │ │
│ └──────────┬──────────┘ └──────────┬──────────┘ └────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────────┐ ┌──────────────────────────────────────────┐ │
│ │ project_manager.py │ │ Start Session Button Pressed │ │
│ │ database.py │ │ │ │ │
│ │ (CRUD operations) │ │ ▼ │ │
│ └─────────────────────┘ │ loadout_selection_dialog_simple.py │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ User selects loadout ───┐ │ │
│ │ │ │ │
│ │ ┌──────────────────┘ │ │
│ │ ▼ │ │
│ │ Session starts │ │
│ │ │ │ │
│ ▼ ▼ │ │
│ ┌──────────────────────────┐ │ │
│ │ HUD OVERLAY SYSTEM │ │ │
│ │ (hud_overlay_clean.py) │ │ │
│ ├──────────────────────────┤ │ │
│ │ • Live profit/loss │ │ │
│ │ • Return % │ │ │
│ │ • Cost tracking │ │ │
│ │ • Loot tracking │ │ │
│ │ • Gear info │ │ │
│ └────────────┬─────────────┘ │ │
│ │ │ │
│ ▼ │ │
│ ┌──────────────────────────┐ │ │
│ │ log_watcher.py │ │ │
│ │ (parses chat.log) │ │ │
│ └──────────────────────────┘ │ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ ORPHANED FEATURES (Not Wired) │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ ICON MANAGER │ │ MARKET PRICES │ │ LOOT ANALYZER │ │
│ │ ──────────── │ │ ──────────── │ │ ──────────── │ │
│ │ • Download │ │ • Track prices │ │ • Mob stats │ │
│ │ from Wiki │ │ • Calculate │ │ • Category │ │
│ │ • Local cache │ │ profit │ │ breakdown │ │
│ │ • Export icons │ │ • Markup % │ │ • Top loot │ │
│ │ │ │ │ │ • CSV export │ │
│ │ Status: FULLY │ │ Status: FULLY │ │ Status: FULLY │ │
│ │ IMPLEMENTED │ │ IMPLEMENTED │ │ IMPLEMENTED │ │
│ │ NOT ACCESSIBLE │ │ NOT ACCESSIBLE │ │ NOT ACCESSIBLE │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ CRAFTING TRACKER│ │ GAME VISION │ │ NOTIFICATIONS │ │
│ │ ─────────────── │ │ ──────────── │ │ ──────────── │ │
│ │ • Blueprint QR │ │ • Screen capture│ │ • Discord │ │
│ │ • Success rates │ │ • OCR (Paddle) │ │ • Telegram │ │
│ │ • Material inv │ │ • Template match│ │ • Sound alerts │ │
│ │ • Profit calc │ │ • Gear detection│ │ • Custom msgs │ │
│ │ │ │ │ │ │ │
│ │ Status: FULLY │ │ Status: MOSTLY │ │ Status: FULLY │ │
│ │ IMPLEMENTED │ │ IMPLEMENTED │ │ IMPLEMENTED │ │
│ │ NOT ACCESSIBLE │ │ NOT ACCESSIBLE │ │ NOT ACCESSIBLE │ │
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ AUTO SCREENSHOT │ │
│ │ ───────────── │ │
│ │ • Capture on globals/HoFs │ │
│ │ • Region capture │ │
│ │ • Screenshot viewer │ │
│ │ │ │
│ │ Status: FULLY IMPLEMENTED │ │
│ │ NOT ACCESSIBLE │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
---
## 🔴 IDENTIFIED ORPHANED FEATURES
### Critical Priority (High Value, Ready to Wire)
| # | Feature | Module | UI Dialog | Integration Point | Effort |
|---|---------|--------|-----------|-------------------|--------|
| 1 | **Icon Browser** | `icon_manager.py` | `icon_price_dialogs.py` | Tools menu | Low |
| 2 | **Price Tracker** | `market_prices.py` | `icon_price_dialogs.py` | Tools menu | Low |
| 3 | **Loot Analyzer** | `loot_analyzer.py` | Built-in | Session end / Tools menu | Medium |
| 4 | **Auto Screenshot** | `auto_screenshot.py` | Built-in | Settings dialog + events | Medium |
### Medium Priority (Good Value, May Need Work)
| # | Feature | Module | UI Dialog | Integration Point | Effort |
|---|---------|--------|-----------|-------------------|--------|
| 5 | **Notifications** | `notifications.py` | Settings dialog | Settings dialog + event hooks | Medium |
| 6 | **Crafting Tracker** | `crafting_tracker.py` | New dialog needed | Separate crafting mode | High |
### Lower Priority (Niche Use Cases)
| # | Feature | Module | UI Dialog | Integration Point | Effort |
|---|---------|--------|-----------|-------------------|--------|
| 7 | **Game Vision** | `game_vision.py` | Template capture tool | Settings or calibration wizard | High |
| 8 | **Armor Set Selector** | `armor_set_selector.py` | Built-in | Replace armor_selector | Low |
| 9 | **Mindforce Selector** | `mindforce_selector.py` | Built-in | Tools > Select Gear menu | Low |
| 10 | **Accessories Selector** | `accessories_selector.py` | Built-in | Tools > Select Gear menu | Low |
---
## 📋 SPECIFIC WIRING RECOMMENDATIONS
### 1. Icon Browser & Price Tracker (Quick Win)
**Location:** Add to `main_window.py` `create_menu_bar()` Tools menu
```python
# In create_menu_bar() under tools_menu:
tools_menu.addSeparator()
icon_browser_action = QAction("&Icon Browser", self)
icon_browser_action.triggered.connect(self.on_icon_browser)
tools_menu.addAction(icon_browser_action)
price_tracker_action = QAction("&Price Tracker", self)
price_tracker_action.triggered.connect(self.on_price_tracker)
tools_menu.addAction(price_tracker_action)
```
**Add handlers:**
```python
def on_icon_browser(self):
from ui.icon_price_dialogs import IconBrowserDialog
dialog = IconBrowserDialog(self)
dialog.exec()
def on_price_tracker(self):
from ui.icon_price_dialogs import PriceTrackerDialog
dialog = PriceTrackerDialog(self)
dialog.exec()
```
**Effort:** 5 minutes
**Value:** High - Complete UI already exists
---
### 2. Loot Analyzer Integration
**Option A - Session End Report:**
```python
# In on_stop_session() after ending session:
def on_stop_session(self):
# ... existing code ...
# Generate loot analysis
from modules.loot_analyzer import LootAnalyzer
analyzer = LootAnalyzer()
# Load loot from database for this session
loot_data = self.db.get_session_loot(self._current_db_session_id)
for item in loot_data:
analyzer.record_loot(item['name'], item['quantity'],
Decimal(str(item['value'])))
# Show report or save to file
report = analyzer.generate_report()
self.log_info("LootAnalysis", "\n" + report)
analyzer.export_to_csv(Path.home() / ".lemontropia" / "loot_report.csv")
```
**Option B - Tools Menu:**
```python
loot_analyzer_action = QAction("&Loot Analyzer", self)
loot_analyzer_action.triggered.connect(self.on_loot_analyzer)
tools_menu.addAction(loot_analyzer_action)
```
**Effort:** 15-30 minutes
**Value:** High - Session analysis capability
---
### 3. Auto Screenshot Integration
**Add to SettingsDialog:**
```python
# In SettingsDialog setup_ui():
screenshot_group = QGroupBox("Auto Screenshot")
screenshot_layout = QFormLayout(screenshot_group)
self.screenshot_global_cb = QCheckBox("Capture on Global")
self.screenshot_hof_cb = QCheckBox("Capture on HoF")
screenshot_layout.addRow(self.screenshot_global_cb)
screenshot_layout.addRow(self.screenshot_hof_cb)
```
**Wire to events in main_window.py:**
```python
# In _setup_log_watcher_callbacks(), enhance existing handlers:
def on_personal_global(event):
value_ped = event.data.get('value_ped', Decimal('0'))
# ... existing code ...
# Trigger auto-screenshot
if self.auto_screenshot and self.auto_screenshot.on_global:
self.auto_screenshot.on_global("Global", float(value_ped))
```
**Effort:** 20 minutes
**Value:** Medium - Documentation capability
---
### 4. Notifications Integration
**Add to SettingsDialog:**
```python
notifications_group = QGroupBox("Notifications")
notifications_layout = QFormLayout(notifications_group)
self.discord_webhook_edit = QLineEdit()
self.discord_webhook_edit.setPlaceholderText("Discord webhook URL...")
notifications_layout.addRow("Discord:", self.discord_webhook_edit)
self.notify_global_cb = QCheckBox("Notify on Global")
self.notify_hof_cb = QCheckBox("Notify on HoF")
notifications_layout.addRow(self.notify_global_cb)
notifications_layout.addRow(self.notify_hof_cb)
```
**Initialize in MainWindow:**
```python
def __init__(self):
# ... after settings load ...
from modules.notifications import NotificationManager, NotificationConfig
notif_config = NotificationConfig(
discord_webhook=settings.value("notifications/discord", ""),
notify_on_global=settings.value("notifications/on_global", True),
notify_on_hof=settings.value("notifications/on_hof", True)
)
self.notification_manager = NotificationManager(notif_config)
```
**Wire to events:**
```python
def on_personal_global(self, value_ped):
# ... existing code ...
self.notification_manager.on_global("Global", value_ped)
def on_hof(self, value_ped):
# ... existing code ...
self.notification_manager.on_hof("HoF", value_ped)
```
**Effort:** 30 minutes
**Value:** High - External alerts
---
### 5. Crafting Tracker (Separate Mode)
**Recommendation:** Create a "Mode Switcher" in main UI
```python
# Add to main_window.py setup_ui():
mode_layout = QHBoxLayout()
mode_layout.addWidget(QLabel("Mode:"))
self.mode_combo = QComboBox()
self.mode_combo.addItems(["Hunting", "Crafting", "Mining"])
self.mode_combo.currentTextChanged.connect(self.on_mode_changed)
mode_layout.addWidget(self.mode_combo)
main_layout.addLayout(mode_layout)
def on_mode_changed(self, mode):
if mode == "Crafting":
from modules.crafting_tracker import CraftingTracker
self.crafting_tracker = CraftingTracker()
# Show crafting-specific UI
```
**Effort:** 2-4 hours
**Value:** Medium - For crafters
---
## 🛠️ IMPLEMENTATION PRIORITY MATRIX
| Feature | User Value | Dev Effort | Priority | Quick Win? |
|---------|-----------|------------|----------|------------|
| Icon Browser | High | Low | **P1** | ✅ Yes |
| Price Tracker | High | Low | **P1** | ✅ Yes |
| Loot Analyzer | High | Medium | **P2** | ⚠️ Medium |
| Auto Screenshot | Medium | Medium | **P2** | ⚠️ Medium |
| Notifications | High | Medium | **P2** | ⚠️ Medium |
| Crafting Tracker | Medium | High | **P3** | ❌ No |
| Game Vision | Medium | High | **P3** | ❌ No |
---
## 📁 FILE STRUCTURE REFERENCE
```
projects/Lemontropia-Suite/
├── main.py # CLI entry point
├── gui_main.py # GUI launcher stub
├── ui/
│ ├── main_window.py ✅ WIRED - Main UI
│ ├── hud_overlay_clean.py ✅ WIRED - Active HUD
│ ├── hud_overlay.py ❌ Legacy (unused)
│ ├── loadout_manager_simple.py ✅ WIRED - Tools menu
│ ├── loadout_manager.py ❌ Legacy (unused)
│ ├── icon_price_dialogs.py ❌ ORPHANED - Ready to wire
│ ├── gear_selector.py ✅ WIRED
│ ├── weapon_selector.py ✅ WIRED
│ ├── armor_selector.py ✅ WIRED
│ ├── healing_selector.py ✅ WIRED
│ ├── armor_set_selector.py ⚠️ Partially wired
│ ├── armor_selection_dialog.py ❌ Unused
│ ├── attachment_selector.py ✅ WIRED
│ ├── enhancer_selector.py ✅ WIRED
│ ├── plate_selector.py ✅ WIRED
│ ├── mindforce_selector.py ❌ ORPHANED
│ ├── accessories_selector.py ❌ ORPHANED
│ └── ...
├── core/
│ ├── database.py ✅ WIRED
│ ├── project_manager.py ✅ WIRED
│ ├── log_watcher.py ✅ WIRED
│ ├── session_cost_tracker.py ⚠️ Partially used
│ └── ...
└── modules/
├── icon_manager.py ❌ ORPHANED
├── market_prices.py ❌ ORPHANED
├── loot_analyzer.py ❌ ORPHANED
├── crafting_tracker.py ❌ ORPHANED
├── game_vision.py ❌ ORPHANED
├── notifications.py ❌ ORPHANED
└── auto_screenshot.py ❌ ORPHANED
```
---
## ✅ CONCLUSION
### What's Working Well
- **Core hunting loop** is fully functional (Projects → Sessions → HUD)
- **Loadout system** is well-integrated with cost tracking
- **Log parsing** is robust with event detection
- **HUD overlay** provides real-time session metrics
### Quick Wins (Do These First)
1. **Wire Icon Browser** - 5 minutes, complete UI exists
2. **Wire Price Tracker** - 5 minutes, same dialog file
3. **Add Loot Analyzer report** on session end
4. **Add Notifications settings** with Discord/Telegram
### Technical Debt
- Two versions of HUD exist (clean version preferred)
- Two versions of loadout manager exist (simple version preferred)
- Some selectors exist but aren't in the Select Gear menu
### Estimated Time to Full Integration
- **Minimum viable:** 1 hour (Icon Browser + Price Tracker)
- **Recommended:** 2-3 hours (+ Loot Analyzer + Auto Screenshot)
- **Complete:** 1-2 days (+ Notifications + Crafting + Vision)
---
*Report generated by Sub-agent on 2026-02-11*