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>
This commit is contained in:
megaproxy 2025-07-15 20:47:37 +00:00
parent 915aa00bea
commit 88e352ee79
4 changed files with 450 additions and 51 deletions

View file

@ -99,6 +99,22 @@ class Inventory(BaseModule):
self.send_message(channel,
f"🍀 {nickname}: Used {item['name']}! Rare pet encounter rate increased by {effect_value}% for 1 hour!")
elif effect == "money":
# Handle money items (like Coin Pouch)
import random
if "-" in str(effect_value):
# Parse range like "1-3"
min_coins, max_coins = map(int, str(effect_value).split("-"))
coins_gained = random.randint(min_coins, max_coins)
else:
coins_gained = int(effect_value)
# Add money to player
await self.database.add_money(player["id"], coins_gained)
self.send_message(channel,
f"💰 {nickname}: Used {item['name']}! Found {coins_gained} coins inside!")
elif effect == "none":
self.send_message(channel,
f"📦 {nickname}: Used {item['name']}! This item has no immediate effect but may be useful later.")

View file

@ -22,51 +22,13 @@ class PetManagement(BaseModule):
await self.cmd_nickname(channel, nickname, args)
async def cmd_team(self, channel, nickname):
"""Show active pets (channel display)"""
"""Redirect player to their team builder page"""
player = await self.require_player(channel, nickname)
if not player:
return
pets = await self.database.get_player_pets(player["id"], active_only=False)
if not pets:
self.send_message(channel, f"{nickname}: You don't have any pets! Use !catch to find some.")
return
# Show active pets first, then others
active_pets = [pet for pet in pets if pet.get("is_active")]
inactive_pets = [pet for pet in pets if not pet.get("is_active")]
team_info = []
# Active pets with star and team position
for pet in active_pets:
name = pet["nickname"] or pet["species_name"]
# Calculate EXP progress
current_exp = pet.get("experience", 0)
next_level_exp = self.database.calculate_exp_for_level(pet["level"] + 1)
current_level_exp = self.database.calculate_exp_for_level(pet["level"])
exp_needed = next_level_exp - current_exp
if pet["level"] >= 100:
exp_display = "MAX"
else:
exp_display = f"{exp_needed} to next"
# Show team position
position = pet.get("team_order", "?")
team_info.append(f"[{position}]⭐{name} (Lv.{pet['level']}) - {pet['hp']}/{pet['max_hp']} HP | EXP: {exp_display}")
# Inactive pets
for pet in inactive_pets[:5]: # Show max 5 inactive
name = pet["nickname"] or pet["species_name"]
team_info.append(f"{name} (Lv.{pet['level']}) - {pet['hp']}/{pet['max_hp']} HP")
if len(inactive_pets) > 5:
team_info.append(f"... and {len(inactive_pets) - 5} more in storage")
self.send_message(channel, f"🐾 {nickname}'s team: " + " | ".join(team_info))
self.send_message(channel, f"🌐 View detailed pet collection at: http://petz.rdx4.com/player/{nickname}#pets")
# Redirect to web interface for team management
self.send_message(channel, f"⚔️ {nickname}: Manage your team at: http://petz.rdx4.com/teambuilder/{nickname}")
async def cmd_pets(self, channel, nickname):
"""Show link to pet collection web page"""