91 lines
3.2 KiB
Markdown
91 lines
3.2 KiB
Markdown
# dbLootHandler Documentation
|
|||
|
|
|
||
|
|
## Overview
|
||
|
|
This document describes the database relationships and interactions for the `dbLootHandler` class. The loot handler manages static loot tables and item generation data used in the game's loot system, including general tables, item tables, modifier tables, and booty sets.
|
||
|
|
|
||
|
|
## Handler Class
|
||
|
|
**File:** `src/engine/db/handlers/dbLootHandler.java`
|
||
|
|
**Class:** `dbLootHandler`
|
||
|
|
**Extends:** `dbHandlerBase`
|
||
|
|
|
||
|
|
## Database Tables
|
||
|
|
|
||
|
|
### Main Tables
|
||
|
|
- **Table Name:** `static_loot_gen`
|
||
|
|
- **Description:** Stores general loot table entries for item generation
|
||
|
|
- **Columns:**
|
||
|
|
- genTable (Primary Key)
|
||
|
|
- itemID
|
||
|
|
- weight
|
||
|
|
- minLevel
|
||
|
|
- maxLevel
|
||
|
|
|
||
|
|
### Related Tables
|
||
|
|
|
||
|
|
| Table Name | Description | Relationship |
|
||
|
|
|------------|-------------|--------------|
|
||
|
|
| `static_loot_item` | Stores item-specific loot table entries | One-to-many with genTable |
|
||
|
|
| `static_loot_mod` | Stores modifier information for loot items | One-to-many with modTable |
|
||
|
|
| `static_loot_modtype` | Defines modifier types used in loot systems | One-to-many with modType |
|
||
|
|
| `static_loot_bootySet` | Stores booty set definitions for loot generation | One-to-many with bootySet |
|
||
|
|
|
||
|
|
## Key Queries
|
||
|
|
|
||
|
|
### LOAD_GEN_ITEM_TABLES
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_loot_gen`
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~32
|
||
|
|
|
||
|
|
### LOAD_ITEM_TABLES
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_loot_item`
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~64
|
||
|
|
|
||
|
|
### LOAD_MOD_TABLES
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_loot_mod`
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~96
|
||
|
|
|
||
|
|
### LOAD_MOD_TYPE_TABLES
|
||
|
|
```sql
|
||
|
|
SELECT * FROM `static_loot_modtype`
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~128
|
||
|
|
|
||
|
|
### LOAD_BOOTY_TABLES
|
||
|
|
```sql
|
||
|
|
SELECT * FROM static_loot_bootySet
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~160
|
||
|
|
|
||
|
|
### LOAD_ENCHANT_VALUES
|
||
|
|
```sql
|
||
|
|
SELECT `IDString`, `minMod` FROM `static_power_effectmod` WHERE `modType` = ?
|
||
|
|
```
|
||
|
|
**File:** `dbLootHandler.java`, Line ~192
|
||
|
|
|
||
|
|
## Relationships
|
||
|
|
|
||
|
|
1. **Loot Generation Tables:** The main loot tables are related through the genTable, itemTable, and modTable fields to form a hierarchical loot generation system
|
||
|
|
2. **Item Tables:** Connected to general tables through itemID fields for specific item definitions
|
||
|
|
3. **Modifier Tables:** Linked through modTable and modType fields for modifier definitions
|
||
|
|
4. **Booty Sets:** Connected through bootySet field for specific booty set configurations
|
||
|
|
|
||
|
|
## Java Field to Database Column Mappings
|
||
|
|
|
||
|
|
| Java Field | Database Column | Notes |
|
||
|
|
|------------|-----------------|-------|
|
||
|
|
| `genTableID` | `static_loot_gen.genTable` | Unique identifier for the loot table |
|
||
|
|
| `itemID` | `static_loot_gen.itemID` | Item ID for this loot entry |
|
||
|
|
| `weight` | `static_loot_gen.weight` | Weight for random selection |
|
||
|
|
| `minLevel` | `static_loot_gen.minLevel` | Minimum level requirement |
|
||
|
|
| `maxLevel` | `static_loot_gen.maxLevel` | Maximum level requirement |
|
||
|
|
| `itemTableID` | `static_loot_item.itemTable` | Item table identifier |
|
||
|
|
| `modTableID` | `static_loot_mod.modTable` | Modifier table identifier |
|
||
|
|
| `modTypeID` | `static_loot_modtype.modType` | Modifier type identifier |
|
||
|
|
| `bootySetID` | `static_loot_bootySet.bootySet` | Booty set identifier |
|
||
|
|
| `IDString` | `static_power_effectmod.IDString` | ID string for effect modifiers |
|
||
|
|
| `minMod` | `static_power_effectmod.minMod` | Minimum modifier value |
|