Redirect inventory commands to web interface with jump points

- 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>
This commit is contained in:
megaproxy 2025-07-15 16:57:27 +01:00
parent 30dcb7e4bc
commit 61463267c8

View file

@ -16,51 +16,14 @@ class Inventory(BaseModule):
await self.cmd_use_item(channel, nickname, args)
async def cmd_inventory(self, channel, nickname):
"""Display player's inventory"""
"""Redirect player to their web profile for inventory management"""
player = await self.require_player(channel, nickname)
if not player:
return
inventory = await self.database.get_player_inventory(player["id"])
if not inventory:
self.send_message(channel, f"🎒 {nickname}: Your inventory is empty! Try exploring to find items.")
return
# Group items by category
categories = {}
for item in inventory:
category = item["category"]
if category not in categories:
categories[category] = []
categories[category].append(item)
# Send inventory summary first
total_items = sum(item["quantity"] for item in inventory)
self.send_message(channel, f"🎒 {nickname}'s Inventory ({total_items} items):")
# Display items by category
rarity_symbols = {
"common": "",
"uncommon": "",
"rare": "",
"epic": "",
"legendary": ""
}
for category, items in categories.items():
category_display = category.replace("_", " ").title()
self.send_message(channel, f"📦 {category_display}:")
for item in items[:5]: # Limit to 5 items per category to avoid spam
symbol = rarity_symbols.get(item["rarity"], "")
quantity_str = f" x{item['quantity']}" if item["quantity"] > 1 else ""
self.send_message(channel, f" {symbol} {item['name']}{quantity_str} - {item['description']}")
if len(items) > 5:
self.send_message(channel, f" ... and {len(items) - 5} more items")
self.send_message(channel, f"💡 Use '!use <item name>' to use consumable items!")
# Redirect to web interface for better inventory management
self.send_message(channel, f"🎒 {nickname}: View your complete inventory at: http://petz.rdx4.com/player/{nickname}#inventory")
self.send_message(channel, f"💡 The web interface shows detailed item information, categories, and usage options!")
async def cmd_use_item(self, channel, nickname, args):
"""Use an item from inventory"""