forked from MagicBane/Server
49 lines
2.0 KiB
Markdown
49 lines
2.0 KiB
Markdown
# dbMenuHandler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbMenuHandler` class. The menu handler manages NPC menu options and their associated data, providing functionality to retrieve menu options based on menu IDs.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbMenuHandler.java`
|
||
|
|
**Class:** `dbMenuHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Table
|
||
|
|
- **Table Name:** `static_npc_menuoption`
|
||
|
|
- **Description:** Stores NPC menu option data including text, actions, and relationships to parent menus
|
||
|
|
- **Columns:**
|
||
|
|
- menuID (Primary Key)
|
||
|
|
- optionText
|
||
|
|
- actionType
|
||
|
|
- actionValue
|
||
|
|
- nextMenuID
|
||
|
|
- conditionType
|
||
|
|
- conditionValue
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### GET_MENU_OPTIONS
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_npc_menuoption` WHERE menuID = ?
|
||
|
|
```
|
||
|
|
**File:** `dbMenuHandler.java`, Line ~25
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Menu Options to Menu:** One-to-many relationship via menuID field referencing parent menu structure
|
||
|
|
2. **Menu Options to Next Menu:** Many-to-one relationship via nextMenuID field for navigation between menus
|
||
|
|
3. **Menu Options to Conditions:** Zero-to-many relationship via conditionType and conditionValue fields for dynamic menu display
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `menuID` | `static_npc_menuoption.menuID` | Unique identifier for the parent menu |
|
||
|
|
| `optionText` | `static_npc_menuoption.optionText` | Text displayed for this menu option |
|
||
|
|
| `actionType` | `static_npc_menuoption.actionType` | Type of action to perform when selected |
|
||
|
|
| `actionValue` | `static_npc_menuoption.actionValue` | Value associated with the action |
|
||
|
|
| `nextMenuID` | `static_npc_menuoption.nextMenuID` | ID of the menu to navigate to when selected |
|
||
|
|
| `conditionType` | `static_npc_menuoption.conditionType` | Type of condition for displaying this option |
|
||
|
|
| `conditionValue` | `static_npc_menuoption.conditionValue` | Value associated with the condition |
|