Chris4K's picture
Upload 195 files
4c75d73 verified
Raw
History Blame Contribute Delete
1.89 kB
"""
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."""
@abstractmethod
def get_response(self, npc_id: str, message: str, player_id: str = None) -> str:
"""Generate response to player interaction."""
pass
@abstractmethod
def get_greeting(self, npc_id: str, player_id: str = None) -> str:
"""Get greeting message for player."""
pass
@abstractmethod
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."""
@property
@abstractmethod
def addon_id(self) -> str:
"""Unique identifier for this addon."""
pass
@property
@abstractmethod
def addon_name(self) -> str:
"""Display name for this addon."""
pass
@property
@abstractmethod
def npc_id(self) -> str:
"""ID of the NPC this addon controls."""
pass
@abstractmethod
def get_interface(self) -> gr.Component:
"""Get Gradio interface component for this addon."""
pass
@abstractmethod
def handle_command(self, player_id: str, command: str) -> str:
"""Handle command sent to this NPC."""
pass
@abstractmethod
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