Spaces:
Runtime error
Runtime error
| """ | |
| Service layer interfaces for clean architecture. | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import Dict, Any, Optional, List, Tuple | |
| from ..core.player import Player | |
| class IPlayerService(ABC): | |
| """Interface for player management service.""" | |
| def create_player(self, name: str, player_type: str) -> Player: | |
| """Create a new player.""" | |
| pass | |
| def get_player(self, player_id: str) -> Optional[Player]: | |
| """Get player by ID.""" | |
| pass | |
| def update_player(self, player: Player) -> bool: | |
| """Update player data.""" | |
| pass | |
| def move_player(self, player_id: str, direction: str) -> bool: | |
| """Move player in specified direction.""" | |
| pass | |
| def level_up_player(self, player_id: str) -> bool: | |
| """Level up a player.""" | |
| pass | |
| class IChatService(ABC): | |
| """Interface for chat management service.""" | |
| def send_public_message(self, sender_id: str, message: str) -> bool: | |
| """Send public chat message.""" | |
| pass | |
| def send_private_message(self, sender_id: str, target_id: str, message: str) -> Tuple[bool, str]: | |
| """Send private message.""" | |
| pass | |
| def get_chat_history(self, limit: int = None) -> List[Dict]: | |
| """Get chat history.""" | |
| pass | |
| def add_system_message(self, message: str) -> bool: | |
| """Add system message.""" | |
| pass | |
| class INPCService(ABC): | |
| """Interface for NPC management service.""" | |
| def get_npc_response(self, npc_id: str, message: str, player_id: str = None) -> str: | |
| """Get NPC response to player message.""" | |
| pass | |
| def register_npc(self, npc_id: str, npc_data: Dict) -> bool: | |
| """Register a new NPC.""" | |
| pass | |
| def get_npc(self, npc_id: str) -> Optional[Dict]: | |
| """Get NPC data.""" | |
| pass | |
| def update_npc_position(self, npc_id: str, x: int, y: int) -> bool: | |
| """Update NPC position.""" | |
| pass | |
| class IMCPService(ABC): | |
| """Interface for MCP integration service.""" | |
| def register_ai_agent(self, agent_id: str, name: str, agent_type: str = "ai_agent") -> str: | |
| """Register AI agent via MCP.""" | |
| pass | |
| def move_agent(self, agent_id: str, direction: str) -> Dict: | |
| """Move AI agent.""" | |
| pass | |
| def send_chat(self, agent_id: str, message: str) -> Dict: | |
| """Send chat message from AI agent.""" | |
| pass | |
| def get_game_state(self) -> Dict: | |
| """Get current game state.""" | |
| pass | |
| class IPluginService(ABC): | |
| """Interface for plugin management service.""" | |
| def load_plugins(self) -> int: | |
| """Load all plugins from plugins directory.""" | |
| pass | |
| def load_plugin(self, plugin_path: str) -> bool: | |
| """Load a specific plugin.""" | |
| pass | |
| def unload_plugin(self, plugin_id: str) -> bool: | |
| """Unload a plugin.""" | |
| pass | |
| def get_loaded_plugins(self) -> List[str]: | |
| """Get list of loaded plugin IDs.""" | |
| pass | |
| def reload_plugin(self, plugin_id: str) -> bool: | |
| """Reload a plugin (hot-reload).""" | |
| pass | |