forked from MagicBane/Server
2.6 KiB
2.6 KiB
Vendor Dialog Handler Documentation
Overview
This document describes the database relationships and interactions for the dbVendorDialogHandler class. The vendor dialog handler manages the dialog systems and interaction options for NPC vendors in the Magicbane emulator system.
Handler Class
File: src/engine/db/handlers/dbVendorDialogHandler.java
Class: dbVendorDialogHandler
Extends: dbHandlerBase
Database Tables
Main Table(s)
- Table Name:
static_npc_dialog - Description: Core vendor dialog information including text, options, and responses
- Columns:
- UID (Primary Key)
- npcID
- dialogText
- responseType
- nextDialogID
- isFinal
- triggerEvent
Related Tables
| Table Name | Description | Relationship |
|---|---|---|
static_npc_dialog_option |
Defines available options for each dialog | DialogID → static_npc_dialog.UID |
obj_npc |
Links to the NPC that has this dialog system | npcID → obj_npc.UID |
Key Queries
Get Dialog by ID
SELECT * FROM `static_npc_dialog` WHERE `UID`=?
File: dbVendorDialogHandler.java, Line ~60
Get Dialog Options for Dialog
SELECT * FROM `static_npc_dialog_option` WHERE `dialogID`=?
File: dbVendorDialogHandler.java, Line ~85
Get Initial Dialog for NPC
SELECT * FROM `static_npc_dialog` WHERE `npcID`=? AND `nextDialogID` IS NULL
File: dbVendorDialogHandler.java, Line ~120
Relationships
- Dialog to Options: One-to-many (via
dialogID→ static_npc_dialog.UID) - Dialog to NPC: Many-to-one (via
npcID→ obj_npc.UID) - Dialog to Next Dialog: Chain of dialog progression through
nextDialogID
Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|---|---|---|
npcID |
static_npc_dialog.npcID |
Reference to the NPC this dialog belongs to |
dialogText |
static_npc_dialog.dialogText |
Text displayed in the dialog |
responseType |
static_npc_dialog.responseType |
Type of response expected (buy, sell, quest) |
nextDialogID |
static_npc_dialog.nextDialogID |
ID of next dialog in sequence |
isFinal |
static_npc_dialog.isFinal |
Whether this is the final dialog in chain |
triggerEvent |
static_npc_dialog.triggerEvent |
Event that triggers this dialog |
Notes
- Vendor dialogs provide interactive communication with NPCs
- Dialog systems support branching conversations and quest progression
- The system handles complex dialog chains with multiple options and outcomes