Team Management Features:
- Added 6 new IRC commands: \!teamlist, \!activeteam, \!teamname, \!teamswap, \!heal, \!verifyteamswap
- \!teamlist shows teams with pet names in format "Team name - pet1 - pet2 - pet3"
- \!teamname redirects to web interface for secure PIN-based renaming
- \!teamswap enables team switching with PIN verification via IRC
- \!activeteam displays current team with health status indicators
- \!heal command with 1-hour cooldown for pet health restoration
Critical Bug Fixes:
- Fixed \!teamlist SQL binding error - handled new team data format correctly
- Fixed \!wild command duplicates - now shows unique species types only
- Removed all debug print statements and implemented proper logging
- Fixed data format inconsistencies in team management system
Production Improvements:
- Added logging infrastructure to BaseModule and core components
- Converted 45+ print statements to professional logging calls
- Database query optimization with DISTINCT for spawn deduplication
- Enhanced error handling and user feedback messages
Cross-platform Integration:
- Seamless sync between IRC commands and web interface
- PIN authentication leverages existing secure infrastructure
- Team operations maintain consistency across all interfaces
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed BackupCommands module not being loaded into the bot system:
- Added BackupCommands to modules/__init__.py imports and __all__ list
- Added BackupCommands to module loading in run_bot_with_reconnect.py
- Fixed constructor signature to match BaseModule requirements
All 5 backup commands now properly registered and available to admin users:
- \!backup - Create manual database backups
- \!restore - Restore from backup files
- \!backups - List available backups
- \!backup_stats - Show backup system statistics
- \!backup_cleanup - Clean up old backups based on retention policy
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
**README Updates:**
- Added v0.3.0 section highlighting team swap system and architecture cleanup
- Documented active team architecture redesign
- Listed web-IRC synchronization improvements
- Noted command cleanup achievements (180+ lines removed)
**CLAUDE.md Enhancements:**
- Added comprehensive message for future Claude developers
- Documented current project state and recent achievements
- Provided architecture overview and development patterns
- Included working relationship insights and technical guidance
- Listed key files, patterns, and potential future improvements
- Added helpful warnings and tips for smooth development
This ensures future development sessions have excellent context
and continuity for maintaining this sophisticated IRC gaming bot.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major cleanup of the modular command system:
**Legacy Code Removal:**
- Removed all legacy command handlers from src/bot.py (74 lines)
- Eliminated outdated command implementations superseded by modular system
- Maintained backward compatibility while cleaning up codebase
**Duplicate Command Consolidation:**
- Removed duplicate status/uptime/ping commands from admin.py
- Kept comprehensive implementations in connection_monitor.py
- Eliminated 3 redundant commands and ~70 lines of duplicate code
**Admin System Standardization:**
- Updated backup_commands.py to use central ADMIN_USER from config.py
- Updated connection_monitor.py to use central ADMIN_USER from config.py
- Removed hardcoded admin user lists across modules
- Ensured consistent admin privilege checking system-wide
**Benefits:**
- Cleaner, more maintainable command structure
- No duplicate functionality across modules
- Consistent admin configuration management
- Reduced codebase size while maintaining all functionality
- Better separation of concerns in modular architecture
This cleanup addresses technical debt identified in the command audit
and prepares the codebase for future development.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
🔄 **New Active Team System**
- Replace Team 1 hardcoded active system with flexible active_teams table
- Players can now edit ALL teams (1, 2, 3) equally via web interface
- Support for swapping any saved team as the active battle team
🌐 **Web Interface Enhancements**
- Add "Make Active" buttons to team management hub
- Real-time team swapping with loading states and success notifications
- Visual indicators for currently active team with green highlighting
- Updated team builder to treat all team slots consistently
🎮 **IRC Battle Integration**
- Update get_active_pets() and get_player_pets() methods to use new active_teams table
- IRC battles (\!battle, \!attack, \!gym) now use web-selected active team
- Real-time sync: team swaps via web immediately affect IRC battles
- Maintain backward compatibility with existing IRC commands
🛠️ **Database Architecture**
- Add active_teams table with player_id -> active_slot mapping
- Migrate existing active teams to team_configurations format
- Update team save logic to store all teams as configurations
- Add set_active_team_slot() and get_active_team_slot() methods
✅ **Key Features**
- Seamless web-to-IRC active team synchronization
- All teams editable with proper PIN verification
- Enhanced UX with animations and proper error handling
- Maintains data consistency across all interfaces
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix pet count display for all saved teams (handles both list and dict formats)
- Add comprehensive active team display with individual pet cards on hub
- Show detailed pet information: stats, HP bars, happiness, types, levels
- Implement responsive grid layout for active pet cards with hover effects
- Add proper data format handling between active and saved teams
- Create dedicated team hub with both overview and detailed sections
- Standardize team data pipeline for consistent display across all interfaces
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix "cannot convert dictionary update sequence" error in apply_individual_team_change
- Set row_factory properly for aiosqlite Row object conversion
- Standardize team data format between database and web interface display
- Save full pet details instead of just IDs for proper persistence
- Add backward compatibility for existing saved teams
- Update TeamManagementService to use consistent data structures
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replace hardcoded 'megasconed' with dynamic {nickname} in loadSavedTeamConfiguration
- Add comprehensive error handling for non-JSON responses
- Check response status and content-type before parsing JSON
- Add detailed console logging for debugging team config load failures
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
CRITICAL BUG FIXES:
- Fix race condition causing pets to go down levels after gaining experience
- Replace dangerous double database updates with single atomic transaction
- Add comprehensive input validation to prevent negative experience awards
- Implement proper transaction isolation with BEGIN IMMEDIATE for concurrency
KEY IMPROVEMENTS:
- Single atomic UPDATE eliminates race conditions between concurrent experience awards
- Added extensive input validation (negative values, type checking, reasonable caps)
- Proper transaction handling with rollback on errors
- Removed deprecated _handle_level_up function that caused stale data issues
- Enhanced calculate_level_from_exp with infinite loop protection
- Added overflow protection for extreme level calculations
TECHNICAL DETAILS:
- Experience awards now use BEGIN IMMEDIATE transaction isolation
- All stat calculations and level updates happen in single atomic operation
- Input validation prevents negative experience and excessive amounts (>10,000)
- Pet isolation ensures no interference between different players' pets
- Comprehensive error handling with proper rollback on database errors
- Preserved HP percentage on level up while giving full HP bonus
This fixes the reported issue where players' pets would mysteriously lose levels
after gaining experience, which was caused by concurrent database updates
overwriting each other's level calculations.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement NPC events module with full IRC command support:
- \!events: View all active community events
- \!event <id>: Get detailed event information and leaderboard
- \!contribute <id>: Participate in community events
- \!eventhelp: Comprehensive event system documentation
- Add NPC events backend system with automatic spawning:
- Configurable event types (resource gathering, pet rescue, exploration)
- Difficulty levels (easy, medium, hard) with scaled rewards
- Community collaboration mechanics with shared progress
- Automatic event spawning and expiration management
- Database integration for event tracking and player contributions
- Expandable system supporting future event types and mechanics
- Admin \!startevent command for manual event creation
- Comprehensive error handling and user feedback
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Enhance bot initialization to support healing system background tasks
- Update webserver to properly handle healing system web interfaces
- Ensure proper integration between IRC bot and web components
- Add support for healing system status monitoring and display
- Maintain unified user experience across IRC and web interfaces
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add heal command to rate limiting system for proper cooldown enforcement
- Update module initialization to support new healing system components
- Ensure rate limiting properly handles new heal command with user restrictions
- Maintain system security and prevent healing system abuse
- Clean up deprecated connection and backup commands from rate limiter
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update inventory section header to "Inventory & Healing System"
- Add \!heal command documentation with 1-hour cooldown details
- Enhance \!use command description to include revive functionality
- Add comprehensive Pet Healing System info box covering:
- Fainted pet mechanics and restrictions
- Revive items (50% and 100% HP restoration)
- Heal command with cooldown system
- Auto-recovery after 30 minutes to 1 HP
- Travel permissions with fainted pets
- Add Pet Fainting System section to Battle System:
- Battle defeat mechanics
- Available healing options
- Strategic impact and type advantages
- Update item rarity categories to include Revive (rare) and Max Revive (epic)
- Maintain consistent styling and navigation structure
- Provide complete user guidance for pet health management
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update wild battle defeat handling to mark pets as fainted
- Update gym battle defeat handling to mark pets as fainted
- Add database faint_pet() calls when pets lose battles
- Ensure fainted pets are properly tracked with timestamps
- Both wild and gym battles now consistently handle pet fainting
- Defeated pets are immediately marked as fainted in database
- Maintains existing battle flow while adding fainting mechanics
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implement \!heal command with 1-hour cooldown available to all users
- Add comprehensive cooldown tracking with database last_heal_time validation
- Heal command restores all active pets to full health
- Add background pet recovery system to game engine:
- Automatic 30-minute recovery timer for fainted pets
- Background task checks every 5 minutes for eligible pets
- Auto-recovery restores pets to 1 HP after 30 minutes
- Proper startup/shutdown integration with game engine
- Add pet_recovery_task to game engine with graceful shutdown
- Include detailed logging for recovery operations
- Ensure system resilience with error handling and task cancellation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add Revive (50% HP) and Max Revive (100% HP) items to config/items.json
- Extend database schema with fainted_at timestamp for pets table
- Add last_heal_time column to players table for heal command cooldown
- Implement comprehensive pet healing database methods:
- get_fainted_pets(): Retrieve all fainted pets for a player
- revive_pet(): Restore fainted pet with specified HP
- faint_pet(): Mark pet as fainted with timestamp
- get_pets_for_auto_recovery(): Find pets eligible for 30-minute auto-recovery
- auto_recover_pet(): Automatically restore pet to 1 HP
- get_active_pets(): Get active pets excluding fainted ones
- get_player_pets(): Enhanced to filter out fainted pets when active_only=True
- Update inventory module to handle revive and max_revive effects
- Add proper error handling for cases where no fainted pets exist
- Maintain case-insensitive item usage compatibility
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Enhanced start_petbot.sh with extensive validation and error checking
- Added emoji support to pet species system with database migration
- Expanded pet species from 9 to 33 unique pets with balanced spawn rates
- Improved database integrity validation and orphaned pet detection
- Added comprehensive pre-startup testing and configuration validation
- Enhanced locations with diverse species spawning across all areas
- Added dual-type pets and rarity-based spawn distribution
- Improved startup information display with feature overview
- Added background monitoring and validation systems
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
### Major Features Added:
**Team Configuration Management:**
- Add support for 3 different team configurations per player
- Implement save/load/rename functionality for team setups
- Add prominent team configuration UI with dropdown selector
- Create quick action buttons for instant configuration loading
- Add status tracking for current editing state
**Database Enhancements:**
- Add team_configurations table with player_id, slot_number, config_name
- Implement rename_team_configuration() method for configuration management
- Add proper indexing and foreign key constraints
**Web Interface Improvements:**
- Fix team builder template visibility issue (was using wrong template)
- Add comprehensive CSS styling for configuration elements
- Implement responsive design with proper hover effects and transitions
- Add visual feedback with status indicators and progress tracking
**API Endpoints:**
- Add /teambuilder/{nickname}/config/rename/{slot} for renaming configs
- Implement proper validation and error handling for all endpoints
- Add JSON response formatting with success/error states
**JavaScript Functionality:**
- Add switchActiveConfig() for configuration switching
- Implement quickSaveConfig() for instant team saving
- Add renameConfig() with user-friendly prompts
- Create loadConfigToEdit() for seamless configuration editing
**Admin & System Improvements:**
- Enhance weather command system with simplified single-word names
- Fix \!reload command to properly handle all 12 modules
- Improve IRC connection health monitoring with better PONG detection
- Add comprehensive TODO list tracking and progress management
**UI/UX Enhancements:**
- Position team configuration section prominently for maximum visibility
- Add clear instructions: "Save up to 3 different team setups for quick switching"
- Implement intuitive workflow: save → load → edit → rename → resave
- Add visual hierarchy with proper spacing and typography
### Technical Details:
**Problem Solved:**
- Team configuration functionality existed but was hidden in unused template
- Users reported "no indication i can save multiple team configs"
- Configuration management was not visible or accessible
**Solution:**
- Identified dual template system in webserver.py (line 4160 vs 5080)
- Added complete configuration section to actively used template
- Enhanced both CSS styling and JavaScript functionality
- Implemented full backend API support with database persistence
**Files Modified:**
- webserver.py: +600 lines (template fixes, API endpoints, CSS, JavaScript)
- src/database.py: +20 lines (rename_team_configuration method)
- modules/admin.py: +150 lines (weather improvements, enhanced commands)
- TODO.md: Updated progress tracking and completed items
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Enhanced feature descriptions to reflect current capabilities
- Added new sections for Modern Web Features and expanded Technical Features
- Updated Core Gameplay and Advanced Systems with recent additions
- Highlighted 8-category leaderboards, team builder, inventory management
- Mentioned security audit, rate limiting, and backup systems
- Updated item count to 17+ items including new Coin Pouch treasure
- Emphasized responsive design and PIN-verified team management
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix \!team command to redirect to team builder web page instead of showing IRC list
- Add usage commands to inventory items showing "\!use <item name>" for each item
- Implement Coin Pouch treasure item with 1-3 coin rewards (rare drop rate)
- Fix gym badges leaderboard database query with proper COALESCE and CASE syntax
- Improve inventory item display with styled command instructions and monospace code blocks
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major Features Added:
- Complete token bucket rate limiting for IRC commands and web interface
- Per-user rate tracking with category-based limits (Basic, Gameplay, Management, Admin, Web)
- Admin commands for rate limit management (\!rate_stats, \!rate_user, \!rate_unban, \!rate_reset)
- Automatic violation tracking and temporary bans with cleanup
- Global item spawn multiplier system with 75% spawn rate reduction
- Central admin configuration system (config.py)
- One-command bot startup script (start_petbot.sh)
Rate Limiting:
- Token bucket algorithm with burst capacity and refill rates
- Category limits: Basic (20/min), Gameplay (10/min), Management (5/min), Web (60/min)
- Graceful violation handling with user-friendly error messages
- Admin exemption and override capabilities
- Background cleanup of old violations and expired bans
Item Spawn System:
- Added global_spawn_multiplier to config/items.json for easy adjustment
- Reduced all individual spawn rates by 75% (multiplied by 0.25)
- Admins can fine-tune both global multiplier and individual item rates
- Game engine integration applies multiplier to all spawn calculations
Infrastructure:
- Single admin user configuration in config.py
- Enhanced startup script with dependency management and verification
- Updated documentation and help system with rate limiting guide
- Comprehensive test suite for rate limiting functionality
Security:
- Rate limiting protects against command spam and abuse
- IP-based tracking for web interface requests
- Proper error handling and status codes (429 for rate limits)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- CLAUDE.md: Comprehensive development guide documenting patterns, conventions, and project structure
- TODO.md: Organized task list with completed items, bugs, enhancements, and feature ideas
- Both files provide context for future AI-assisted development sessions
- Includes testing procedures, coding standards, and architectural decisions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Updated CHANGELOG.md with comprehensive list of new features and fixes
- Enhanced README.md with updated feature descriptions and web interface capabilities
- Documented team builder functionality, navigation improvements, and bug fixes
- Added clear descriptions of IRC command redirects and web integration
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Implemented comprehensive navigation system with hover dropdowns
- Added navigation to all webserver pages for consistent user experience
- Enhanced page templates with unified styling and active page highlighting
- Improved accessibility and discoverability of all bot features through web interface
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Updated command descriptions to reflect inventory redirect to web interface
- Improved documentation for web-based team building and inventory management
- Added clearer explanations of web interface features and navigation
- Maintained consistency between IRC commands and web functionality
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Removed \!swap command as team management moved to website
- Added redirect messages pointing users to team builder web interface
- Streamlined pet management workflow through unified web experience
- Maintained existing \!pets command functionality with web redirect
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed exploration bug: prevent multiple \!explore when encounter is active
- Fixed battle bug: prevent starting multiple battles from exploration encounters
- Enforced exploration encounter workflow: must choose fight/capture/flee before exploring again
- Fixed \!gym challenge to use player's current location instead of requiring location parameter
- Added proper state management to prevent race conditions
- Improved user experience with clear error messages for active encounters
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added team_order column migration for numbered team slots (1-6)
- Implemented get_next_available_team_slot() method
- Added team composition validation for team builder
- Created pending team change system with PIN verification
- Added apply_team_change() for secure team updates
- Enhanced team management with proper ordering and constraints
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Updated \!inventory, \!inv, and \!items commands to redirect to player profile
- Added #inventory jump point for direct section navigation
- Improved user experience with web-based inventory management
- Enhanced UX with helpful explanatory messages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Modified PetBotWebServer instantiation to include bot parameter
- Enables IRC PIN delivery for team builder functionality
- Maintains existing webserver functionality while adding IRC integration
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Completely rewrote team builder with unified template system
- Fixed center alignment issues with proper CSS layout (max-width: 1200px, margin: 0 auto)
- Implemented working drag-and-drop between storage and numbered team slots (1-6)
- Added double-click backup method for moving pets
- Fixed JavaScript initialization and DOM loading issues
- Added proper visual feedback during drag operations
- Fixed CSS syntax errors that were breaking f-string templates
- Added missing send_json_response method for AJAX requests
- Integrated IRC PIN delivery system for secure team changes
- Updated PetBotWebServer constructor to accept bot instance for IRC messaging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added normalize_input() function to BaseModule for consistent lowercase conversion of user input. Updated all command modules to use normalization for commands, arguments, pet names, location names, gym names, and item names. Players can now use any capitalization for commands and arguments.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Bug Fix:
- Fixed 'int' object has no attribute 'split' error when viewing player profiles
- Issue was incorrect column mapping in encounter data SQL query
- species_id (integer) was being treated as first_encounter_date (string)
Technical Changes:
- Use existing database.get_player_encounters() method with proper row factory
- Use existing database.get_encounter_stats() method for consistency
- Added robust error handling for date formatting in both encounters and gym badges
- Added try/catch blocks to prevent profile crashes from data issues
Data Safety:
- Added isinstance() checks before calling .split() on date strings
- Graceful fallback to 'Unknown' for malformed dates
- Error handling ensures other users won't experience crashes
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Major Features Added:
- Complete petdex page showing all available pets with stats, types, evolution info
- Encounter tracking system recording pet discoveries and catch statistics
- Gym badges display on player profiles with victory counts and dates
- Enhanced player profiles with discovery progress and completion percentages
Technical Implementation:
- New /petdex route with rarity-organized pet encyclopedia
- Database encounter tracking with automatic integration into exploration/catch
- Updated webserver.py with encounter data fetching and display
- Fixed battle_system.py syntax error in gym battle completion logic
- Organized project by moving unused bot files to backup_bots/ folder
Database Changes:
- Added player_encounters table for tracking discoveries
- Added methods: record_encounter, get_player_encounters, get_encounter_stats
- Enhanced player profile queries to include gym badges and encounters
Web Interface Updates:
- Petdex page with search stats, rarity grouping, and spawn location info
- Player profiles now show species seen, completion %, gym badges earned
- Encounter section displaying discovered pets with catch statistics
- Updated navigation to include petdex link on main game hub
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
**NEW FEATURES:**
- Complete EXP system with Pokemon-style stat calculation
- Level-based stat growth and automatic HP restoration on level up
- Experience gain from catches and battle victories
- Visual level up notifications with stat increases
**EXPERIENCE SOURCES:**
- Successful catches: 5 EXP × caught pet level
- Wild battle victories: 10 EXP × defeated pet level
- Gym battle victories: 20 EXP × defeated pet level (2x multiplier)
**LEVELING MECHANICS:**
- Cubic growth formula: level³ × 4 - 12 (smooth progression)
- Level cap at 100
- Stats recalculated on level up using Pokemon formulas
- Full HP restoration on level up
- Real-time stat increase display
**EXPERIENCE DISPLAY:**
- \!team command now shows "EXP: X to next" for active pets
- Level up messages show exact stat gains
- Experience awarded immediately after catch/victory
**STAT CALCULATION:**
- HP: (2 × base + 31) × level / 100 + level + 10
- Other stats: (2 × base + 31) × level / 100 + 5
- Progressive growth ensures meaningful advancement
**BATTLE INTEGRATION:**
- EXP awarded after wild battles, gym individual battles, and catches
- Different multipliers for different victory types
- First active pet receives all experience
This creates proper RPG progression where pets grow stronger through gameplay,
encouraging both exploration (catches) and combat (battles) for advancement.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed tuple index out of range error in end_gym_battle()
- Added proper row factory and named column access in database queries
- Added exception handling and bounds checking in gym battle completion
- Added debug logging to track gym battle state issues
- Improved error messages for gym battle failures
Fixes: "tuple index out of range" error when gym battles complete
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
**NEW FEATURES:**
- Full 3-pet gym battles with turn-based combat
- Interactive attack selection (\!attack <move>)
- Item usage during gym battles (\!use <item>)
- Progressive battles through gym leader's team
- Proper gym battle state tracking and advancement
**BATTLE MECHANICS:**
- Players fight through all 3 gym pets sequentially
- Can use all battle commands: \!attack, \!moves, \!use
- Cannot flee from gym battles (must \!forfeit instead)
- Battle engine integration maintains all existing combat features
- Automatic progression to next gym pet when one is defeated
**GYM BATTLE FLOW:**
1. \!gym challenge "gym name" - starts battle with first pet
2. Standard turn-based combat using \!attack <move>
3. When gym pet defeated, automatically advance to next pet
4. Complete victory after defeating all 3 gym pets
5. \!forfeit available to quit gym battle with honor
**DATABASE UPDATES:**
- Added active_gym_battles table for state tracking
- Gym battle progression and team management
- Integration with existing player_gym_battles for victory tracking
**COMMANDS ADDED:**
- \!forfeit - quit current gym battle
- Enhanced \!gym challenge with full battle system
- Battle system now handles gym vs wild battle contexts
This creates the proper Pokemon-style gym experience where players strategically
battle through the gym leader's team using their full arsenal of moves and items.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added get_active_pets() method that returns all active pets for a player
- Method includes pet details and species information needed for gym battles
- Fixes "get_active_pets" AttributeError in gym challenge command
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Updated gym challenge to automatically search in player's current location first
- Made gym search case-insensitive (forest guardian, Forest Guardian, FOREST GUARDIAN all work)
- Added helpful error messages showing available gyms in current location
- Updated gym info command to also prioritize current location and be case-insensitive
- Added get_gym_by_name_in_location() database method for location-specific searches
- Improved user experience by removing need to travel between locations to challenge gyms
Fixes: \!gym challenge forest guardian now works correctly
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>