Commit Graph

221 Commits

Author SHA1 Message Date
LemonNexus 61d2ad2019 fix: add missing UI elements for damage stats and shrapnel
- Add damage_dealt and damage_taken to HUDStats
- Add shrapnel_total to HUDStats
- Add UI elements for damage stats in _setup_ui
- Add UI element for shrapnel in _setup_ui
- Update window size calculation for new elements
- Update _refresh_display to show damage and shrapnel
- Add update_damage() and update_shrapnel() public methods
2026-02-09 22:52:33 +00:00
LemonNexus 5c4ce8f307 feat: add total cost display to HUD
- Add show_total_cost config option (enabled by default)
- Add total cost row between P/L and cost metrics
- Add Total Cost checkbox to settings dialog
- Update window size calculation for total cost row
- Update _refresh_display to show total cost
2026-02-09 22:49:10 +00:00
LemonNexus 4c084bd0cd fix: HUD rebuild stability and end_session compatibility
- Add end_session() as alias for stop_session() for backward compatibility
- Use delayed rebuild with QTimer.singleShot to avoid UI glitches
- Add container.show() at end of _setup_ui to ensure visibility
- Add error handling in _do_rebuild for recovery
2026-02-09 22:45:14 +00:00
LemonNexus f9b4d9a44b fix: add missing weapon_dpp and weapon_cost_per_hour parameters to start_session
- Added for backward compatibility with main_window.py
- These parameters are accepted but not used in the clean HUD
- Fixes TypeError when starting session
2026-02-09 22:41:49 +00:00
LemonNexus cd5f03c002 fix: HUD overlay initialization order and rebuild logic
- Create container before calling _update_window_size in _setup_ui
- Fix _rebuild_ui to delete and recreate container properly
- Add VISION_PLAN.md with comprehensive computer vision/OCR plan
2026-02-09 22:38:49 +00:00
LemonNexus 60fbf8d257 feat: new clean customizable HUD overlay
- hud_overlay_clean.py: Completely redesigned HUD
- Default view shows only essentials (P/L, Return %, Cost metrics, Gear)
- Optional stats hidden by default (cost breakdown, combat, damage)
- Settings button (⚙️) to customize visible elements
- Compact mode option
- Auto-sizing based on enabled features
- HUD_REDESIGN.md: Documentation and migration guide
2026-02-09 22:34:16 +00:00
LemonNexus 2959bfff89 fix: use loadout's cost_per_hit instead of armor decay tracker lookup
- Disable ArmorDecayTracker (it requires armor to be in hardcoded database)
- Use cost_per_hit from loadout directly when damage is taken
- This allows any armor to work, not just ones in the database
- Simplified approach: pre-calculate costs in loadout, use during session
2026-02-09 22:29:05 +00:00
LemonNexus 6cc10b14f1 fix: HUD drag functionality - auto-manage click-through mode
- Don't enable click-through on show (allows initial interaction)
- Disable click-through when mouse enters HUD (allows clicking/dragging)
- Enable click-through when mouse leaves (so HUD doesn't block game)
- Remove duplicate leaveEvent handler
- User can now hold Ctrl and drag without issues
2026-02-09 22:27:33 +00:00
LemonNexus ff31c68a44 fix: use ammo_burn and range_val in loadout_manager_simple _set_weapon
- weapon.ammo -> weapon.ammo_burn
- weapon.range -> weapon.range_val
2026-02-09 22:23:37 +00:00
LemonNexus ab266e9da9 fix: remove duplicate old code in weapon_selector _on_select
- Remove duplicate code block that used 'ammo' instead of 'ammo_burn'
- The old code was left behind after adding try/except wrapper
2026-02-09 22:21:23 +00:00
LemonNexus 32a858a3f5 fix: add safe_decimal/safe_int helpers to handle null API values
- Add safe_decimal() and safe_int() helper functions at module level
- Update NexusWeapon.from_api to use safe_decimal for all fields
- Update NexusArmor.from_api to use safe_decimal/safe_int
- Update NexusPlate.from_api to use safe_decimal
- Update NexusEnhancer.from_api to use safe_decimal/safe_int
- Remove duplicate safe_decimal definition
- This fixes decimal.ConversionSyntax errors from null/invalid API values
2026-02-09 22:12:36 +00:00
LemonNexus 3ae25503d6 fix: comprehensive null/invalid value handling in weapon selector
- Add detailed logging for skipped weapons
- Handle 'null', 'None', empty strings in decay/ammo values
- Safe Decimal conversion with try/except blocks
- Safe tooltip formatting for all weapon fields
- Safe preview update with error handling
2026-02-09 22:06:31 +00:00
LemonNexus f6ec57d2a2 fix: better error logging and validation in weapon selector
- Add debug logging for skipped weapons
- Handle empty strings and 'null' values
- Verify all files use correct API attribute names
2026-02-09 22:01:02 +00:00
LemonNexus d8b6ef998d fix: correct API attribute names in selectors
- weapon_selector: use ammo_burn (not ammo), range_val (not range)
- armor_selector: use id (not set_id)
- healing_selector: use get_all_healing_tools/get_all_healing_chips
- Add safe null handling for all API values
2026-02-09 21:59:46 +00:00
LemonNexus 5a9ffe5fb8 fix: correct import and handle null values in selectors
- loadout_manager_simple: use ArmorSelectorDialog (not ArmorSelectionDialog)
- weapon_selector: handle null/invalid decay/ammo values from API
- Add safe Decimal conversion with InvalidOperation handling
- Filter out weapons with invalid data before populating list
2026-02-09 21:56:33 +00:00
LemonNexus fe5efa181d fix: add missing selector dialogs for simplified loadout manager
- weapon_selector.py: Simple weapon selection with cost preview
- armor_selector.py: Armor set selection with decay estimation
- healing_selector.py: Healing tool selection with economy info
- All selectors calculate cost per use in real-time
- Search/filter functionality for quick finding
2026-02-09 21:51:54 +00:00
LemonNexus cdc9f5b825 refactor: simplified cost-focused Loadout Manager
- New LoadoutManagerSimple with clean cost-focused design
- LoadoutConfig now stores only: cost_per_shot/hit/heal + display names
- Legacy format support for backward compatibility
- Simplified LoadoutSelectionDialog with clear cost preview
- Updated MainWindow to use new simplified structure
- Removed 3 overlapping armor systems, replaced with single decay value
- JSON serialization is now simple and reliable

Key principle: Only store what's needed for cost tracking.
2026-02-09 21:41:55 +00:00
LemonNexus 83084252cc fix: save and load new armor system fields properly
- _get_current_config now includes new armor fields
- to_dict properly serializes current_armor_decay as string
- from_dict properly deserializes new armor fields
- _set_config restores new armor fields when loading
- Armor decay now flows from LoadoutManager to session
2026-02-09 21:21:32 +00:00
LemonNexus 0c843df4a7 fix: fix to_dict to handle new armor system fields
- Properly serialize current_armor_protection (ProtectionProfile)
- Properly serialize current_armor_pieces (list of ArmorPiece)
- Convert Decimals to strings for JSON serialization
2026-02-09 21:11:24 +00:00
LemonNexus 877ee96bcc fix: add new armor fields to LoadoutConfig and fix label references
- Added current_armor_set_name, current_armor_pieces, current_armor_protection, current_armor_decay to LoadoutConfig
- Fixed armor_set_label reference to use armor_summary_label
- Added hasattr checks for backward compatibility with old save files
2026-02-09 21:06:39 +00:00
LemonNexus 67eaf2d6a7 feat: rewrite armor system to use API-based sets with proper decay
- Created new ArmorSelectionDialog with two tabs:
  1. Full Armor Sets: Browse and select complete sets from API
  2. Custom Set: Build custom sets from individual pieces
- Armor sets show proper protection and decay per hit
- Decay calculated using official formula: 0.05 * (1 - durability/100000)
- New armor data flows correctly to session cost tracking
- Removed old hardcoded armor set methods
2026-02-09 21:00:43 +00:00
LemonNexus ca8f9f8eb3 fix: pass full loadout info to session and display gear names in HUD
- Updated loadout_selected signal to emit dict with full loadout info
- _on_loadout_selected_for_session now extracts weapon/armor/healing names
- HUD now shows gear names from selected loadout
- Cost tracker skipped for JSON-based loadouts (need DB save first)
2026-02-09 20:50:26 +00:00
LemonNexus d7f1e61533 feat: connect loadout selection to session cost tracking
- start_session now uses _session_loadout_name for HUD display
- Added _setup_session_cost_tracker to initialize SessionCostTracker
- Added _on_cost_update callback to update HUD with live costs
- Loadout name now appears in HUD instead of 'Default'
2026-02-09 20:44:28 +00:00
LemonNexus 43657eaf1e fix: correct cost calculations in loadout selection dialog
- weapon_decay_pec is in PEC (divide by 100 to get PED)
- weapon_ammo_pec is ammo count (multiply by 0.0001 to get PED)
- armor_decay_pec is in PEC (divide by 100 to get PED)
- heal_cost_pec is in PEC (divide by 100 to get PED)
2026-02-09 20:37:52 +00:00
LemonNexus f5a0cf1514 debug: add debug output to trace cost calculation issue in loadout selection 2026-02-09 20:34:04 +00:00
LemonNexus 2c2249f45e fix: loadout selection dialog now reads from both database and JSON files
- Added support for loading JSON-saved loadouts
- Dialog now scans ~/.lemontropia/loadouts/ directory
- Displays both database and file-based loadouts
- Calculates costs from JSON data for preview
2026-02-09 20:30:00 +00:00
LemonNexus c71f6a8647 feat: add loadout selection dialog when starting session
- Modified on_start_session to show LoadoutSelectionDialog first
- Added _on_loadout_selected_for_session callback
- User can now select a loadout or skip before session starts
- Selected loadout info is logged and stored for session
2026-02-09 20:26:51 +00:00
LemonNexus fb0d1b4e40 fix: add mindforce_decay_pec to decimal_fields in LoadoutConfig.from_dict
- Was causing 'Decimal + str' error when loading saved loadouts
- Added 'mindforce_decay_pec' to the list of fields converted to Decimal
2026-02-09 20:23:24 +00:00
LemonNexus 97af63cbf9 fix: add safe decimal conversion to AttachmentConfig.from_dict and better error logging
- AttachmentConfig.from_dict now uses safe_decimal() for all decimal fields
- Added traceback logging to _load_saved_loadouts to see exact error location
- Handles int/float/Decimal/string values for all numeric fields
2026-02-09 20:20:58 +00:00
LemonNexus c7c16f65db fix: add missing Any import to armor_system.py 2026-02-09 20:17:06 +00:00
LemonNexus ff2ae329c1 fix: add safe decimal conversion to armor_system from_dict methods
- ProtectionProfile.from_dict now handles int/float/Decimal/string values
- ArmorPlate.from_dict uses safe_decimal for block_chance
- ArmorPiece.from_dict uses safe_decimal for decay_per_hp and weight
- Prevents 'Decimal + str' type errors when loading saved loadouts
2026-02-09 19:33:05 +00:00
LemonNexus a0211a8425 fix: handle both NexusArmorSet and ArmorSet types in _on_equip_full_set
- Check if pieces is a list (NexusArmorSet) or dict (ArmorSet)
- Route to API method for NexusArmorSet
- Keep hardcoded logic for ArmorSet from combo box
2026-02-09 19:30:48 +00:00
LemonNexus 32cebbc001 debug: add detailed debug info to armor set equip popup
- Shows set protection values (Impact, Cut, Stab, etc.)
- Shows each piece's assigned total protection
- Shows first equipped piece's actual protection value
- Helps trace where protection is getting lost
2026-02-09 19:28:27 +00:00
LemonNexus 343142162f fix: correct _on_armor_changed to handle NexusArmorSet type
- NexusArmorSet.pieces is List[str], not Dict
- Removed code that tried to call .items() on the list
- Now simply clears current_armor_set when pieces are modified
2026-02-09 19:27:09 +00:00
LemonNexus fa427188d9 fix: add error handling and validation to LoadoutConfig.from_dict
- Added try/except with logging around from_dict
- Added validation for armor_plates to handle non-dict values
- Added error handling for Decimal/int conversions
- Better error messages to diagnose loading issues
2026-02-09 19:25:56 +00:00
LemonNexus d265bc2113 debug: add logging to trace armor calculation issue
- Added debug logging to _get_current_config to see pieces found
- Added debug logging to _update_calculations to see equipped armor state
- This will help diagnose why armor shows 0 protection
2026-02-09 19:20:01 +00:00
LemonNexus 22b4e6e8bb fix(api): use armor set's total protection for each piece
- API returns 0 protection for individual armor pieces
- Protection values are only at the armor set level (Defense field)
- Now each piece gets the full set protection values assigned
- Removed equip_full_set call with wrong type (NexusArmorSet vs ArmorSet)
- Individual pieces now have correct protection for calculations
2026-02-09 19:16:55 +00:00
LemonNexus 437f6b3027 fix(ui): properly update ArmorSlotWidget UI when setting piece from API
- Fixed set_piece() to use protection_label instead of non-existent piece_name_label
- Now updates protection display when piece is set
- Adds piece to combo if not already present
- Properly stores current_piece and calls _update_total()
2026-02-09 19:08:35 +00:00
LemonNexus a349a85cbe fix(ui): use Decimal for armor decay calculation to avoid type error
- Fixed: Decimal * float is not supported
- Now using Decimal for all operands in decay calculation
2026-02-09 19:04:21 +00:00
LemonNexus 297552fd1c fix(ui): improve armor set piece slot detection
- Added name-based slot detection as fallback when Type field doesn't match
- Added more slot mapping variations (chest, armguards, thighguards, etc.)
- Added _get_slot_from_name() helper for name-based detection
- Now correctly equips all 7 pieces of armor sets like Frontier Adjusted
2026-02-09 19:01:23 +00:00
LemonNexus 4375a00f0f fix(api): correct NexusArmorSet parser for actual API structure
- Fixed field name: API uses 'Armors' not 'Pieces'
- Fixed protection location: API uses 'Defense' not per-piece protection
- Armors is array of arrays, now properly flattened
- Added set bonus parsing from EffectsOnSetEquip
2026-02-09 18:55:38 +00:00
LemonNexus f2d1162d27 fix(ui): correct attribute name for armor slots in loadout manager
- Changed self.armor_slots to self.slot_widgets to match actual attribute name
- Fixes AttributeError when selecting full armor sets
2026-02-09 18:52:00 +00:00
LemonNexus 3bdf86ab4c fix(api): handle absorber-specific fields (absorption instead of decay)
- Absorbers don't have Decay in Economy, only Absorption
- Updated parser to set decay=0 and absorption from Economy.Absorption for absorbers
- Updated UI to show absorption % in Decay column for absorbers
- Updated preview panel to display absorption for absorbers
2026-02-09 17:16:29 +00:00
LemonNexus 7f1e111a83 fix(ui): remove attachment_type overwrite in loader to preserve parsed type
- Removed code that was overwriting attachment_type for all items
- Type is now correctly parsed from API (scope vs sight)
- Sights tab now correctly shows items with Type='Sight'
2026-02-09 17:14:47 +00:00
LemonNexus c7afde4d41 chore: remove debug script 2026-02-09 17:12:58 +00:00
LemonNexus e8f0d7860e fix(api): correct attachment field parsing for all attachment types
- Fixed NexusAttachment.from_api() to parse correct API structure:
  - Amplifiers: Damage values from Properties.Damage
  - Scopes: Skill bonuses from Properties.SkillModification/SkillBonus, zoom from Properties.Zoom
  - Absorbers: Absorption from Economy.Absorption
- Added zoom and absorption fields to NexusAttachment
- Updated attachment selector UI to show type-specific columns
- Added zoom and absorption to preview panel
2026-02-09 17:12:44 +00:00
LemonNexus 4ef03d96c8 fix(api): improve NexusAttachment field parsing for weapon amplifiers
- Updated from_api() to check multiple possible field names
- Added fallback checks for Damage, Range, Decay, Efficiency fields
- Type detection from both API Type field and item name
- Improved display formatting in attachment selector
2026-02-09 17:07:31 +00:00
LemonNexus 1be69b1879 feat(ui): add armor set selection to armor selector
- Added tabs to ArmorSelectorDialog: Individual Pieces and Full Sets
- Armor sets show total protection across all 7 pieces
- Selecting a full set auto-populates all 7 armor slots in loadout manager
- Added armor_set_selected signal for full set selection
- Shows summary of equipped pieces and any missing ones
2026-02-09 17:04:21 +00:00
LemonNexus 1ba8acb7e2 feat(db): add database migration script for loadout support
- migrate_db.py adds loadout_id, mindforce_cost_ped, hits_taken, heals_used columns
- Creates loadouts table if not exists
- Updates schema version to 3
2026-02-09 16:55:38 +00:00
LemonNexus 1b176b96a8 feat(hud): integrate loadout-based cost tracking in HUD
- Added LoadoutSelectionDialog for choosing loadout when starting session
- Added set_cost_tracker() method to HUDOverlay for SessionCostTracker integration
- Added new display row for loadout metrics: $/shot, $/hit, $/heal, hits, heals
- Added mindforce cost support
- Updated start_session() to accept loadout_id and per-action costs
- Updated _refresh_display() to show new cost metrics
2026-02-09 16:14:51 +00:00