forked from MagicBane/Server
47 lines
1.6 KiB
Markdown
47 lines
1.6 KiB
Markdown
# dbEnchantmentHandler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbEnchantmentHandler` class. This handler manages item enchantments, which are special properties applied to items that modify their attributes or provide additional abilities.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbEnchantmentHandler.java`
|
||
|
|
**Class:** `dbEnchantmentHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Enchantment Table
|
||
|
|
- **Table Name:** `dyn_item_enchantment`
|
||
|
|
- **Description:** Stores enchantment information for items, including the type of power action and rank level
|
||
|
|
- **Columns:**
|
||
|
|
- itemID (Primary Key)
|
||
|
|
- powerAction
|
||
|
|
- rank
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### Get Enchantments by Item ID
|
||
|
|
```sql
|
||
|
|
SELECT * FROM dyn_item_enchantment WHERE `itemID` = ?
|
||
|
|
```
|
||
|
|
**File:** `dbEnchantmentHandler.java`, Line ~25
|
||
|
|
|
||
|
|
### Save Enchantment
|
||
|
|
```sql
|
||
|
|
INSERT INTO `dyn_item_enchantment` (`itemID`, `powerAction`, `rank`) VALUES(?,?,?)
|
||
|
|
```
|
||
|
|
**File:** `dbEnchantmentHandler.java`, Line ~40
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Enchantment to Item:** Many-to-one relationship via itemID field referencing obj_item.UID
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `itemID` | `dyn_item_enchantment.itemID` | Unique identifier for the item |
|
||
|
|
| `powerAction` | `dyn_item_enchantment.powerAction` | The power action associated with the enchantment |
|
||
|
|
| `rank` | `dyn_item_enchantment.rank` | The rank or strength level of the enchantment |
|
||
|
|
| `other fields...` | Various columns | Other properties related to item enchantments |
|