forked from MagicBane/Server
120 lines
6.8 KiB
Markdown
120 lines
6.8 KiB
Markdown
# dbBlueprintHandler Documentation
|
|
|
|
## Overview
|
|
The `dbBlueprintHandler` is responsible for managing building blueprint data and door number mappings in the Magicbane database. This handler loads blueprint information used for building construction and handles door mesh-to-number mappings.
|
|
|
|
## Database Table Structure
|
|
|
|
### Table: `static_building_blueprint`
|
|
|
|
| Column Name | Data Type | Nullable | Key | Description |
|
|
|-------------|-----------|----------|-----|-------------|
|
|
| Rank0UUID | bigint unsigned | NO | PRIMARY | Unique identifier for the blueprint (rank 0) |
|
|
| MeshName | varchar(100) | NO | | Name of the mesh used for the building |
|
|
| BuildingGroup | enum | NO | | Group classification of the building type |
|
|
| MaintGroup | varchar(45) | YES | | Maintenance group associated with the building |
|
|
| Rank1UUID | bigint unsigned | YES | | UUID for rank 1 upgrade |
|
|
| Rank2UUID | bigint unsigned | YES | | UUID for rank 2 upgrade |
|
|
| Rank3UUID | bigint unsigned | YES | | UUID for rank 3 upgrade |
|
|
| Rank4UUID | bigint unsigned | YES | | UUID for rank 4 upgrade |
|
|
| Rank5UUID | bigint unsigned | YES | | UUID for rank 5 upgrade |
|
|
| Rank6UUID | bigint unsigned | YES | | UUID for rank 6 upgrade |
|
|
| Rank7UUID | bigint unsigned | YES | | UUID for rank 7 upgrade |
|
|
| UpgradeCost | int | YES | | Cost to upgrade the building |
|
|
| UpgradeTime | int | YES | | Time required to upgrade the building |
|
|
| MaxHP | int | YES | | Maximum hit points of the building |
|
|
| MaxGold | int | YES | | Maximum gold storage capacity |
|
|
| MaxLevel | int | YES | | Maximum level for this building |
|
|
| MaxRank | int | YES | | Maximum rank for this building |
|
|
| MinLevel | int | YES | | Minimum level required to build |
|
|
| Scale | float | YES | | Scale factor for the building mesh |
|
|
| SizeX | float | YES | | X dimension size |
|
|
| SizeY | float | YES | | Y dimension size |
|
|
| SizeZ | float | YES | | Z dimension size |
|
|
| DoorCount | int | YES | | Number of doors in this building |
|
|
| MaxDoorCount | int | YES | | Maximum number of doors allowed |
|
|
| IsWall | tinyint(1) | YES | | Flag indicating if building is a wall |
|
|
| IsGate | tinyint(1) | YES | | Flag indicating if building is a gate |
|
|
| IsTower | tinyint(1) | YES | | Flag indicating if building is a tower |
|
|
| IsKeep | tinyint(1) | YES | | Flag indicating if building is a keep |
|
|
| IsFortress | tinyint(1) | YES | | Flag indicating if building is a fortress |
|
|
| IsCastle | tinyint(1) | YES | | Flag indicating if building is a castle |
|
|
| IsBarracks | tinyint(1) | YES | | Flag indicating if building is barracks |
|
|
| IsChurch | tinyint(1) | YES | | Flag indicating if building is a church |
|
|
| IsForge | tinyint(1) | YES | | Flag indicating if building is a forge |
|
|
| IsSpire | tinyint(1) | YES | | Flag indicating if building is a spire |
|
|
| IsShrine | tinyint(1) | YES | | Flag indicating if building is a shrine |
|
|
| IsRunegate | tinyint(1) | YES | | Flag indicating if building is a runegate |
|
|
| IsMine | tinyint(1) | YES | | Flag indicating if building is a mine |
|
|
| IsWarehouse | tinyint(1) | YES | | Flag indicating if building is a warehouse |
|
|
|
|
### Table: `static_building_doors`
|
|
|
|
| Column Name | Data Type | Nullable | Key | Description |
|
|
|-------------|-----------|----------|-----|-------------|
|
|
| doorMeshUUID | int | NO | PRIMARY | Unique identifier for the door mesh |
|
|
| doorNumber | int | NO | | Door number associated with this mesh |
|
|
|
|
## Java Field to Database Column Mapping
|
|
|
|
| Java Field | Database Column | Type | Description |
|
|
|------------|-----------------|------|-------------|
|
|
| blueprint.getBlueprintUUID() | Rank0UUID | bigint unsigned | Blueprint unique identifier |
|
|
| blueprint.getMeshName() | MeshName | varchar(100) | Name of the building mesh |
|
|
| blueprint.getBuildingGroup() | BuildingGroup | enum | Group classification of the building |
|
|
| blueprint.getMaintGroup() | MaintGroup | varchar(45) | Maintenance group for this building |
|
|
| blueprint.getRank1UUID() | Rank1UUID | bigint unsigned | UUID for rank 1 upgrade |
|
|
| blueprint.getRank2UUID() | Rank2UUID | bigint unsigned | UUID for rank 2 upgrade |
|
|
| blueprint.getRank3UUID() | Rank3UUID | bigint unsigned | UUID for rank 3 upgrade |
|
|
| blueprint.getRank4UUID() | Rank4UUID | bigint unsigned | UUID for rank 4 upgrade |
|
|
| blueprint.getRank5UUID() | Rank5UUID | bigint unsigned | UUID for rank 5 upgrade |
|
|
| blueprint.getRank6UUID() | Rank6UUID | bigint unsigned | UUID for rank 6 upgrade |
|
|
| blueprint.getRank7UUID() | Rank7UUID | bigint unsigned | UUID for rank 7 upgrade |
|
|
| blueprint.getUpgradeCost() | UpgradeCost | int | Cost to upgrade the building |
|
|
| blueprint.getUpgradeTime() | UpgradeTime | int | Time required to upgrade |
|
|
| blueprint.getMaxHP() | MaxHP | int | Maximum hit points |
|
|
| blueprint.getMaxGold() | MaxGold | int | Maximum gold storage |
|
|
| blueprint.getMaxLevel() | MaxLevel | int | Maximum level for this building |
|
|
| blueprint.getMaxRank() | MaxRank | int | Maximum rank |
|
|
| blueprint.getMinLevel() | MinLevel | int | Minimum level required |
|
|
| blueprint.getScale() | Scale | float | Scale factor for mesh |
|
|
| blueprint.getSizeX() | SizeX | float | X dimension size |
|
|
| blueprint.getSizeY() | SizeY | float | Y dimension size |
|
|
| blueprint.getSizeZ() | SizeZ | float | Z dimension size |
|
|
| blueprint.getDoorCount() | DoorCount | int | Number of doors |
|
|
| blueprint.getMaxDoorCount() | MaxDoorCount | int | Maximum number of doors |
|
|
| blueprint.getIsWall() | IsWall | tinyint(1) | Wall flag |
|
|
| blueprint.getIsGate() | IsGate | tinyint(1) | Gate flag |
|
|
| blueprint.getIsTower() | IsTower | tinyint(1) | Tower flag |
|
|
| blueprint.getIsKeep() | IsKeep | tinyint(1) | Keep flag |
|
|
| blueprint.getIsFortress() | IsFortress | tinyint(1) | Fortress flag |
|
|
| blueprint.getIsCastle() | IsCastle | tinyint(1) | Castle flag |
|
|
| blueprint.getIsBarracks() | IsBarracks | tinyint(1) | Barracks flag |
|
|
| blueprint.getIsChurch() | IsChurch | tinyint(1) | Church flag |
|
|
| blueprint.getIsForge() | IsForge | tinyint(1) | Forge flag |
|
|
| blueprint.getIsSpire() | IsSpire | tinyint(1) | Spire flag |
|
|
| blueprint.getIsShrine() | IsShrine | tinyint(1) | Shrine flag |
|
|
| blueprint.getIsRunegate() | IsRunegate | tinyint(1) | Runegate flag |
|
|
| blueprint.getIsMine() | IsMine | tinyint(1) | Mine flag |
|
|
| blueprint.getIsWarehouse() | IsWarehouse | tinyint(1) | Warehouse flag |
|
|
|
|
## Key Queries
|
|
|
|
### LOAD_ALL_DOOR_NUMBERS
|
|
- **Query**: `SELECT * FROM static_building_doors ORDER BY doorMeshUUID ASC`
|
|
- **Note**: Loads all door mesh-to-number mappings for building doors
|
|
|
|
### LOAD_ALL_BLUEPRINTS
|
|
- **Query**: `SELECT * FROM static_building_blueprint`
|
|
- **Note**: Loads all blueprint definitions for buildings
|
|
|
|
## Relationships
|
|
|
|
### Foreign Key Relationships
|
|
- None explicitly defined in the handler code (these are likely static lookup tables)
|
|
|
|
### Associated Objects
|
|
- **Blueprint**: Building construction data with mesh information and upgrade paths
|
|
- **Door**: Door mesh mappings used for building construction
|
|
|