Fix travel command location name matching
🐛 Fixed Issues: - "dragon's peak" now properly matches "Dragon's Peak" location - "dragons peak" (without apostrophe) now works - Added case-insensitive location name matching - Added common variations mapping for all locations 🔧 Changes: - modules/exploration.py: Enhanced \!travel command with location mappings - Added support for variations like "dragons peak", "dragon peak", "dragons-peak" - Maintains backward compatibility with existing location names Now players can use various formats to travel to locations without worrying about exact capitalization or apostrophes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3f3b66bfaa
commit
6791d49c80
1 changed files with 21 additions and 1 deletions
|
|
@ -60,7 +60,27 @@ class Exploration(BaseModule):
|
|||
if not player:
|
||||
return
|
||||
|
||||
destination = " ".join(args).title() # Normalize to Title Case
|
||||
# Handle various input formats and normalize location names
|
||||
destination_input = " ".join(args).lower()
|
||||
|
||||
# Map common variations to exact location names
|
||||
location_mappings = {
|
||||
"starter town": "Starter Town",
|
||||
"whispering woods": "Whispering Woods",
|
||||
"electric canyon": "Electric Canyon",
|
||||
"crystal caves": "Crystal Caves",
|
||||
"frozen tundra": "Frozen Tundra",
|
||||
"dragon's peak": "Dragon's Peak",
|
||||
"dragons peak": "Dragon's Peak",
|
||||
"dragon peak": "Dragon's Peak",
|
||||
"dragons-peak": "Dragon's Peak"
|
||||
}
|
||||
|
||||
destination = location_mappings.get(destination_input)
|
||||
if not destination:
|
||||
# Fall back to title case if no mapping found
|
||||
destination = " ".join(args).title()
|
||||
|
||||
location = await self.database.get_location_by_name(destination)
|
||||
|
||||
if not location:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue