Spaces:
Runtime error
Runtime error
| """ | |
| NPC and addon interfaces. | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import Dict, Any, Optional, List | |
| import gradio as gr | |
| class INPCBehavior(ABC): | |
| """Interface for NPC behavior implementations.""" | |
| def get_response(self, npc_id: str, message: str, player_id: str = None) -> str: | |
| """Generate response to player interaction.""" | |
| pass | |
| def get_greeting(self, npc_id: str, player_id: str = None) -> str: | |
| """Get greeting message for player.""" | |
| pass | |
| def can_handle(self, npc_id: str) -> bool: | |
| """Check if this behavior can handle the given NPC.""" | |
| pass | |
| class INPCAddon(ABC): | |
| """Interface for NPC addon implementations.""" | |
| def addon_id(self) -> str: | |
| """Unique identifier for this addon.""" | |
| pass | |
| def addon_name(self) -> str: | |
| """Display name for this addon.""" | |
| pass | |
| def npc_id(self) -> str: | |
| """ID of the NPC this addon controls.""" | |
| pass | |
| def get_interface(self) -> gr.Component: | |
| """Get Gradio interface component for this addon.""" | |
| pass | |
| def handle_command(self, player_id: str, command: str) -> str: | |
| """Handle command sent to this NPC.""" | |
| pass | |
| def get_status(self) -> Dict[str, Any]: | |
| """Get current status of this addon.""" | |
| pass | |
| def initialize(self) -> bool: | |
| """Initialize the addon. Override if needed.""" | |
| return True | |
| def cleanup(self) -> bool: | |
| """Cleanup addon resources. Override if needed.""" | |
| return True | |