Commit Graph

236 Commits

Author SHA1 Message Date
LemonNexus 1a0c0d4231 feat: add Inventory Scanner for extracting item icons and stats
- New module: modules/inventory_scanner.py
  - Detects inventory and item details windows
  - Extracts item icons from inventory grid
  - Reads item stats from details panel
  - Parses weapon, armor, and common stats
  - Handles scrolling (planned for future)

- New dialog: ui/inventory_scanner_dialog.py
  - Visual interface for scanning
  - Shows extracted icons in grid view
  - Displays item stats in table
  - Saves results to JSON
  - Background worker for non-blocking scans

- Updated main_window.py:
  - Added Tools → Computer Vision → Inventory Scanner (Ctrl+I)
  - Integrated with existing GameVisionAI

This allows users to extract item data from Entropia Universe
for gear management and loadout configuration.
2026-02-11 15:19:56 +00:00
LemonNexus 27b3bd0fe1 feat: comprehensive settings dialog and UI cleanup
- Create new ui/settings_dialog.py with tabbed interface
- Tabs: General, Screenshot Hotkeys, Computer Vision, Advanced
- Remove old SettingsDialog from main_window.py
- Update on_settings() to use new comprehensive dialog
- Screenshot hotkey settings now in Settings (Ctrl+,)
- Computer Vision settings now in Settings dialog
2026-02-11 13:26:31 +00:00
LemonNexus 53f7896dfa fix: screenshot thread safety - use fresh mss context per capture
- Remove persistent mss.mss() instance from AutoScreenshot
- Use context manager 'with mss.mss() as sct:' for each capture
- Fixes '_thread._local' object has no attribute 'srcdc' error
- Allows screenshots to work from hotkey callbacks in background threads
2026-02-11 13:14:44 +00:00
LemonNexus b06b98e6cc fix: change TIMESTAMP columns to TEXT to avoid SQLite auto-conversion errors
SQLite's TIMESTAMP type causes auto-conversion issues when data is in ISO format
- Changed all TIMESTAMP columns to TEXT in schema.sql
- Disabled detect_types in database.py to prevent auto-conversion
- This stores datetime as ISO strings without parsing issues
2026-02-11 13:13:55 +00:00
LemonNexus 381c0e2b50 fix: template and session loading - convert rows to lists before accessing
- Convert sqlite3.Row to list before accessing by index
- Add detailed debug logging for troubleshooting
- Fix fromisoformat error by checking for None values
- Add try/except around each row to skip bad data
2026-02-11 13:00:10 +00:00
LemonNexus 5a76c64b2f fix: template loading - use index-based row access to avoid unpack error
- Changed from dict-style access (proj['type']) to index access (proj[0])
- Added try/except around each row processing to skip bad rows
- Added detailed error logging with traceback
- Handle cases where row has fewer columns than expected
2026-02-11 12:58:21 +00:00
LemonNexus 91a8da3910 fix: template selection - add placeholder item and improve selection
- Add '-- Select a template --' as first item in combo box
- Block signals while refreshing to prevent unwanted callbacks
- Select newly created template automatically
- Fix index check to skip placeholder (index > 0 instead of >= 0)
- Add enable/disable based on whether templates exist
2026-02-11 12:57:23 +00:00
LemonNexus f403f3edfe fix: screenshot hotkeys - use Qt shortcuts + optional global hotkeys
- Rewrote screenshot_hotkey.py to use Qt QShortcut as primary method
- Qt shortcuts work reliably when app is focused (no admin needed)
- Added optional 'keyboard' library for global hotkeys (requires admin)
- Updated main_window.py to pass parent window to hotkey manager
- Shows clear status: global vs Qt-only mode
- Users can now press F12 etc when app is focused
2026-02-11 12:55:24 +00:00
LemonNexus 21c2508842 fix: hotkey parsing and initialization order
- Use pynput format <f12>, <shift>+<f12> etc for hotkey parsing
- Initialize screenshot hotkeys AFTER UI setup (fixes log_output error)
- Clean up hotkey display in help text (remove angle brackets)
2026-02-11 12:37:12 +00:00
LemonNexus 299b1e0fa5 fix: correct screenshot directory path for hotkey manager
ScreenshotCapture doesn't have screenshot_dir attribute - use Path directly
2026-02-11 12:34:13 +00:00
LemonNexus 9c6ad18c2b chore: add pynput to requirements for screenshot hotkeys 2026-02-11 12:32:14 +00:00
LemonNexus 286d3b4f5c feat: add screenshot hotkey manager for manual game capture
- Add modules/screenshot_hotkey.py with global hotkey listener using pynput
- Default hotkeys: F12=Full, Shift+F12=Region, Ctrl+F12=Loot, Alt+F12=HUD
- Integrate into main_window.py with Settings dialog
- Hotkeys work globally (even when game is focused)
- Add Tools → Screenshot Hotkeys menu (Ctrl+Shift+S)
- Shows status message when screenshot is captured
2026-02-11 12:31:59 +00:00
LemonNexus 1ff64ac53f feat: add OpenCV GPU text detection as fallback to PaddleOCR
Based on PyImageSearch article: https://pyimagesearch.com/2022/03/14/improving-text-detection-speed-with-opencv-and-gpus/

- Add opencv_text_detector.py using EAST model with CUDA support
- OCRProcessor now uses PaddleOCR first, falls back to OpenCV
- OpenCV text detection: ~97 FPS on GPU vs ~23 FPS on CPU (4x faster)
- No heavy dependencies (PyTorch/PaddlePaddle) required for OpenCV mode
- Auto-downloads EAST model on first use
2026-02-11 12:26:12 +00:00
LemonNexus 786b292fcd fix: import torch before PyQt to fix DLL loading on Windows
- Add early torch import before PyQt6 imports in main_window.py
- This prevents the c10.dll initialization error on Windows
- Solution 3 from user research: import torch before PyQt
2026-02-11 12:12:57 +00:00
LemonNexus 049a59136d fix: update verify_vision.py for Python 3.13 compatibility
- Use latest PyTorch versions (old ones don't exist for Python 3.13)
- Install PaddleOCR without PyMuPDF (avoids build errors)
- Skip PyMuPDF which requires Visual Studio build tools
2026-02-11 11:54:01 +00:00
LemonNexus b9ff965185 fix: add PyTorch fix scripts and make torch import optional
- Add fix_pytorch.bat for Windows users to repair PyTorch installation
- Add verify_vision.py to check and auto-fix vision dependencies
- Make torch import optional in game_vision_ai.py to prevent crashes
- Provides graceful fallback if PyTorch fails to load
2026-02-11 11:49:58 +00:00
LemonNexus 92558d3e49 feat: wire Computer Vision features to UI menu
- Add Computer Vision submenu under Tools menu
- Add Vision Settings, Calibrate Vision, and Test Vision actions
- Add handler methods: on_vision_settings, on_vision_calibrate, on_vision_test
- Features accessible via Tools -> Computer Vision
2026-02-11 11:44:04 +00:00
LemonNexus 1ef6b0c0a1 fix: add QCheckBox import and fix sqlite3.Row access
- Add missing QCheckBox to PyQt6.QtWidgets import
- Fix sqlite3.Row access - use 'in row.keys()' instead of .get()
- Fixes template and session loading errors
2026-02-11 11:36:21 +00:00
LemonNexus 522ee8e719 feat: add AI Computer Vision with local GPU support
- modules/game_vision_ai.py - Main AI vision engine with OCR and icon detection
- modules/icon_matcher.py - Icon similarity matching using perceptual hashing
- ui/vision_settings_dialog.py - GPU/OCR settings panel
- ui/vision_calibration_dialog.py - Calibration wizard
- ui/vision_test_dialog.py - Test and debug dialog
- vision_example.py - Usage examples
- Update requirements.txt with paddlepaddle, opencv, torch dependencies

Features:
- GPU auto-detection (CUDA, MPS, DirectML)
- PaddleOCR for text extraction (English/Swedish)
- Icon detection from loot windows
- Icon matching against database
- Real-time screenshot processing
2026-02-11 11:29:10 +00:00
LemonNexus 82a7a5fc86 fix: add status column to sessions table in schema.sql for new databases 2026-02-11 10:50:46 +00:00
LemonNexus e86dd7c358 fix: add status column to sessions table via migration 2026-02-11 10:49:39 +00:00
LemonNexus 8a38d39648 fix: add missing List import from typing module 2026-02-11 10:46:54 +00:00
LemonNexus 00d7445c26 fix: add fetchall() and fetchone() helper methods to DatabaseManager
- Code was calling db.fetchall() and db.fetchone() but these methods didn't exist
- Add helper methods that execute query and return results
- Fixes template loading and other database operations
2026-02-11 10:45:42 +00:00
LemonNexus 91971d2268 fix: correct method name for getting selected plate in loadout manager 2026-02-11 10:41:01 +00:00
LemonNexus f1ac4c22c5 fix: align ActivityType enum with database schema values
- ActivityType enum now uses 'hunt', 'mine', 'craft' to match database CHECK constraint
- Setup wizard activity_combo uses correct database values
- Fixes CHECK constraint failed error when creating projects
2026-02-11 10:39:51 +00:00
LemonNexus e9378f2176 fix: add description column to projects table with migration
- Add description column to projects table in schema.sql
- Add _run_migrations() method to handle schema updates
- Migration automatically adds description column to existing databases
2026-02-11 10:35:36 +00:00
LemonNexus c9c859fbf3 fix: block signals in Session History to prevent recursion 2026-02-11 10:33:10 +00:00
LemonNexus 396a5451ac fix: resolve Setup Wizard and Gallery dialog bugs
- Fix recursion error in GalleryDialog by blocking signals during session filter updates
- Fix missing 'avatar_name' field in SetupWizard by registering the field properly
- Both dialogs should now work without errors
2026-02-11 10:28:04 +00:00
LemonNexus c347b5d28e feat: major update - UI redesign, Session History, Gallery, Enhanced Loadout Manager
=== UI REDESIGN ===
- Rename Project Management to Activity History
- Add Setup Wizard for first-run configuration
- Reorganize layout: Activity Setup | Session Control | Recent Sessions
- Add prominent Loadout Manager button
- Add Activity Types (Hunting/Mining/Crafting)

=== SESSION HISTORY & GALLERY ===
- New SessionHistoryDialog (Ctrl+H) - view/export past sessions
- New GalleryDialog (Ctrl+G) - browse screenshots
- Auto-screenshot on globals and HoFs
- Screenshots saved to data/screenshots/

=== ENHANCED LOADOUT MANAGER ===
- Add Weapon Amplifier support
- Add Armor Plating support
- Add Mindforce Implant support
- New AmplifierSelector dialog
- Full cost calculations for all gear types

=== NEW FILES ===
- ui/setup_wizard.py
- ui/session_history.py
- ui/gallery_dialog.py
- ui/amplifier_selector.py
- docs/CODEBASE_AUDIT_REPORT.md

=== MODIFIED FILES ===
- ui/main_window.py - major restructuring
- ui/loadout_manager_simple.py - enhanced gear support
- gui_main.py - first-run wizard check
2026-02-11 10:23:21 +00:00
LemonNexus c93b57aec4 fix: count weapon cost when target evades/dodges your attack
- Check evade type for 'target Evaded' or 'target Dodged'
- Count weapon cost on those events (you fired but missed)
- Armor decay still only counted on actual damage taken
- Fixes: weapon cost now accurate for all shots including misses
2026-02-11 09:52:11 +00:00
LemonNexus 48bd83dade fix: adjust armor decay formula to ~0.025 PEC per damage
- Changed from 0.0005 to 0.00025 PED per damage (0.025 PEC)
- Based on user feedback: 504 damage should give ~0.14 PED decay
- Removed complex fallback logic, using simple accurate formula
- Formula: damage * 0.00025 = armor decay in PED
2026-02-11 09:44:52 +00:00
LemonNexus 6e425f2c06 fix: move _load_settings() after setup_ui() to fix AttributeError
- log_info() needs log_output which is created in setup_ui()
- Move _load_settings() call to after UI initialization
- Fixes 'MainWindow' object has no attribute 'log_output' error
2026-02-11 09:15:57 +00:00
LemonNexus 5837333d69 feat: add persistent settings for avatar name
- Add QSettings import from PyQt6.QtCore
- Add _load_settings() method to load player name on startup
- Add _save_settings() method to save player name when settings change
- Settings stored in Lemontropia/Suite registry/file
- Player name now persists between app launches
2026-02-11 09:08:04 +00:00
LemonNexus a216afde2d fix: calculate armor decay based on actual damage absorbed
- Use formula: Decay (PED) = damage * 0.0005 (approx 0.05 PEC per damage)
- This matches EU armor decay formula better than flat cost per hit
- 1966 damage would give ~0.98 PED decay (not 22 PED)
- Falls back to cost_per_hit if armor stats not available
2026-02-10 15:29:50 +00:00
LemonNexus 6d8f710244 fix: add comma to loot regex patterns for items like 'Dominax Original Garter, Adjusted (L)'
- Add comma (,) to character class in PATTERN_LOOT_EN and PATTERN_LOOT_SV
- Add comma (,) to PATTERN_LOOT_NO_VALUE_EN and PATTERN_LOOT_NO_VALUE_SV
- Fixes items with commas in their names not being tracked
2026-02-10 15:13:21 +00:00
LemonNexus e4fd75e2a7 fix: save HUD costs to database on session end
- Save weapon_cost_total, armor_cost_total, healing_cost_total to decay_events
- This ensures core profit calculation matches HUD display
- Insert decay events before calling end_session
- Log the saved costs for verification
2026-02-10 14:52:32 +00:00
LemonNexus 6d99d357ab fix: pause/resume now stops HUD tracking
- Set hud.session_active = False when paused
- Set hud.session_active = True when resumed
- Update HUD status label to show paused state (orange)
- Prevents loot/costs from being tracked during breaks
2026-02-10 14:49:31 +00:00
LemonNexus fe0858ebfa fix: correct kill counting logic
- Remove separate update_kills() call from on_loot handler
- Let update_loot() handle kill counting internally
- Only increment kills when >2 second gap since last loot
- Add is_new_kill flag to track new mobs vs multi-item drops
- Add debug logging for kill counting
2026-02-10 14:37:46 +00:00
LemonNexus 4db34c2c2c fix: use batched timer-based refresh instead of signals
- Replace signal/slot approach with QTimer-based batched updates
- Add _refresh_pending flag and _request_refresh() method
- Refresh timer runs at 10Hz (100ms) on main thread
- Prevents race conditions and thread safety issues
- All update methods now just set the pending flag
2026-02-10 14:31:45 +00:00
LemonNexus bd40d3d5e0 fix: remove dynamic setStyleSheet calls to prevent parsing errors
- Remove dynamic color changes from _refresh_display
- Use fixed colors set during widget creation
- Just update text values in _refresh_display
- Prevents 'Could not parse stylesheet' errors
2026-02-10 14:29:42 +00:00
LemonNexus 63f215a3a1 fix: use signal/slot for thread-safe GUI updates
- Add refresh_needed signal to HUDOverlay
- Connect signal to _refresh_display with QueuedConnection
- Update all update methods to emit signal instead of calling _refresh_display directly
- This ensures all GUI operations (setStyleSheet, setText) happen on main thread
- Fixes crash caused by GUI operations from LogWatcher thread
2026-02-10 14:27:33 +00:00
LemonNexus 0a6e4358de fix: wrap setStyleSheet in try/except to prevent stylesheet crash
- Add inner try/except around setStyleSheet calls
- Catch and ignore stylesheet parsing errors
- Prevents 'Could not parse stylesheet' crash
2026-02-10 14:22:38 +00:00
LemonNexus b14888dc97 feat: add total skill gained tracking to HUD
- Add show_skills config option to HUDConfig
- Add total_skill_gained and skill_gains fields to HUDStats
- Add skills display section in HUD UI (purple box)
- Add update_skill() method to track skill gains
- Update on_skill handler in main_window.py to call update_skill()
- Add skills checkbox to HUD settings dialog
- Fix duplicate code in _refresh_display method
- Update to_dict/from_dict for skills config persistence
2026-02-10 14:19:56 +00:00
LemonNexus ecf27a504c fix: add missing logger import at top of main_window.py
- Import logging module
- Create logger instance for use in event handlers
- Fixes 'name logger is not defined' errors
2026-02-10 14:15:44 +00:00
LemonNexus 818d0f98f3 fix: add missing _session_costs initialization and verbose debug logging
- Initialize _session_costs and _session_display in __init__ (was causing crashes)
- Add [EVENT], [HUD], [DEBUG], [ERROR] prefix logging to all event handlers
- Add traceback logging for better debugging
- Add debug logging to all HUD update methods
- Log session_active state in HUD methods
2026-02-10 14:11:05 +00:00
LemonNexus b8bd462d09 fix: add error handling to prevent stylesheet crash in _refresh_display
- Wrap entire _refresh_display in try/except
- Check widget exists before setting stylesheet
- Log errors instead of crashing
2026-02-10 14:02:29 +00:00
LemonNexus e17f7e3565 fix: properly wire cost tracking and loot tracking to new HUD
- Add weapon cost tracking on damage_dealt using session_costs
- Add armor cost tracking on damage_taken using session_costs
- Fix on_loot to use update_kills() and update_loot() with proper params
- Fix on_heal to use update_healing_cost() and on_heal_event() with proper params
- All cost tracking now uses _session_costs from loadout selection
2026-02-10 13:57:41 +00:00
LemonNexus c0cb42cd54 fix: use new clean HUD overlay (hud_overlay_clean.py)
- Change import from hud_overlay to hud_overlay_clean
- New HUD has better layout, customizable sections, Cost/Loot/Highest display
2026-02-10 13:51:13 +00:00
LemonNexus 303bb3b538 fix: remove calls to non-existent methods and add error handling
- Remove update_cost calls (method doesn't exist in new HUD)
- Remove update_stats with shots_add (not implemented)
- Add try/except to all event handlers to prevent crashes
- Simplify damage tracking to just update_damage methods
2026-02-10 13:50:24 +00:00
LemonNexus 90595a8ebe feat: add player name setting for accurate global tracking
- Settings dialog now has Avatar Name field
- Store player_name in MainWindow
- Filter personal globals to only count if player name matches
- Warn user if no player name is configured
- Log other players' globals separately
2026-02-10 13:40:42 +00:00