Commit graph

23 commits

Author SHA1 Message Date
megaproxy
e17705dc63 Implement comprehensive team management and fix critical bugs
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>
2025-08-01 15:53:26 +00:00
megaproxy
5293da2921 Implement complete team swap functionality between web interface and IRC battles
🔄 **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>
2025-07-17 16:39:42 +00:00
megaproxy
285a7c4a7e Complete team builder enhancement with active team display and pet counts
- 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>
2025-07-17 14:14:01 +00:00
megaproxy
00d41c8ce7 Fix team builder JSON parse error and hardcoded nickname
- 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>
2025-07-17 00:12:38 +00:00
megaproxy
530134bd36 Update bot and webserver integration for healing system support
- 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>
2025-07-16 11:33:37 +00:00
megaproxy
fca0423c84 Add comprehensive startup script validation and enhanced pet system
- 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>
2025-07-16 00:17:54 +00:00
megaproxy
add7731d80 Implement comprehensive team builder configuration system
### 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>
2025-07-15 22:40:23 +00:00
megaproxy
88e352ee79 Enhance web interface and item system with user experience improvements
- 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>
2025-07-15 20:47:37 +00:00
megaproxy
915aa00bea Implement comprehensive rate limiting system and item spawn configuration
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>
2025-07-15 20:10:43 +00:00
megaproxy
ff14710987 Fix team builder interface and implement working drag-and-drop functionality
- 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>
2025-07-15 16:55:58 +01:00
megaproxy
8e9ff2960f Implement case-insensitive command processing across all bot modules
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>
2025-07-14 21:57:51 +01:00
megaproxy
39ba55832d Fix team builder issues, Added startup import checks for consistency
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 21:48:18 +01:00
megaproxy
08f7aa8ea8 Fix database constraints and team builder save functionality
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 21:10:28 +01:00
megaproxy
60dbcae113 Fix drag-and-drop dataTransfer errors and add double-click backup
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 17:19:37 +01:00
megaproxy
bbaba99020 Rewrite drag-and-drop with comprehensive testing and debugging
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 17:17:33 +01:00
megaproxy
d245454231 Fix drag-and-drop functionality in team builder
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 17:14:53 +01:00
megaproxy
7d49730a5f Enhance team builder with full drag-and-drop and detailed pet stats
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 17:11:54 +01:00
megaproxy
9cf2231a03 Implement secure team builder with PIN verification system
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 17:08:02 +01:00
megaproxy
729984be66 Fix critical player profile crash with encounter data
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>
2025-07-14 16:36:00 +01:00
megaproxy
1ce7158200 Add comprehensive web interface enhancements and encounter tracking
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>
2025-07-14 16:32:25 +01:00
megaproxy
3f3b66bfaa Update all web links to use petz.rdx4.com domain
🌐 Updated URLs:
- \!help command now points to http://petz.rdx4.com/help
- \!pets command now points to http://petz.rdx4.com/player/{nickname}
- README.md updated to reference petz.rdx4.com
- Web server startup messages show both local and public URLs

🔧 Changes:
- modules/core_commands.py: Updated help URL
- modules/pet_management.py: Updated player profile URL
- webserver.py: Added public URL display in startup messages
- README.md: Updated web interface section

Users will now receive public URLs that work externally instead of localhost URLs.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 00:27:53 +01:00
megaproxy
db144da24f Add complete item collection system (v0.2.0)
🎒 Item Collection System:
- 16 unique items across 5 categories (healing, battle, rare, location, special)
- Rarity tiers: Common, Uncommon, Rare, Epic, Legendary with symbols
- 30% chance to find items during exploration
- Location-specific items (shells, mushrooms, crystals, runes)
- Inventory management with \!inventory and \!use commands
- Web interface integration showing player inventories
- Consumable items: healing potions, battle boosters, lucky charms

🔧 Technical Updates:
- Added items and player_inventory database tables
- New Inventory module for item management
- Updated game engine with item discovery system
- Enhanced web interface with inventory display
- Item initialization from config/items.json

🆕 New Commands:
- \!inventory / \!inv / \!items - View collected items by category
- \!use <item name> - Use consumable items on active pets

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 00:19:57 +01:00
megaproxy
47f160a295 Initial commit: Complete PetBot IRC Game
🎮 Features implemented:
- Pokemon-style pet collection and battles
- Multi-location exploration system
- Dynamic weather with background updates
- Achievement system with location unlocks
- Web dashboard for player stats
- Modular command system
- Async database with SQLite
- PM flood prevention
- Persistent player data

🌤️ Weather System:
- 6 weather types with spawn modifiers
- 30min-3hour dynamic durations
- Background task for automatic updates
- Location-specific weather patterns

🐛 Recent Bug Fixes:
- Database persistence on restart
- Player page SQLite row conversion
- Achievement count calculations
- Travel requirement messages
- Battle move color coding
- Locations page display

🔧 Generated with Claude Code
🤖 Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-13 23:57:39 +01:00