diff --git a/webserver.py b/webserver.py index 3bc6f38..4f5015d 100644 --- a/webserver.py +++ b/webserver.py @@ -2032,10 +2032,67 @@ class PetBotRequestHandler(BaseHTTPRequestHandler): self.wfile.write(html.encode()) def serve_teambuilder_interface(self, nickname, pets): - """Serve the team builder interface - basic version for now""" + """Serve the full interactive team builder interface""" active_pets = [pet for pet in pets if pet['is_active']] inactive_pets = [pet for pet in pets if not pet['is_active']] + # Generate detailed pet cards + def make_pet_card(pet, is_active): + name = pet['nickname'] or pet['species_name'] + status = "Active" if is_active else "Storage" + status_class = "active" if is_active else "storage" + type_str = pet['type1'] + if pet['type2']: + type_str += f"/{pet['type2']}" + + # Calculate HP percentage for health bar + hp_percent = (pet['hp'] / pet['max_hp']) * 100 if pet['max_hp'] > 0 else 0 + hp_color = "#4CAF50" if hp_percent > 60 else "#FF9800" if hp_percent > 25 else "#f44336" + + return f""" +
+
+

{name}

+
{status}
+
+
Level {pet['level']} {pet['species_name']}
+
{type_str}
+ +
+
HP: {pet['hp']}/{pet['max_hp']}
+
+
+
+
+ +
+
+ ATK + {pet['attack']} +
+
+ DEF + {pet['defense']} +
+
+ SPD + {pet['speed']} +
+
+ EXP + {pet['experience']} +
+
+ +
+ {'😊' if pet['happiness'] > 70 else '😐' if pet['happiness'] > 40 else '😞'} + Happiness: {pet['happiness']}/100 +
+
""" + + active_cards = ''.join(make_pet_card(pet, True) for pet in active_pets) + storage_cards = ''.join(make_pet_card(pet, False) for pet in inactive_pets) + html = f""" @@ -2043,44 +2100,648 @@ class PetBotRequestHandler(BaseHTTPRequestHandler): Team Builder - {nickname}

🐾 Team Builder

-

{nickname} | Active: {len(active_pets)} | Storage: {len(inactive_pets)}

+

Drag pets between Active and Storage to build your perfect team

+

{nickname} | Active: {len(active_pets)} pets | Storage: {len(inactive_pets)} pets

-
+
-

⭐ Active Team

-
- {''.join(f'
{pet["nickname"] or pet["species_name"]} (Lv.{pet["level"]})
' for pet in active_pets) or '
No active pets
'} +
⭐ Active Team
+
+ {active_cards} +
+
+ Drop pets here to add to your active team
-

📦 Storage

-
- {''.join(f'
{pet["nickname"] or pet["species_name"]} (Lv.{pet["level"]})
' for pet in inactive_pets) or '
No stored pets
'} +
📦 Storage
+
+ {storage_cards} +
+
+ Drop pets here to store them
-

Full drag-and-drop interface coming soon!

- ← Back to Profile + + ← Back to Profile +
+ Changes are saved securely with PIN verification via IRC +
+ +
+

🔐 PIN Verification Required

+

A 6-digit PIN has been sent to you via IRC private message.

+

Enter the PIN below to confirm your team changes:

+ + +
+
+ + """