Petbot/config/items.json
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

218 lines
No EOL
6.9 KiB
JSON

{
"_config": {
"global_spawn_multiplier": 1.0,
"description": "Global multiplier for all item spawn rates. Set to 0.5 for half spawns, 2.0 for double spawns, etc.",
"admin_note": "Edit this value to globally adjust all item spawn rates. Individual item spawn_rate values can still be fine-tuned."
},
"healing_items": [
{
"id": 1,
"name": "Small Potion",
"description": "Restores 20 HP to a pet",
"rarity": "common",
"category": "healing",
"effect": "heal",
"effect_value": 20,
"locations": ["all"],
"spawn_rate": 0.0375
},
{
"id": 2,
"name": "Large Potion",
"description": "Restores 50 HP to a pet",
"rarity": "uncommon",
"category": "healing",
"effect": "heal",
"effect_value": 50,
"locations": ["all"],
"spawn_rate": 0.02
},
{
"id": 3,
"name": "Super Potion",
"description": "Fully restores a pet's HP",
"rarity": "rare",
"category": "healing",
"effect": "full_heal",
"effect_value": 100,
"locations": ["all"],
"spawn_rate": 0.0075
},
{
"id": 4,
"name": "Energy Berry",
"description": "Restores 15 HP and cures status effects",
"rarity": "uncommon",
"category": "healing",
"effect": "heal_status",
"effect_value": 15,
"locations": ["mystic_forest", "enchanted_grove"],
"spawn_rate": 0.03
}
],
"battle_items": [
{
"id": 5,
"name": "Attack Booster",
"description": "Increases attack damage by 25% for one battle",
"rarity": "uncommon",
"category": "battle",
"effect": "attack_boost",
"effect_value": 25,
"locations": ["all"],
"spawn_rate": 0.025
},
{
"id": 6,
"name": "Defense Crystal",
"description": "Reduces incoming damage by 20% for one battle",
"rarity": "uncommon",
"category": "battle",
"effect": "defense_boost",
"effect_value": 20,
"locations": ["crystal_caves", "frozen_peaks"],
"spawn_rate": 0.02
},
{
"id": 7,
"name": "Speed Elixir",
"description": "Guarantees first move in battle",
"rarity": "rare",
"category": "battle",
"effect": "speed_boost",
"effect_value": 100,
"locations": ["all"],
"spawn_rate": 0.0125
}
],
"rare_items": [
{
"id": 8,
"name": "Fire Stone",
"description": "A mysterious stone that radiates heat (future evolution item)",
"rarity": "epic",
"category": "evolution",
"effect": "none",
"effect_value": 0,
"locations": ["volcanic_chamber"],
"spawn_rate": 0.005
},
{
"id": 9,
"name": "Water Stone",
"description": "A mysterious stone that flows like water (future evolution item)",
"rarity": "epic",
"category": "evolution",
"effect": "none",
"effect_value": 0,
"locations": ["crystal_caves"],
"spawn_rate": 0.005
},
{
"id": 10,
"name": "Lucky Charm",
"description": "Increases rare pet encounter rate by 50% for 1 hour",
"rarity": "legendary",
"category": "buff",
"effect": "lucky_boost",
"effect_value": 50,
"locations": ["all"],
"spawn_rate": 0.0025
},
{
"id": 11,
"name": "Ancient Fossil",
"description": "A mysterious fossil from prehistoric times",
"rarity": "legendary",
"category": "special",
"effect": "none",
"effect_value": 0,
"locations": ["forgotten_ruins"],
"spawn_rate": 0.0025
}
],
"location_items": [
{
"id": 12,
"name": "Pristine Shell",
"description": "A beautiful shell that shimmers with ocean magic",
"rarity": "uncommon",
"category": "treasure",
"effect": "sell_value",
"effect_value": 100,
"locations": ["crystal_caves"],
"spawn_rate": 0.03
},
{
"id": 13,
"name": "Glowing Mushroom",
"description": "A mushroom that glows with mystical energy",
"rarity": "rare",
"category": "treasure",
"effect": "sell_value",
"effect_value": 200,
"locations": ["mystic_forest", "enchanted_grove"],
"spawn_rate": 0.015
},
{
"id": 14,
"name": "Volcanic Glass",
"description": "Sharp obsidian formed by intense heat",
"rarity": "uncommon",
"category": "treasure",
"effect": "sell_value",
"effect_value": 150,
"locations": ["volcanic_chamber"],
"spawn_rate": 0.025
},
{
"id": 15,
"name": "Ice Crystal",
"description": "A crystal that never melts, cold to the touch",
"rarity": "rare",
"category": "treasure",
"effect": "sell_value",
"effect_value": 250,
"locations": ["frozen_peaks"],
"spawn_rate": 0.0125
},
{
"id": 16,
"name": "Ancient Rune",
"description": "A stone tablet with mysterious inscriptions",
"rarity": "epic",
"category": "treasure",
"effect": "sell_value",
"effect_value": 500,
"locations": ["forgotten_ruins"],
"spawn_rate": 0.0075
}
],
"rarity_info": {
"common": {
"color": "white",
"symbol": "○",
"description": "Common items found frequently"
},
"uncommon": {
"color": "green",
"symbol": "◇",
"description": "Uncommon items with moderate rarity"
},
"rare": {
"color": "blue",
"symbol": "◆",
"description": "Rare items with special properties"
},
"epic": {
"color": "purple",
"symbol": "★",
"description": "Epic items with powerful effects"
},
"legendary": {
"color": "gold",
"symbol": "✦",
"description": "Legendary items of immense value"
}
}
}