Add NPC interaction system with memory and quest generation
- Introduced a new NPC system with dynamic NPCs and conversation handling. - Implemented NPC memory using SQLite to log conversations and manage relationships. - Added commands for talking to NPCs, listing available NPCs, and generating quests. - Updated database schema to support NPC conversations and relationships. - Refactored code structure to separate concerns into cogs and handlers.
This commit is contained in:
@@ -203,6 +203,8 @@ class DatabaseManager:
|
||||
query = f"{query} ({', '.join(keys)}) VALUES ({placeholders})"
|
||||
values = [tuple(data.values()) for data in params]
|
||||
|
||||
connection = None
|
||||
cursor = None
|
||||
try:
|
||||
connection = self.get_connection()
|
||||
cursor = connection.cursor()
|
||||
@@ -213,10 +215,13 @@ class DatabaseManager:
|
||||
)
|
||||
except mysql.connector.Error as err:
|
||||
logger.error(f"Bulk insert failed: {err}")
|
||||
connection.rollback() # Roll back on error
|
||||
if connection:
|
||||
connection.rollback() # Roll back on error
|
||||
finally:
|
||||
cursor.close()
|
||||
connection.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if connection:
|
||||
connection.close()
|
||||
|
||||
def delete(self, table_name: str, condition: dict) -> None:
|
||||
"""Deletes a record from the specified table based on the condition provided."""
|
||||
|
||||
Reference in New Issue
Block a user