forked from MagicBane/Server
81 lines
2.8 KiB
Markdown
81 lines
2.8 KiB
Markdown
# Skill Base Handler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbSkillBaseHandler` class. The skill base handler manages the fundamental definitions and properties of skills in the Magicbane emulator system.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbSkillBaseHandler.java`
|
||
|
|
**Class:** `dbSkillBaseHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Table(s)
|
||
|
|
- **Table Name:** `obj_skillbase`
|
||
|
|
- **Description:** Core skill base information including name, description, and activation properties
|
||
|
|
- **Columns:**
|
||
|
|
- UID (Primary Key)
|
||
|
|
- name
|
||
|
|
- description
|
||
|
|
- skillType
|
||
|
|
- activationType
|
||
|
|
- cooldownTime
|
||
|
|
- duration
|
||
|
|
- maxLevel
|
||
|
|
- cost
|
||
|
|
- iconID
|
||
|
|
|
||
|
|
### Related Tables
|
||
|
|
|
||
|
|
| Table Name | Description | Relationship |
|
||
|
|
|------------|-------------|--------------|
|
||
|
|
| `obj_character_skill` | Tracks character-specific skill levels and status | CharacterID → obj_character.UID, SkillID → obj_skillbase.UID |
|
||
|
|
| `static_skill_requirement` | Stores requirements for unlocking skills | SkillID → obj_skillbase.UID |
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### Get Skill Base by ID
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `obj_skillbase` WHERE `UID`=?
|
||
|
|
```
|
||
|
|
**File:** `dbSkillBaseHandler.java`, Line ~60
|
||
|
|
|
||
|
|
### Get Character's Skills
|
||
|
|
```sql
|
||
|
|
SELECT s.*, cs.level, cs.isUnlocked
|
||
|
|
FROM `obj_skillbase` s
|
||
|
|
INNER JOIN `obj_character_skill` cs ON s.`UID` = cs.`SkillID`
|
||
|
|
WHERE cs.`CharacterID`=?
|
||
|
|
```
|
||
|
|
**File:** `dbSkillBaseHandler.java`, Line ~85
|
||
|
|
|
||
|
|
### Get Skill Requirements
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_skill_requirement` WHERE `SkillID`=?
|
||
|
|
```
|
||
|
|
**File:** `dbSkillBaseHandler.java`, Line ~120
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Skill Base to Character:** Many-to-many through `obj_character_skill` table
|
||
|
|
2. **Skill Base to Requirements:** One-to-many (via `static_skill_requirement.SkillID`)
|
||
|
|
3. **Skill Base to Static Data:** Skill definitions are stored in static tables
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `name` | `obj_skillbase.name` | Skill name |
|
||
|
|
| `description` | `obj_skillbase.description` | Skill description |
|
||
|
|
| `skillType` | `obj_skillbase.skillType` | Type of skill (attack, defense, support) |
|
||
|
|
| `activationType` | `obj_skillbase.activationType` | How the skill is activated |
|
||
|
|
| `cooldownTime` | `obj_skillbase.cooldownTime` | Cooldown period in seconds |
|
||
|
|
| `duration` | `obj_skillbase.duration` | Duration of skill effect |
|
||
|
|
| `maxLevel` | `obj_skillbase.maxLevel` | Maximum level for this skill |
|
||
|
|
| `cost` | `obj_skillbase.cost` | Resource cost to use skill |
|
||
|
|
| `iconID` | `obj_skillbase.iconID` | Icon identifier for UI display |
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
- Skill bases define the core properties of all skills in the game
|
||
|
|
- Skills can be activated in various ways (instant, channeling, etc.)
|
||
|
|
- The system supports both unlocked and locked skill progression
|