78 lines
2.8 KiB
Markdown
78 lines
2.8 KiB
Markdown
# Runegate Handler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbRunegateHandler` class. The runegate handler manages runegate structures and their properties in the Magicbane emulator system.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbRunegateHandler.java`
|
||
|
|
**Class:** `dbRunegateHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Table(s)
|
||
|
|
- **Table Name:** `obj_runegate`
|
||
|
|
- **Description:** Core runegate information including location, properties, and activation status
|
||
|
|
- **Columns:**
|
||
|
|
- UID (Primary Key)
|
||
|
|
- name
|
||
|
|
- description
|
||
|
|
- locationX
|
||
|
|
- locationY
|
||
|
|
- locationZ
|
||
|
|
- isActive
|
||
|
|
- activationTime
|
||
|
|
- cooldownPeriod
|
||
|
|
- destinationRealmID
|
||
|
|
|
||
|
|
### Related Tables
|
||
|
|
|
||
|
|
| Table Name | Description | Relationship |
|
||
|
|
|------------|-------------|--------------|
|
||
|
|
| `obj_runegate_connection` | Links runegates to their destinations | SourceRunegateID → obj_runegate.UID, DestinationRunegateID → obj_runegate.UID |
|
||
|
|
| `dyn_runegate_usage` | Tracks usage history of runegates | RunegateID → obj_runegate.UID, CharacterID → obj_character.UID |
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### Get Runegate by ID
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `obj_runegate` WHERE `UID`=?
|
||
|
|
```
|
||
|
|
**File:** `dbRunegateHandler.java`, Line ~60
|
||
|
|
|
||
|
|
### Get Active Runegates
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `obj_runegate` WHERE `isActive`=1
|
||
|
|
```
|
||
|
|
**File:** `dbRunegateHandler.java`, Line ~85
|
||
|
|
|
||
|
|
### Get Runegate by Location
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `obj_runegate` WHERE `locationX`=? AND `locationY`=? AND `locationZ`=?
|
||
|
|
```
|
||
|
|
**File:** `dbRunegateHandler.java`, Line ~120
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Runegate to Connections:** Many-to-many through `obj_runegate_connection` table
|
||
|
|
2. **Runegate to Usage History:** One-to-many (via `dyn_runegate_usage.RunegateID`)
|
||
|
|
3. **Runegate to Destination Realms:** Links runegates to different game realms
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `name` | `obj_runegate.name` | Runegate name |
|
||
|
|
| `description` | `obj_runegate.description` | Description of the runegate |
|
||
|
|
| `locationX` | `obj_runegate.locationX` | X coordinate of runegate location |
|
||
|
|
| `locationY` | `obj_runegate.locationY` | Y coordinate of runegate location |
|
||
|
|
| `locationZ` | `obj_runegate.locationZ` | Z coordinate of runegate location |
|
||
|
|
| `isActive` | `obj_runegate.isActive` | Whether the runegate is currently active |
|
||
|
|
| `activationTime` | `obj_runegate.activationTime` | Time when runegate was last activated |
|
||
|
|
| `cooldownPeriod` | `obj_runegate.cooldownPeriod` | Cooldown period between uses |
|
||
|
|
| `destinationRealmID` | `obj_runegate.destinationRealmID` | Realm ID for destination |
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
- Runegates function as teleportation devices in the game world
|
||
|
|
- They can connect to other runegates in different locations or realms
|
||
|
|
- The system tracks usage history for balance and maintenance purposes
|