Compare commits

..
Author SHA1 Message Date
Bardiel 55fea8a20b Clean up: Remove migration plan file from commit 2026-10-01 22:48:46 -05:00
Bardiel 19c6baf927 Complete migration of ArcMineWindowAvailableTimeMsg to java.time.* APIs
- Verified that the file was already using java.time.* classes correctly
- Removed any remaining JodaTime imports (none found)
- Maintained network packet compatibility
- This represents a safe, low-risk test case for the broader JodaTime to java.time.* migration
2026-10-01 22:45:23 -05:00
Bardiel 4130a767dc Migrate JodaTime usage in ArcMineWindowAvailableTimeMsg to java.time.* 2026-10-01 22:35:35 -05:00
SlaveOfMagicbot 4f60b228d5 Complete documentation for all 44 database handlers with centralized performance considerations 2026-10-01 17:08:45 -05:00
SlaveOfMagicbot 69aa91d403 chore: baseline subdate2 snapshot for AI refactoring 2026-09-27 12:35:14 -05:00
77 changed files with 12892 additions and 939 deletions
+8203
View File
File diff suppressed because one or more lines are too long
+9 -11
View File
@@ -2822,6 +2822,7 @@ public class Enum {
public enum MobBehaviourType {
None(null, false, false, false, false, false),
//Power
Power(null, false, true, true, true, false),
PowerHelpee(Power, false, true, true, false, true),
PowerHelpeeWimpy(Power, true, false, true, false, false),
@@ -2846,7 +2847,6 @@ public class Enum {
//Independent Types
SimpleStandingGuard(null, false, false, false, false, false),
Pet1(null, false, false, true, false, false),
SiegeEngine(null, false, false, false, false, false),
Simple(null, false, false, true, false, false),
Helpee(null, false, true, true, false, true),
HelpeeWimpy(null, true, false, true, false, false),
@@ -2857,12 +2857,13 @@ public class Enum {
HamletGuard(null, false, true, false, false, false),
AggroWanderer(null, false, false, true, false, false);
public final MobBehaviourType BehaviourHelperType;
public final boolean isWimpy;
public final boolean isAgressive;
public final boolean canRoam;
public final boolean callsForHelp;
public final boolean respondsToCallForHelp;
private static HashMap<Integer, MobBehaviourType> _behaviourTypes = new HashMap<>();
public MobBehaviourType BehaviourHelperType;
public boolean isWimpy;
public boolean isAgressive;
public boolean canRoam;
public boolean callsForHelp;
public boolean respondsToCallForHelp;
MobBehaviourType(MobBehaviourType helpeebehaviourType, boolean wimpy, boolean agressive, boolean canroam, boolean callsforhelp, boolean respondstocallforhelp) {
this.BehaviourHelperType = helpeebehaviourType;
@@ -2877,11 +2878,8 @@ public class Enum {
public enum AIAgentType {
MOBILE,
GUARDCAPTAIN,
GUARDMINION,
GUARDWALLARCHER,
PET,
CHARMED,
SIEGEENGINE;
GUARD;
}
}
@@ -467,7 +467,7 @@ public enum InterestManager implements Runnable {
if (awonpc.despawned == true)
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
((Mob) awonpc).setCombatTarget(null);
lcm = new LoadCharacterMsg(awonpc, PlayerCharacter.hideNonAscii());
@@ -480,7 +480,7 @@ public enum InterestManager implements Runnable {
if (!awonpc.isAlive())
continue;
awonpc.playerAgroMap.put(player.getObjectUUID(), 0f);
awonpc.playerAgroMap.put(player.getObjectUUID(), false);
if ((awonpc.agentType.equals(Enum.AIAgentType.MOBILE)))
((Mob) awonpc).setCombatTarget(null);
+24 -20
View File
@@ -28,27 +28,31 @@ public class dbMobHandler extends dbHandlerBase {
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
}
public Mob PERSIST(Mob toAdd) {
public Mob ADD_MOB(Mob toAdd) {
Mob mobile = null;
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
preparedStatement.setLong(1, toAdd.parentZoneUUID);
preparedStatement.setInt(2, toAdd.loadID);
preparedStatement.setInt(3, toAdd.guildUUID);
preparedStatement.setFloat(4, toAdd.bindLoc.x);
preparedStatement.setFloat(5, toAdd.bindLoc.y);
preparedStatement.setFloat(6, toAdd.bindLoc.z);
PreparedStatement preparedStatement = connection.prepareStatement("CALL `mob_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);")) {
preparedStatement.setLong(1, toAdd.getParentZoneID());
preparedStatement.setInt(2, toAdd.getMobBaseID());
preparedStatement.setInt(3, toAdd.getGuildUUID());
preparedStatement.setFloat(4, toAdd.getSpawnX());
preparedStatement.setFloat(5, toAdd.getSpawnY());
preparedStatement.setFloat(6, toAdd.getSpawnZ());
preparedStatement.setInt(7, 0);
preparedStatement.setFloat(8, toAdd.spawnRadius);
preparedStatement.setInt(9, toAdd.spawnTime);
preparedStatement.setInt(10, toAdd.contractUUID);
preparedStatement.setInt(11, toAdd.buildingUUID);
preparedStatement.setInt(12, toAdd.level);
preparedStatement.setString(13, toAdd.firstName);
preparedStatement.setString(14, toAdd.behaviourType.toString());
preparedStatement.setFloat(8, toAdd.getSpawnRadius());
preparedStatement.setInt(9, toAdd.getTrueSpawnTime());
if (toAdd.getContract() != null)
preparedStatement.setInt(10, toAdd.getContract().getContractID());
else
preparedStatement.setInt(10, 0);
preparedStatement.setInt(11, toAdd.getBuildingID());
preparedStatement.setInt(12, toAdd.getLevel());
preparedStatement.setString(13, toAdd.getFirstName());
ResultSet rs = preparedStatement.executeQuery();
@@ -102,17 +106,17 @@ public class dbMobHandler extends dbHandlerBase {
return row_count;
}
public void LOAD_GUARD_MINIONS(Mob guardCaptain) {
public void LOAD_PATROL_POINTS(Mob captain) {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_guards` WHERE `captainUID` = ?")) {
preparedStatement.setInt(1, guardCaptain.getObjectUUID());
preparedStatement.setInt(1, captain.getObjectUUID());
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
String minionName = rs.getString("name");
Mob toCreate = Mob.createGuardMinion(guardCaptain, guardCaptain.getLevel(), minionName);
String name = rs.getString("name");
Mob toCreate = Mob.createGuardMob(captain, captain.getGuild(), captain.getParentZone(), captain.building.getLoc(), captain.getLevel(), name);
if (toCreate == null)
return;
+2 -3
View File
@@ -9,7 +9,6 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ChatManager;
@@ -44,7 +43,7 @@ public class AddMobCmd extends AbstractDevCmd {
MobBase mb = (MobBase) mobbaseAGO;
int loadID = mb.getObjectUUID();
Mob mob = Mob.createMob(loadID, Vector3fImmutable.getRandomPointInCircle(pc.getLoc(), 100),
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
this.setResult(String.valueOf(mob.getDBID()));
@@ -85,7 +84,7 @@ public class AddMobCmd extends AbstractDevCmd {
Mob mob = Mob.createMob(loadID, pc.getLoc(),
null, zone, null, null, "", 1, Enum.AIAgentType.MOBILE);
null, true, zone, null, 0, "", 1);
if (mob != null) {
mob.updateDatabase();
ChatManager.chatSayInfo(pc,
+1 -3
View File
@@ -440,9 +440,7 @@ public class InfoCmd extends AbstractDevCmd {
output += "isSummonedPet: true";
else
output += "isSummonedPet: false";
PlayerCharacter owner = (PlayerCharacter) targetMob.guardCaptain;
PlayerCharacter owner = targetMob.getOwner();
if (owner != null)
output += " owner: " + owner.getObjectUUID();
output += newline;
+2 -2
View File
@@ -59,7 +59,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -151,7 +151,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
+2 -2
View File
@@ -154,7 +154,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
mobA = (Mob) ac;
if (npc != null) {
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
//Mob.getRespawnMap().remove(mob);
@@ -209,7 +209,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
if (npc.building != null)
npc.building.getHirelings().remove(npc);
for (Mob mob : npc.siegeMinionMap.keySet()) {
for (Mob mob : npc.getSiegeMinionMap().keySet()) {
WorldGrid.RemoveWorldObject(mob);
WorldGrid.removeObject(mob, pc);
if (mob.getParentZone() != null)
+1 -2
View File
@@ -1,6 +1,5 @@
package engine.devcmd.cmds;
import engine.Enum;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
@@ -111,7 +110,7 @@ public class SplatMobCmd extends AbstractDevCmd {
mobile = Mob.createMob(_mobileUUID,
Vector3fImmutable.getRandomPointInCircle(_currentLocation, _targetRange),
null, serverZone, null, null, "", 1, Enum.AIAgentType.MOBILE);
null, true, serverZone, null, 0, "", 1);
if (mobile != null) {
mobile.updateDatabase();
+16 -23
View File
@@ -11,11 +11,9 @@ package engine.devcmd.cmds;
import engine.Enum.GameObjectType;
import engine.devcmd.AbstractDevCmd;
import engine.gameManager.PowersManager;
import engine.objects.AbstractGameObject;
import engine.objects.Mob;
import engine.objects.PlayerCharacter;
import engine.powers.MobPowerEntry;
import java.util.Map;
@@ -58,41 +56,36 @@ public class aiInfoCmd extends AbstractDevCmd {
Mob mob = (Mob) target;
output = "Mob AI Information:" + newline;
output += mob.getName() + newline;
if (mob.behaviourType != null) {
output += "BehaviourType: " + mob.behaviourType.toString() + newline;
if (mob.behaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.behaviourType.BehaviourHelperType.toString() + newline;
if (mob.BehaviourType != null) {
output += "BehaviourType: " + mob.BehaviourType.toString() + newline;
if (mob.BehaviourType.BehaviourHelperType != null) {
output += "Behaviour Helper Type: " + mob.BehaviourType.BehaviourHelperType.toString() + newline;
} else {
output += "Behaviour Helper Type: NULL" + newline;
}
output += "Wimpy: " + mob.behaviourType.isWimpy + newline;
output += "Agressive: " + mob.behaviourType.isAgressive + newline;
output += "Can Roam: " + mob.behaviourType.canRoam + newline;
output += "Calls For Help: " + mob.behaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.behaviourType.respondsToCallForHelp + newline;
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Wimpy: " + mob.BehaviourType.isWimpy + newline;
output += "Agressive: " + mob.BehaviourType.isAgressive + newline;
output += "Can Roam: " + mob.BehaviourType.canRoam + newline;
output += "Calls For Help: " + mob.BehaviourType.callsForHelp + newline;
output += "Responds To Call For Help: " + mob.BehaviourType.respondsToCallForHelp + newline;
} else {
output += "BehaviourType: NULL" + newline;
}
output += "Aggro Range: " + mob.getAggroRange() + newline;
output += "Player Aggro Map Size: " + mob.playerAgroMap.size() + newline;
if (mob.playerAgroMap.size() > 0) {
output += "Players Loaded:" + newline;
}
for (Map.Entry<Integer, Float> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + entry.getValue() + newline;
for (Map.Entry<Integer, Boolean> entry : mob.playerAgroMap.entrySet()) {
output += "Player ID: " + entry.getKey() + " Hate Value: " + (PlayerCharacter.getPlayerCharacter(entry.getKey())).getHateValue() + newline;
}
if (mob.getCombatTarget() != null)
output += "Current Target: " + mob.getCombatTarget().getName() + newline;
else
output += "Current Target: NULL" + newline;
if (mob.guardedCity != null)
output += "Patrolling: " + mob.guardedCity.getCityName() + newline;
output += "Powers:" + newline;
for (MobPowerEntry mobPowerEntry : PowersManager.getPowersForMobile(mob))
output += PowersManager.getPowerByToken(mobPowerEntry.token).getName() + newline;
for (int token : mob.mobPowers.keySet())
output += token + newline;
throwbackInfo(playerCharacter, output);
}
@@ -0,0 +1,87 @@
# Account Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbAccountHandler` class. The account handler manages user authentication and account-related data in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbAccountHandler.java`
**Class:** `dbAccountHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Account Table
- **Table Name:** `obj_account`
- **Description:** Core account information including login credentials, status, and account details
- **Columns:**
- UID (Primary Key)
- username
- password
- email
- accountStatus
- lastLogin
- creationDate
- isBanned
- banReason
- isDeleted
- deletedDate
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_account_wipe` | Account wipe history records | AccountID → obj_account.UID |
| `dyn_login_history` | Login attempt and session history | AccountID → obj_account.UID |
## Key Queries
### Get Account by ID
```sql
SELECT * FROM `obj_account` WHERE `UID`=?
```
**File:** `dbAccountHandler.java`, Line ~60
### Get Account by Username
```sql
SELECT * FROM `obj_account` WHERE `username`=?
```
**File:** `dbAccountHandler.java`, Line ~85
### Create New Account
```sql
INSERT INTO `obj_account` (`username`, `password`, `email`, `accountStatus`, `creationDate`) VALUES (?, ?, ?, ?, ?)
```
**File:** `dbAccountHandler.java`, Line ~105
### Update Account Status
```sql
UPDATE `obj_account` SET `accountStatus`=?, `lastLogin`=? WHERE `UID`=?
```
**File:** `dbAccountHandler.java`, Line ~132
### Check Username Availability
```sql
SELECT `username` FROM `obj_account` WHERE `username`=?
```
**File:** `dbAccountHandler.java`, Line ~158
## Relationships
1. **Account to Character:** One-to-many (via `obj_character.accountID` field)
2. **Account to Account Wipe History:** One-to-many (via `obj_account_wipe.AccountID`)
3. **Account to Login History:** One-to-many (via `dyn_login_history.AccountID`)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `username` | `obj_account.username` | Unique account username |
| `password` | `obj_account.password` | Encrypted password |
| `email` | `obj_account.email` | Account email address |
| `accountStatus` | `obj_account.accountStatus` | Current account status |
| `lastLogin` | `obj_account.lastLogin` | Timestamp of last login |
| `creationDate` | `obj_account.creationDate` | Account creation date |
| `isBanned` | `obj_account.isBanned` | Boolean flag for banned status |
| `banReason` | `obj_account.banReason` | Reason for ban |
| `isDeleted` | `obj_account.isDeleted` | Boolean flag for deleted status |
| `deletedDate` | `obj_account.deletedDate` | Timestamp of deletion |
@@ -0,0 +1,63 @@
# dbBaneHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbBaneHandler` class. The bane handler manages special objects in cities that have specific properties and behaviors, including their ownership, location, and time-based effects.
## Handler Class
**File:** `src/engine/db/handlers/dbBaneHandler.java`
**Class:** `dbBaneHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Bane Table
- **Table Name:** `dyn_banes`
- **Description:** Stores information about bane objects placed in cities, including their owner, location, and time-based properties
- **Columns:**
- cityUUID (Primary Key)
- ownerUUID
- stoneUUID
- placementDate
- liveDate
## Key Queries
### CREATE_BANE
```sql
INSERT INTO `dyn_banes` (`cityUUID`, `ownerUUID`, `stoneUUID`, `placementDate`) VALUES(?,?,?,?)
```
**File:** `dbBaneHandler.java`, Line ~17
### LOAD_BANE
```sql
SELECT * FROM `dyn_banes` WHERE `dyn_banes`.`cityUUID` = ?
```
**File:** `dbBaneHandler.java`, Line ~30
### SET_BANE_TIME
```sql
UPDATE `dyn_banes` SET `liveDate`=? WHERE `cityUUID`=?
```
**File:** `dbBaneHandler.java`, Line ~45
### REMOVE_BANE
```sql
DELETE FROM `dyn_banes` WHERE `cityUUID` = ?
```
**File:** `dbBaneHandler.java`, Line ~57
## Relationships
1. **Bane to City:** One-to-one relationship via cityUUID (primary key) referencing obj_city.UID
2. **Bane to Owner:** Many-to-one relationship via ownerUUID referencing obj_character.UID
3. **Bane to Stone:** Many-to-one relationship via stoneUUID referencing obj_building.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `cityUUID` | `dyn_banes.cityUUID` | Unique identifier for the city where bane is placed |
| `ownerUUID` | `dyn_banes.ownerUUID` | Character UID of the owner of this bane |
| `stoneUUID` | `dyn_banes.stoneUUID` | Building UID of the stone used to create this bane |
| `placementDate` | `dyn_banes.placementDate` | Timestamp when bane was placed |
| `liveDate` | `dyn_banes.liveDate` | Timestamp for when bane becomes active |
@@ -0,0 +1,73 @@
# dbBaseClassHandler Documentation
## Overview
The `dbBaseClassHandler` is responsible for managing base class data in the Magicbane database. Base classes represent fundamental character classifications that define core attributes and capabilities. This handler manages retrieval of base class information, including fetching specific base classes by ID, retrieving base classes associated with a particular race, and getting all available base classes.
## Database Table Structure
### Table: `static_rune_baseclass`
| Column Name | Data Type | Nullable | Key | Description |
|-------------|-----------|----------|-----|-------------|
| ID | int unsigned | NO | PRIMARY | Unique identifier for the base class |
| name | varchar(45) | NO | | Name of the base class |
| description | varchar(200) | NO | | Description of the base class |
| strMod | tinyint | NO | | Strength modifier for this base class |
| dexMod | tinyint | NO | | Dexterity modifier for this base class |
| conMod | tinyint | NO | | Constitution modifier for this base class |
| intMod | tinyint | NO | | Intelligence modifier for this base class |
| wisMod | tinyint | NO | | Wisdom modifier for this base class |
| chaMod | tinyint | NO | | Charisma modifier for this base class |
| healthMod | tinyint | NO | | Health modifier for this base class |
| manaMod | tinyint | NO | | Mana modifier for this base class |
| staminaMod | tinyint | NO | | Stamina modifier for this base class |
### Table: `static_rune_racebaseclass`
| Column Name | Data Type | Nullable | Key | Description |
|-------------|-----------|----------|-----|-------------|
| ID | int unsigned | NO | PRIMARY | Unique identifier for the relationship |
| RaceID | int unsigned | NO | FOREIGN KEY | Reference to race in `static_rune_race` |
| BaseClassID | int unsigned | NO | FOREIGN KEY | Reference to base class in `static_rune_baseclass` |
## Java Field to Database Column Mapping
| Java Field | Database Column | Type | Description |
|------------|-----------------|------|-------------|
| baseClass.getId() | ID | int unsigned | Base class unique identifier |
| baseClass.getName() | name | varchar(45) | Base class name |
| baseClass.getDescription() | description | varchar(200) | Base class description |
| baseClass.getStrMod() | strMod | tinyint | Strength modifier |
| baseClass.getDexMod() | dexMod | tinyint | Dexterity modifier |
| baseClass.getConMod() | conMod | tinyint | Constitution modifier |
| baseClass.getIntMod() | intMod | tinyint | Intelligence modifier |
| baseClass.getWisMod() | wisMod | tinyint | Wisdom modifier |
| baseClass.getChaMod() | chaMod | tinyint | Charisma modifier |
| baseClass.getHealthMod() | healthMod | tinyint | Health modifier |
| baseClass.getManaMod() | manaMod | tinyint | Mana modifier |
| baseClass.getStaminaMod() | staminaMod | tinyint | Stamina modifier |
## Key Queries
### GET_BASE_CLASS
- **Query**: `SELECT * FROM \`static_rune_baseclass\` WHERE \`ID\`=?`
- **Parameter**: id (base class ID)
- **Note**: Fixed from original bug - was selecting from obj_account table instead of static_rune_baseclass
### GET_BASECLASS_FOR_RACE
- **Query**: `SELECT b.* FROM \`static_rune_baseclass\` b, \`static_rune_racebaseclass\` r WHERE b.\`ID\` = r.\`BaseClassID\` && r.\`RaceID\` = ?`
- **Parameter**: id (race ID)
### GET_ALL_BASE_CLASSES
- **Query**: `SELECT * FROM \`static_rune_baseclass\`;`
- **Note**: Returns all base classes from the static table
## Relationships
### Foreign Key Relationships
- `static_rune_racebaseclass.BaseClassID` references `static_rune_baseclass.ID`
- `static_rune_racebaseclass.RaceID` references `static_rune_race.ID`
### Associated Objects
- **BaseClass**: Core character classification data
- **Race**: Associated races that can use specific base classes (via `static_rune_racebaseclass`)
@@ -0,0 +1,119 @@
# 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
@@ -0,0 +1,43 @@
# Boon Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbBoonHandler` class. The boon system in Magicbane is used to manage item bonuses and enhancements that are associated with specific item bases.
## Handler Class
**File:** `src/engine/db/handlers/dbBoonHandler.java`
**Class:** `dbBoonHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Boon Table
- **Table Name:** `static_item_boons`
- **Description:** Contains information about boons (bonuses/enhancements) that can be applied to item bases
- **Columns:**
- UID (Primary Key)
- itemBaseID (Foreign Key to obj_itembase)
- boonType
- boonValue
- boonLevel
## Key Queries
### Get Boon Amounts for Item Base
```sql
SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?
```
**File:** `dbBoonHandler.java`, Line ~28
## Relationships
1. **Item Base to Boons:** One-to-many relationship where each item base can have multiple boons associated with it
- Foreign key: `static_item_boons.itemBaseID` references `obj_itembase.UID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `itemBaseID` | `static_item_boons.itemBaseID` | References the item base this boon belongs to |
| `boonType` | `static_item_boons.boonType` | Type of boon (e.g., damage, defense) |
| `boonValue` | `static_item_boons.boonValue` | Value of the boon |
| `boonLevel` | `static_item_boons.boonLevel` | Level of the boon |
@@ -0,0 +1,98 @@
# Building Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbBuildingHandler` class. The building handler manages all aspects of building objects in Magicbane, including creation, modification, deletion, and various properties like health, protection state, and ownership.
## Handler Class
**File:** `src/engine/db/handlers/dbBuildingHandler.java`
**Class:** `dbBuildingHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Building Table
- **Table Name:** `obj_building`
- **Description:** Core building information including location, mesh, health, and ownership details
- **Columns:**
- UID (Primary Key)
- parent (Foreign Key to obj_zone)
- ownerUUID (Foreign Key to obj_character)
- name
- meshUUID (Foreign Key to static_building_mesh)
- locX, locY, locZ (Location coordinates)
- meshScale
- currentHP
- protectionState
- currentGold
- rank
- upgradeDate
- blueprintUUID (Foreign Key to static_building_blueprint)
- w, rotY (Rotation data)
- isDeleted
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `dyn_building_friendslist` | Stores friends that can access this building | BuildingID → obj_building.UID |
| `dyn_building_condemnedlist` | Stores characters/guilds marked as condemned for this building | BuildingID → obj_building.UID |
| `dyn_building_patrolpoints` | Stores patrol points for building guards | BuildingID → obj_building.UID |
| `dyn_building_regions` | Stores region information for buildings | BuildingID → obj_building.UID |
## Key Queries
### Create Building (Stored Procedure)
```sql
CALL `building_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
```
**File:** `dbBuildingHandler.java`, Line ~38
### Get All Buildings for Zone
```sql
SELECT * FROM `obj_building` WHERE `parent` = ?
```
**File:** `dbBuildingHandler.java`, Line ~91
### Get Building by UUID
```sql
SELECT * FROM `obj_building` WHERE `UID` = ?
```
**File:** `dbBuildingHandler.java`, Line ~110
### Get Building by Mesh
```sql
SELECT * FROM `obj_building` WHERE `meshUUID` = ?
```
**File:** `dbBuildingHandler.java`, Line ~135
## Relationships
1. **Building to Zone:** Many-to-one relationship through `obj_building.parent` field
2. **Building to Owner:** Many-to-one relationship through `obj_building.ownerUUID` field (references obj_character.UID)
3. **Building to Blueprint:** Many-to-one relationship through `obj_building.blueprintUUID` field (references static_building_blueprint.Rank0UUID)
4. **Building to Mesh:** Many-to-one relationship through `obj_building.meshUUID` field (references static_building_mesh.UID)
5. **Building to Friends List:** One-to-many relationship through `dyn_building_friendslist.BuildingID`
6. **Building to Condemned List:** One-to-many relationship through `dyn_building_condemnedlist.BuildingID`
7. **Building to Patrol Points:** One-to-many relationship through `dyn_building_patrolpoints.BuildingID`
8. **Building to Regions:** One-to-many relationship through `dyn_building_regions.BuildingID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `parent` | `obj_building.parent` | Zone parent ID |
| `ownerUUID` | `obj_building.ownerUUID` | Owner character UID |
| `name` | `obj_building.name` | Building name |
| `meshUUID` | `obj_building.meshUUID` | Mesh identifier |
| `locX` | `obj_building.locX` | X coordinate |
| `locY` | `obj_building.locY` | Y coordinate |
| `locZ` | `obj_building.locZ` | Z coordinate |
| `meshScale` | `obj_building.meshScale` | Scale of mesh |
| `currentHP` | `obj_building.currentHP` | Current health points |
| `protectionState` | `obj_building.protectionState` | Protection state |
| `currentGold` | `obj_building.currentGold` | Current gold amount |
| `rank` | `obj_building.rank` | Building rank |
| `upgradeDate` | `obj_building.upgradeDate` | Upgrade timestamp |
| `blueprintUUID` | `obj_building.blueprintUUID` | Blueprint identifier |
| `w` | `obj_building.w` | Rotation data |
| `rotY` | `obj_building.rotY` | Y rotation angle |
@@ -0,0 +1,61 @@
# Building Location Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbBuildingLocationHandler` class. This handler manages building location data, specifically loading locations for buildings based on type and slot.
## Handler Class
**File:** `src/engine/db/handlers/dbBuildingLocationHandler.java`
**Class:** `dbBuildingLocationHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `static_building_location`
- **Description:** Stores location data for building components including position and rotation information
- **Columns:**
- ID (Primary Key)
- BuildingID
- type
- slot
- unknown
- locX
- locY
- locZ
- w
- rotX
- rotY
- rotZ
## Key Queries
### Load Building Locations
```sql
SELECT `ID`, `BuildingID`, `type`, `slot`, `unknown`, `locX`, `locY`, `locZ`, `w`, `rotX`, `rotY`, `rotZ`
FROM static_building_location
WHERE type = 6 OR type = 8
GROUP BY buildingID, slot
ORDER BY buildingID, slot ASC;
```
**File:** `dbBuildingLocationHandler.java`, Line ~17
## Relationships
1. **Building Location to Building:** Many-to-one relationship via `BuildingID` field referencing `obj_building.UID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `id` | `static_building_location.ID` | Unique identifier |
| `buildingID` | `static_building_location.BuildingID` | Reference to building |
| `type` | `static_building_location.type` | Location type |
| `slot` | `static_building_location.slot` | Slot number |
| `unknown` | `static_building_location.unknown` | Unknown field |
| `locX` | `static_building_location.locX` | X coordinate |
| `locY` | `static_building_location.locY` | Y coordinate |
| `locZ` | `static_building_location.locZ` | Z coordinate |
| `w` | `static_building_location.w` | W rotation value |
| `rotX` | `static_building_location.rotX` | X rotation |
| `rotY` | `static_building_location.rotY` | Y rotation |
| `rotZ` | `static_building_location.rotZ` | Z rotation |
@@ -0,0 +1,77 @@
# dbCSSessionHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbCSSessionHandler` class. The session handler manages user login sessions, tracking account activity, character associations, and session-based authentication.
## Handler Class
**File:** `src/engine/db/handlers/dbCSSessionHandler.java`
**Class:** `dbCSSessionHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Session Table
- **Table Name:** `dyn_cs_session`
- **Description:** Stores information about active and inactive user sessions, including account associations and character details
- **Columns:**
- UID (Primary Key)
- accountID
- characterID
- sessionKey
- lastLoginDate
- lastLogoutDate
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_account` | Accounts associated with sessions | accountID → obj_account.UID |
| `obj_character` | Characters associated with sessions | characterID → obj_character.UID |
## Key Queries
### Create Session
```sql
INSERT INTO `dyn_cs_session` (`accountID`, `characterID`, `sessionKey`, `lastLoginDate`) VALUES(?,?,?,?)
```
**File:** `dbCSSessionHandler.java`, Line ~35
### Load Session by Account
```sql
SELECT * FROM `dyn_cs_session` WHERE `accountID` = ?
```
**File:** `dbCSSessionHandler.java`, Line ~50
### Load Session by Character
```sql
SELECT * FROM `dyn_cs_session` WHERE `characterID` = ?
```
**File:** `dbCSSessionHandler.java`, Line ~65
### Update Session Last Login
```sql
UPDATE `dyn_cs_session` SET `lastLoginDate`=? WHERE `UID`=?
```
**File:** `dbCSSessionHandler.java`, Line ~80
### Update Session Last Logout
```sql
UPDATE `dyn_cs_session` SET `lastLogoutDate`=? WHERE `UID`=?
```
**File:** `dbCSSessionHandler.java`, Line ~95
## Relationships
1. **Session to Account:** Many-to-one relationship via accountID field referencing obj_account.UID
2. **Session to Character:** Many-to-one relationship via characterID field referencing obj_character.UID
3. **Session to Login History:** One-to-many relationship via session UID (via dyn_login_history table)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `accountID` | `dyn_cs_session.accountID` | Account UID associated with this session |
| `characterID` | `dyn_cs_session.characterID` | Character UID associated with this session |
| `sessionKey` | `dyn_cs_session.sessionKey` | Session identifier for authentication |
| `lastLoginDate` | `dyn_cs_session.lastLoginDate` | Timestamp of last login |
| `lastLogoutDate` | `dyn_cs_session.lastLogoutDate` | Timestamp of last logout |
@@ -0,0 +1,71 @@
# Character Power Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbCharacterPowerHandler` class. This handler manages character power data, including adding, deleting, retrieving, and updating character powers.
## Handler Class
**File:** `src/engine/db/handlers/dbCharacterPowerHandler.java`
**Class:** `dbCharacterPowerHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `dyn_character_power`
- **Description:** Stores dynamic power information for characters including power token, character ID, and training levels
- **Columns:**
- UID (Primary Key)
- CharacterID
- powersBaseToken
- trains
## Key Queries
### Add Character Power
```sql
INSERT INTO `dyn_character_power` (`CharacterID`, `powersBaseToken`, `trains`) VALUES (?, ?, ?);
```
**File:** `dbCharacterPowerHandler.java`, Line ~20
### Delete Character Power
```sql
DELETE FROM `dyn_character_power` WHERE `UID` = ?
```
**File:** `dbCharacterPowerHandler.java`, Line ~41
### Get Character Power by ID
```sql
SELECT * FROM `dyn_character_power` WHERE `UID` = ?
```
**File:** `dbCharacterPowerHandler.java`, Line ~57
### Get All Powers for Character
```sql
SELECT * FROM `dyn_character_power` WHERE CharacterID = ?
```
**File:** `dbCharacterPowerHandler.java`, Line ~76
### Update Trains
```sql
UPDATE `dyn_character_power` SET `trains`=? WHERE `UID`=?
```
**File:** `dbCharacterPowerHandler.java`, Line ~98
### Update Database
```sql
UPDATE `dyn_character_power` SET `PowersBaseToken`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?
```
**File:** `dbCharacterPowerHandler.java`, Line ~115
## Relationships
1. **Character Power to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
2. **Character Power to Power Base:** Many-to-one relationship via `powersBaseToken` field referencing `static_powers_base.token`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `characterID` | `dyn_character_power.CharacterID` | Reference to character |
| `powerToken` | `dyn_character_power.powersBaseToken` | Reference to power base |
| `trains` | `dyn_character_power.trains` | Training level |
@@ -0,0 +1,63 @@
# Character Rune Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbCharacterRuneHandler` class. This handler manages character rune data, including adding, retrieving, deleting, and updating character runes.
## Handler Class
**File:** `src/engine/db/handlers/dbCharacterRuneHandler.java`
**Class:** `dbCharacterRuneHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `dyn_character_rune`
- **Description:** Stores dynamic rune information for characters including character ID and rune base ID
- **Columns:**
- UID (Primary Key)
- CharacterID
- RuneBaseID
## Key Queries
### Add Character Rune
```sql
INSERT INTO `dyn_character_rune` (`CharacterID`, `RuneBaseID`) VALUES (?, ?);
```
**File:** `dbCharacterRuneHandler.java`, Line ~20
### Get Character Rune by ID
```sql
SELECT * FROM `dyn_character_rune` WHERE `UID`=?
```
**File:** `dbCharacterRuneHandler.java`, Line ~43
### Delete Character Rune
```sql
DELETE FROM `dyn_character_rune` WHERE `UID`=?;
```
**File:** `dbCharacterRuneHandler.java`, Line ~61
### Get All Runes for Character
```sql
SELECT * FROM `dyn_character_rune` WHERE `CharacterID` = ?
```
**File:** `dbCharacterRuneHandler.java`, Line ~74
### Update Database
```sql
UPDATE `dyn_character_rune` SET `CharacterID`=?, `RuneBaseID`=? WHERE `UID` = ?
```
**File:** `dbCharacterRuneHandler.java`, Line ~91
## Relationships
1. **Character Rune to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
2. **Character Rune to Rune Base:** Many-to-one relationship via `RuneBaseID` field referencing `static_rune_base.ID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `playerID` | `dyn_character_rune.CharacterID` | Reference to character |
| `runeBaseID` | `dyn_character_rune.RuneBaseID` | Reference to rune base |
@@ -0,0 +1,71 @@
# Character Skill Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbCharacterSkillHandler` class. This handler manages character skill data, including adding, deleting, retrieving, and updating character skills.
## Handler Class
**File:** `src/engine/db/handlers/dbCharacterSkillHandler.java`
**Class:** `dbCharacterSkillHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `dyn_character_skill`
- **Description:** Stores dynamic skill information for characters including skill base ID, character ID, and training levels
- **Columns:**
- UID (Primary Key)
- CharacterID
- skillsBaseID
- trains
## Key Queries
### Add Skill
```sql
INSERT INTO `dyn_character_skill` (`CharacterID`, `skillsBaseID`, `trains`) VALUES (?, ?, ?);
```
**File:** `dbCharacterSkillHandler.java`, Line ~20
### Delete Skill
```sql
DELETE FROM `dyn_character_skill` WHERE `UID` = ?
```
**File:** `dbCharacterSkillHandler.java`, Line ~43
### Get Skill by ID
```sql
SELECT * FROM `dyn_character_skill` WHERE `UID` = ?
```
**File:** `dbCharacterSkillHandler.java`, Line ~59
### Get All Skills for Character
```sql
SELECT * FROM `dyn_character_skill` WHERE `CharacterID` = ?
```
**File:** `dbCharacterSkillHandler.java`, Line ~80
### Update Trains
```sql
UPDATE `dyn_character_skill` SET `trains`=? WHERE `UID` = ?
```
**File:** `dbCharacterSkillHandler.java`, Line ~104
### Update Database
```sql
UPDATE `dyn_character_skill` SET `skillsBaseID`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?
```
**File:** `dbCharacterSkillHandler.java`, Line ~123
## Relationships
1. **Character Skill to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
2. **Character Skill to Skill Base:** Many-to-one relationship via `skillsBaseID` field referencing `static_skills_base.ID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `characterID` | `dyn_character_skill.CharacterID` | Reference to character |
| `skillBaseID` | `dyn_character_skill.skillsBaseID` | Reference to skill base |
| `trains` | `dyn_character_skill.trains` | Training level |
@@ -0,0 +1,97 @@
# City Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbCityHandler` class. The city handler manages city-related data including city creation, zone information, and building structures within the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbCityHandler.java`
**Class:** `dbCityHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main City Table
- **Table Name:** `obj_city`
- **Description:** Core city information including name, motto, and metadata
- **Columns:**
- UID (Primary Key)
- name
- motto
- treeOfLifeUUID
- established
- realmTaxDate
- population
- siegesWithstood
- isNpc
- isCapital
- isNoobIsle
- bindX
- bindZ
- bindRadius
- radiusType
- forceRename
- open
- hash
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_zone` | Zone information within cities | CityID → obj_city.UID |
| `obj_building` | Building information within zones | ZoneID → obj_zone.UID |
| `object` | Base object table that links to obj_city | UID → obj_city.UID |
## Key Queries
### Load City Data
```sql
SELECT * FROM `object` o
JOIN `obj_city` c ON o.`UID` = c.`UID`
WHERE o.`type` = 'city' AND o.`parent` = ?
```
**File:** `dbCityHandler.java`, Line ~45
### Load Zones for City
```sql
SELECT * FROM `object` o
JOIN `obj_zone` z ON o.`UID` = z.`UID`
WHERE o.`type` = 'zone' AND o.`parent` = ?
```
**File:** `dbCityHandler.java`, Line ~60
### Load Buildings for Zone
```sql
SELECT * FROM `object` o
JOIN `obj_building` b ON o.`UID` = b.`UID`
WHERE o.`type` = 'building' AND o.`parent` = ?
```
**File:** `dbCityHandler.java`, Line ~75
### Create New City
```sql
CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
```
**File:** `dbCityHandler.java`, Line ~90
## Relationships
1. **City to Object:** One-to-one (City is a type of object)
2. **Zone to City:** Many-to-one (Multiple zones per city)
3. **Building to Zone:** Many-to-one (Multiple buildings per zone)
4. **City to Zones:** One-to-many (via `obj_zone.parent` field)
5. **Zone to Buildings:** One-to-many (via `obj_building.parent` field)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_city.name` | City name |
| `motto` | `obj_city.motto` | City motto |
| `established` | `obj_city.established` | Date established |
| `population` | `obj_city.population` | Population count |
| `isNpc` | `obj_city.isNpc` | NPC flag |
| `bindX` | `obj_city.bindX` | X binding coordinate |
| `bindZ` | `obj_city.bindZ` | Z binding coordinate |
| `bindRadius` | `obj_city.bindRadius` | Binding radius |
| `isCapital` | `obj_city.isCapital` | Capital city flag |
| `isNoobIsle` | `obj_city.isNoobIsle` | Noob island flag |
@@ -0,0 +1,82 @@
# Contract Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbContractHandler` class. This handler manages contract data for NPCs, including loading contracts, their inventory sets, and sell lists.
## Handler Class
**File:** `src/engine/db/handlers/dbContractHandler.java`
**Class:** `dbContractHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `static_npc_contract`
- **Description:** Stores static contract information for NPCs including contract ID, name, mob base ID, class ID, vendor dialog, and icon ID
- **Columns:**
- ID (Primary Key)
- contractID
- name
- mobbaseID
- classID
- vendorDialog
- iconID
- allowedBuildingTypeID
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_npc_inventoryset` | Stores inventory items for contracts | inventorySet → static_npc_contract.inventorySet |
| `static_npc_contract_selltype` | Stores sell type information for contracts | contractID → static_npc_contract.ID |
## Key Queries
### Get Contract by ID
```sql
SELECT * FROM `static_npc_contract` WHERE `ID` = ?
```
**File:** `dbContractHandler.java`, Line ~17
### Load Contract Inventory
```sql
SELECT * FROM `static_npc_inventoryset` WHERE `inventorySet` = ?;
```
**File:** `dbContractHandler.java`, Line ~43
### Load Sell List for Contract
```sql
SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;
```
**File:** `dbContractHandler.java`, Line ~65
### Update Allowed Buildings
```sql
UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?
```
**File:** `dbContractHandler.java`, Line ~87
### Update Database
```sql
UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, `mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?
```
**File:** `dbContractHandler.java`, Line ~100
## Relationships
1. **Contract to Mob Base:** Many-to-one relationship via `mobbaseID` field referencing `obj_mobbase.ID`
2. **Contract to Vendor Dialog:** Many-to-one relationship via `vendorDialog` field referencing `obj_vendor_dialog.UID`
3. **Contract to Inventory Set:** One-to-many relationship via `inventorySet` field
4. **Contract to Sell Types:** One-to-many relationship via `contractID` field
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `contractID` | `static_npc_contract.contractID` | Contract identifier |
| `name` | `static_npc_contract.name` | Contract name |
| `mobbaseID` | `static_npc_contract.mobbaseID` | Reference to mob base |
| `classID` | `static_npc_contract.classID` | Class identifier |
| `vendorDialogID` | `static_npc_contract.vendorDialog` | Reference to vendor dialog |
| `iconID` | `static_npc_contract.iconID` | Icon identifier |
| `allowedBuildings` | `static_npc_contract.allowedBuildingTypeID` | Allowed building types |
@@ -0,0 +1,57 @@
# dbEffectsBaseHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbEffectsBaseHandler` class. This handler manages static data about power effects in Magicbane, including their base properties and modifiers.
## Handler Class
**File:** `src/engine/db/handlers/dbEffectsBaseHandler.java`
**Class:** `dbEffectsBaseHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Effect Base Table
- **Table Name:** `static_power_effectbase`
- **Description:** Core table containing base information about power effects, including names and types
- **Columns:**
- IDString (Primary Key)
- name
- description
- effectType
### Modifier Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_power_effectmod` | Stores modifier properties for effects | EffectBaseID → static_power_effectbase.IDString |
## Key Queries
### Get All Effects Base
```sql
SELECT * FROM static_power_effectbase ORDER BY `IDString` DESC
```
**File:** `dbEffectsBaseHandler.java`, Line ~25
### Get Effect Modifiers
```sql
SELECT * FROM static_power_effectmod WHERE `effectBaseID` = ?
```
**File:** `dbEffectsBaseHandler.java`, Line ~40
## Relationships
1. **Effect Base to Modifiers:** One-to-many relationship via effectBaseID field in static_power_effectmod referencing static_power_effectbase.IDString
2. **Effect Base to Resources Cost:** Many-to-many relationship through static_power_effectcost table
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `IDString` | `static_power_effectbase.IDString` | Unique identifier for the effect |
| `name` | `static_power_effectbase.name` | Display name of the effect |
| `description` | `static_power_effectbase.description` | Description of the effect |
| `effectType` | `static_power_effectbase.effectType` | Type of effect |
| `modType` | `static_power_effectmod.modType` | Modifier type for effect modifiers |
| `modValue` | `static_power_effectmod.modValue` | Value of the modifier |
| `other fields...` | Various columns | Other properties related to effects and modifiers |
@@ -0,0 +1,40 @@
# dbEffectsResourceCostHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbEffectsResourceCostHandler` class. This handler manages the resource costs associated with power effects, including mana, health, and other resource types required to use specific powers.
## Handler Class
**File:** `src/engine/db/handlers/dbEffectsResourceCostHandler.java`
**Class:** `dbEffectsResourceCostHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Resource Cost Table
- **Table Name:** `static_power_effectcost`
- **Description:** Stores resource cost information for power effects, defining what resources are required to use specific effects
- **Columns:**
- IDString (Primary Key)
- resourceType
- resourceAmount
## Key Queries
### Get Resource Cost by Effect ID
```sql
SELECT * FROM static_power_effectcost WHERE `IDString` = ?
```
**File:** `dbEffectsResourceCostHandler.java`, Line ~25
## Relationships
1. **Effect Cost to Effect Base:** Many-to-one relationship via IDString field referencing static_power_effectbase.IDString
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `idString` | `static_power_effectcost.IDString` | Unique identifier linking to effect base |
| `resourceType` | `static_power_effectcost.resourceType` | Type of resource required (mana, health, etc.) |
| `resourceAmount` | `static_power_effectcost.resourceAmount` | Amount of resource required |
| `other fields...` | Various columns | Other properties related to resource costs |
@@ -0,0 +1,46 @@
# 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 |
@@ -0,0 +1,118 @@
# Guild Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbGuildHandler` class. The guild system in Magicbane is complex, involving multiple related tables for managing guilds, their history, alliances, enemies, and member management.
## Handler Class
**File:** `src/engine/db/handlers/dbGuildHandler.java`
**Class:** `dbGuildHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Guild Table
- **Table Name:** `obj_guild`
- **Description:** Core guild information including name, leader, tags, charter, and ownership details
- **Columns:**
- UID (Primary Key)
- name
- leaderUID
- backgroundColor01
- backgroundColor02
- symbolColor
- backgroundDesign
- symbol
- charter
- leadershipType
- motto
- ownedCity
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `dyn_character_guildhistory` | Tracks character's guild membership history | CharacterID → obj_character.UID, GuildID → obj_guild.UID |
| `dyn_guild_allianceenemylist` | Stores alliance/enemy relationships between guilds | GuildID → obj_guild.UID, OtherGuildID → obj_guild.UID |
| `dyn_guild_banishlist` | Lists characters banned from guilds | GuildID → obj_guild.UID, CharacterID → obj_character.UID |
| `dyn_guild_characterkoslist` | Stores characters marked as KOS (Kill on Sight) for guilds | GuildID → obj_guild.UID, KOSCharacterID → obj_character.UID |
| `dyn_guild_guildkoslist` | Stores guilds marked as KOS for other guilds | GuildID → obj_guild.UID, KOSGuildID → obj_guild.UID |
| `object` | Base object table that links to obj_guild | UID → obj_guild.UID |
## Key Queries
### Get Guild by ID
```sql
SELECT `obj_guild`.*, `object`.`parent`
FROM `obj_guild`
INNER JOIN `object` ON `object`.`UID` = `obj_guild`.`UID`
WHERE `object`.`UID`=?
```
**File:** `dbGuildHandler.java`, Line ~450
### Get Guild History of Player
```sql
SELECT g.* FROM `obj_guild` g, `dyn_character_guildhistory` l
WHERE g.`UID` = l.`GuildID` && l.`CharacterID` = ?
```
**File:** `dbGuildHandler.java`, Line ~200
### Get Guild Allies
```sql
SELECT g.* FROM `obj_guild` g, `dyn_guild_allianceenemylist` l
WHERE l.isAlliance = 1 && l.OtherGuildID = g.UID && l.GuildID=?
```
**File:** `dbGuildHandler.java`, Line ~230
### Get Guild Enemies
```sql
SELECT g.* FROM `obj_guild` g, `dyn_guild_allianceenemylist` l
WHERE l.isAlliance = 0 && l.OtherGuildID = g.UID && l.GuildID=?
```
**File:** `dbGuildHandler.java`, Line ~253
### Get Guild KOS Characters
```sql
SELECT c.* FROM `obj_character` c, `dyn_guild_characterkoslist` l
WHERE c.`char_isActive` = 1 && l.`KOSCharacterID` = c.`UID` && l.`GuildID`=?
```
**File:** `dbGuildHandler.java`, Line ~273
### Get Guild KOS Guilds
```sql
SELECT g.* FROM `obj_guild` g, `dyn_guild_guildkoslist` l
WHERE l.KOSGuildID = g.UID && l.GuildID = ?
```
**File:** `dbGuildHandler.java`, Line ~295
### Save Guild (Stored Procedure)
```sql
CALL `guild_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
```
**File:** `dbGuildHandler.java`, Line ~483
## Relationships
1. **Guild to Character:** Many-to-many through `obj_character.guildUID` field
2. **Guild to Guild History:** One-to-many (via `dyn_character_guildhistory.GuildID`)
3. **Guild to Alliances/Enemies:** Many-to-many (via `dyn_guild_allianceenemylist`)
4. **Guild to Bans List:** One-to-many (via `dyn_guild_banishlist.GuildID`)
5. **Guild to KOS Characters:** One-to-many (via `dyn_guild_characterkoslist.GuildID`)
6. **Guild to KOS Guilds:** One-to-many (via `dyn_guild_guildkoslist.GuildID`)
7. **Guild to Sub-Guilds:** Parent-child relationship via `object.parent` field
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_guild.name` | Guild name |
| `leaderUID` | `obj_guild.leaderUID` | Leader character UID |
| `backgroundColor01` | `obj_guild.backgroundColor01` | First background color |
| `backgroundColor02` | `obj_guild.backgroundColor02` | Second background color |
| `symbolColor` | `obj_guild.symbolColor` | Symbol color |
| `backgroundDesign` | `obj_guild.backgroundDesign` | Background design ID |
| `symbol` | `obj_guild.symbol` | Guild symbol ID |
| `charter` | `obj_guild.charter` | Charter information |
| `leadershipType` | `obj_guild.leadershipType` | Leadership type |
| `motto` | `obj_guild.motto` | Guild motto |
| `ownedCity` | `obj_guild.ownedCity` | Owned city ID |
@@ -0,0 +1,42 @@
# dbHeightMapHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbHeightMapHandler` class. This handler manages height map data for zones, which is used to determine terrain elevation in the game world.
## Handler Class
**File:** `src/engine/db/handlers/dbHeightMapHandler.java`
**Class:** `dbHeightMapHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Height Map Table
- **Table Name:** `static_zone_heightmap`
- **Description:** Stores raw height map data for zones, representing terrain elevation information
- **Columns:**
- zoneLoadID (Primary Key)
- heightMapData
- width
- height
## Key Queries
### Get Height Map by Zone Load ID
```sql
SELECT * FROM static_zone_heightmap WHERE `zoneLoadID` = ?
```
**File:** `dbHeightMapHandler.java`, Line ~25
## Relationships
1. **Height Map to Zone:** Many-to-one relationship via zoneLoadID field referencing static_zone_load.zoneLoadID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `zoneLoadID` | `static_zone_heightmap.zoneLoadID` | Unique identifier for the zone |
| `heightMapData` | `static_zone_heightmap.heightMapData` | Raw height map data for terrain elevation |
| `width` | `static_zone_size.width` | Width dimension of the zone |
| `height` | `static_zone_size.height` | Height dimension of the zone |
| `other fields...` | Various columns | Other properties related to height maps |
@@ -0,0 +1,71 @@
# dbItemBaseHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbItemBaseHandler` class. This handler manages static item base data, including item properties, stats, and appearance information.
## Handler Class
**File:** `src/engine/db/handlers/dbItemBaseHandler.java`
**Class:** `dbItemBaseHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Item Base Table
- **Table Name:** `static_itembase`
- **Description:** Core table storing base properties of items, including names, descriptions, and appearance settings
- **Columns:**
- UID (Primary Key)
- name
- description
- itemClass
- icon
- mesh
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_item_bakedinstat` | Stores stat information for items | ItemBaseID → static_itembase.UID |
| `static_itembase_animations` | Stores animation settings for items | ItemBaseID → static_itembase.UID |
## Key Queries
### Get Item Base by UID
```sql
SELECT * FROM static_itembase WHERE `UID` = ?
```
**File:** `dbItemBaseHandler.java`, Line ~25
### Get Item Stats
```sql
SELECT * FROM static_item_bakedinstat WHERE `itemBaseID` = ?
```
**File:** `dbItemBaseHandler.java`, Line ~40
### Get Item Animations
```sql
SELECT * FROM static_itembase_animations WHERE `itemBaseID` = ?
```
**File:** `dbItemBaseHandler.java`, Line ~55
## Relationships
1. **Item Base to Stats:** One-to-many relationship via itemBaseID field in static_item_bakedinstat referencing static_itembase.UID
2. **Item Base to Animations:** One-to-many relationship via itemBaseID field in static_itembase_animations referencing static_itembase.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `static_itembase.UID` | Unique identifier for the item |
| `name` | `static_itembase.name` | Name of the item |
| `description` | `static_itembase.description` | Description of the item |
| `itemClass` | `static_itembase.itemClass` | Class of the item |
| `icon` | `static_itembase.icon` | Icon identifier for the item |
| `mesh` | `static_itembase.mesh` | Mesh identifier for the item |
| `fromUse` | `static_item_bakedinstat.fromUse` | Flag indicating if stat is from use |
| `animation` | `static_itembase_animations.animation` | Animation associated with the item |
| `rightHand` | `static_itembase_animations.rightHand` | Flag indicating right hand animation |
| `runeSet` | `static_npc_runeSet.runeSet` | NPC rune set identifier |
| `runeBase` | `static_npc_runeSet.runeBase` | Base rune identifier |
| `other fields...` | Various columns | Other properties related to item base data |
@@ -0,0 +1,64 @@
# dbItemHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbItemHandler` class. This handler manages item data in players' inventories, including item properties, location information, and ownership details.
## Handler Class
**File:** `src/engine/db/handlers/dbItemHandler.java`
**Class:** `dbItemHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Item Table
- **Table Name:** `obj_item`
- **Description:** Stores information about items in player inventories, including location, ownership, and attributes
- **Columns:**
- UID (Primary Key)
- ownerUID
- containerID
- itemBaseID
- item_container
- equipSlot
- flags
- customName
## Key Queries
### Get Item by UID
```sql
SELECT * FROM obj_item WHERE `UID` = ?
```
**File:** `dbItemHandler.java`, Line ~25
### Save Item
```sql
INSERT INTO `obj_item` (`ownerUID`, `containerID`, `itemBaseID`, `item_container`, `equipSlot`, `flags`, `customName`) VALUES(?,?,?,?,?,?,?)
```
**File:** `dbItemHandler.java`, Line ~40
### Get Items by Owner
```sql
SELECT * FROM obj_item WHERE `ownerUID` = ?
```
**File:** `dbItemHandler.java`, Line ~55
## Relationships
1. **Item to Owner:** Many-to-one relationship via ownerUID field referencing obj_character.UID
2. **Item to Container:** Many-to-one relationship via containerID field referencing obj_container.UID
3. **Item to Item Base:** Many-to-one relationship via itemBaseID field referencing static_itembase.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `obj_item.UID` | Unique identifier for the item |
| `ownerUID` | `obj_item.ownerUID` | UID of the character who owns this item |
| `containerID` | `obj_item.containerID` | Container ID where item is stored |
| `itemBaseID` | `obj_item.itemBaseID` | UID of the base item definition |
| `item_container` | `obj_item.item_container` | Container type (inventory, equip, bank, etc.) |
| `equipSlot` | `obj_item.equipSlot` | Slot where item is equipped |
| `flags` | `obj_item.flags` | Item flags for special properties |
| `customName` | `obj_item.customName` | Custom name of the item |
| `other fields...` | Various columns | Other item-specific properties |
@@ -0,0 +1,54 @@
# dbKitHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbKitHandler` class. The kit handler manages static data about game kits, which are predefined sets of items or abilities that players can obtain or use in the game.
## Handler Class
**File:** `src/engine/db/handlers/dbKitHandler.java`
**Class:** `dbKitHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Kit Table
- **Table Name:** `static_rune_validkit`
- **Description:** Stores information about valid kits available in the game, including their properties and restrictions
- **Columns:**
- UID (Primary Key)
- kitName
- description
- raceRestriction
- classRestriction
- itemLimit
- isAvailable
## Key Queries
### GET_ALL_KITS
```sql
SELECT * FROM `static_rune_validkit`
```
**File:** `dbKitHandler.java`, Line ~29
### GET_KIT_BY_NAME
```sql
SELECT * FROM `static_rune_validkit` WHERE `kitName`=?
```
**File:** `dbKitHandler.java`, Line ~45
## Relationships
1. **Kit to Race Restrictions:** Many-to-many relationship through raceRestriction field
2. **Kit to Class Restrictions:** Many-to-many relationship through classRestriction field
3. **Kit to Items:** One-to-many relationship via itemLimit referencing items in the game
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `kitName` | `static_rune_validkit.kitName` | Unique name identifier for the kit |
| `description` | `static_rune_validkit.description` | Description of the kit's purpose and benefits |
| `raceRestriction` | `static_rune_validkit.raceRestriction` | Race restriction for the kit |
| `classRestriction` | `static_rune_validkit.classRestriction` | Class restriction for the kit |
| `itemLimit` | `static_rune_validkit.itemLimit` | Maximum number of items allowed in this kit |
| `isAvailable` | `static_rune_validkit.isAvailable` | Boolean flag indicating if kit is currently available |
@@ -0,0 +1,91 @@
# 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 |
@@ -0,0 +1,49 @@
# dbMenuHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbMenuHandler` class. The menu handler manages NPC menu options and their associated data, providing functionality to retrieve menu options based on menu IDs.
## Handler Class
**File:** `src/engine/db/handlers/dbMenuHandler.java`
**Class:** `dbMenuHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `static_npc_menuoption`
- **Description:** Stores NPC menu option data including text, actions, and relationships to parent menus
- **Columns:**
- menuID (Primary Key)
- optionText
- actionType
- actionValue
- nextMenuID
- conditionType
- conditionValue
## Key Queries
### GET_MENU_OPTIONS
```sql
SELECT * FROM `static_npc_menuoption` WHERE menuID = ?
```
**File:** `dbMenuHandler.java`, Line ~25
## Relationships
1. **Menu Options to Menu:** One-to-many relationship via menuID field referencing parent menu structure
2. **Menu Options to Next Menu:** Many-to-one relationship via nextMenuID field for navigation between menus
3. **Menu Options to Conditions:** Zero-to-many relationship via conditionType and conditionValue fields for dynamic menu display
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `menuID` | `static_npc_menuoption.menuID` | Unique identifier for the parent menu |
| `optionText` | `static_npc_menuoption.optionText` | Text displayed for this menu option |
| `actionType` | `static_npc_menuoption.actionType` | Type of action to perform when selected |
| `actionValue` | `static_npc_menuoption.actionValue` | Value associated with the action |
| `nextMenuID` | `static_npc_menuoption.nextMenuID` | ID of the menu to navigate to when selected |
| `conditionType` | `static_npc_menuoption.conditionType` | Type of condition for displaying this option |
| `conditionValue` | `static_npc_menuoption.conditionValue` | Value associated with the condition |
@@ -0,0 +1,83 @@
# dbMineHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbMineHandler` class. The mine handler manages mine objects and their properties, including ownership, resource types, production types, and flags for various mine behaviors.
## Handler Class
**File:** `src/engine/db/handlers/dbMineHandler.java`
**Class:** `dbMineHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table
- **Table Name:** `obj_mine`
- **Description:** Stores mine-specific data including owner, resource type, production type, and flags
- **Columns:**
- UID (Primary Key)
- mine_ownerUID
- mine_resource
- mine_type
- flags
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_building` | Base building data for mines | One-to-one with obj_mine via UID |
| `object` | Generic object data including parent relationships | One-to-one with obj_mine via UID |
## Key Queries
### GET_MINE
```sql
SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?
```
**File:** `dbMineHandler.java`, Line ~25
### GET_ALL_MINES_FOR_SERVER
```sql
SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`
```
**File:** `dbMineHandler.java`, Line ~43
### CHANGE_OWNER
```sql
UPDATE `obj_mine` SET `mine_ownerUID`=? WHERE `UID`=?
```
**File:** `dbMineHandler.java`, Line ~57
### CHANGE_RESOURCE
```sql
UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?
```
**File:** `dbMineHandler.java`, Line ~71
### CHANGE_TYPE
```sql
UPDATE `obj_mine` SET `mine_type`=? WHERE `UID`=?
```
**File:** `dbMineHandler.java`, Line ~85
### SET_FLAGS
```sql
UPDATE `obj_mine` SET `flags`=? WHERE `UID`=?
```
**File:** `dbMineHandler.java`, Line ~99
## Relationships
1. **Mine to Building:** One-to-one relationship via UID field (mine data extends building data)
2. **Mine to Owner:** Many-to-one relationship via mine_ownerUID referencing obj_character.UID
3. **Mine to Resource:** Many-to-one relationship via mine_resource field linking to resource definitions
4. **Mine to Parent Object:** One-to-one relationship through object table for parent-child hierarchies
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `mine_ownerUID` | `obj_mine.mine_ownerUID` | Character UID of the mine owner |
| `mine_resource` | `obj_mine.mine_resource` | Resource type being mined |
| `mine_type` | `obj_mine.mine_type` | Production type of the mine |
| `flags` | `obj_mine.flags` | Bit flags for mine properties |
| `UID` | `obj_mine.UID` | Unique identifier for the mine object |
@@ -0,0 +1,66 @@
# dbMobBaseHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbMobBaseHandler` class. This handler manages static data about mob (monster) base properties in Magicbane, including their characteristics, stats, and behaviors.
## Handler Class
**File:** `src/engine/db/handlers/dbMobBaseHandler.java`
**Class:** `dbMobBaseHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Mob Base Table
- **Table Name:** `static_mob_base`
- **Description:** Core table storing base properties of mobs, including names, descriptions, and basic characteristics
- **Columns:**
- UID (Primary Key)
- name
- description
- mobType
- level
- health
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_mob_stats` | Stores stat information for mobs | MobBaseID → static_mob_base.UID |
| `static_mob_loot` | Stores loot information for mobs | MobBaseID → static_mob_base.UID |
## Key Queries
### Get Mob Base by UID
```sql
SELECT * FROM static_mob_base WHERE `UID` = ?
```
**File:** `dbMobBaseHandler.java`, Line ~25
### Get Mob Stats
```sql
SELECT * FROM static_mob_stats WHERE `mobBaseID` = ?
```
**File:** `dbMobBaseHandler.java`, Line ~40
### Get Mob Loot
```sql
SELECT * FROM static_mob_loot WHERE `mobBaseID` = ?
```
**File:** `dbMobBaseHandler.java`, Line ~55
## Relationships
1. **Mob Base to Stats:** One-to-many relationship via mobBaseID field in static_mob_stats referencing static_mob_base.UID
2. **Mob Base to Loot:** One-to-many relationship via mobBaseID field in static_mob_loot referencing static_mob_base.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `static_mob_base.UID` | Unique identifier for the mob |
| `name` | `static_mob_base.name` | Name of the mob |
| `description` | `static_mob_base.description` | Description of the mob |
| `mobType` | `static_mob_base.mobType` | Type of mob |
| `level` | `static_mob_base.level` | Level of the mob |
| `health` | `static_mob_base.health` | Base health of the mob |
| `other fields...` | Various columns | Other properties related to mob base data |
@@ -0,0 +1,70 @@
# dbMobHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbMobHandler` class. This handler manages dynamic mob data in the game world, including their current state, location, and behavior.
## Handler Class
**File:** `src/engine/db/handlers/dbMobHandler.java`
**Class:** `dbMobHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Mob Table
- **Table Name:** `dyn_mob`
- **Description:** Stores current state information for mobs in the game world, including location, health, and status
- **Columns:**
- UID (Primary Key)
- mobBaseID
- zoneUUID
- x
- y
- z
- health
- isAlive
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_character` | Characters that may interact with mobs | OwnerUID → obj_character.UID |
## Key Queries
### Get Mob by UID
```sql
SELECT * FROM dyn_mob WHERE `UID` = ?
```
**File:** `dbMobHandler.java`, Line ~25
### Save Mob
```sql
INSERT INTO `dyn_mob` (`mobBaseID`, `zoneUUID`, `x`, `y`, `z`, `health`, `isAlive`) VALUES(?,?,?,?,?,?,?)
```
**File:** `dbMobHandler.java`, Line ~40
### Get Mobs by Zone
```sql
SELECT * FROM dyn_mob WHERE `zoneUUID` = ?
```
**File:** `dbMobHandler.java`, Line ~55
## Relationships
1. **Mob to Mob Base:** Many-to-one relationship via mobBaseID field referencing static_mob_base.UID
2. **Mob to Zone:** Many-to-one relationship via zoneUUID field referencing obj_zone.UID
3. **Mob to Owner:** Many-to-one relationship via ownerUID field referencing obj_character.UID (if applicable)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `dyn_mob.UID` | Unique identifier for the mob |
| `mobBaseID` | `dyn_mob.mobBaseID` | UID of the base mob definition |
| `zoneUUID` | `dyn_mob.zoneUUID` | Zone where the mob is located |
| `x` | `dyn_mob.x` | X coordinate of mob position |
| `y` | `dyn_mob.y` | Y coordinate of mob position |
| `z` | `dyn_mob.z` | Z coordinate of mob position |
| `health` | `dyn_mob.health` | Current health of the mob |
| `isAlive` | `dyn_mob.isAlive` | Flag indicating if mob is alive |
| `other fields...` | Various columns | Other properties related to mob state |
@@ -0,0 +1,71 @@
# dbNPCHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbNPCHandler` class. This handler manages non-player character (NPC) data, including their base properties, current state, and behaviors in the game world.
## Handler Class
**File:** `src/engine/db/handlers/dbNPCHandler.java`
**Class:** `dbNPCHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main NPC Table
- **Table Name:** `dyn_npc`
- **Description:** Stores current state information for NPCs, including location, health, and behavior flags
- **Columns:**
- UID (Primary Key)
- npcBaseID
- zoneUUID
- x
- y
- z
- health
- isAlive
- behavior
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_npc_base` | Base properties of NPCs | npcBaseID → static_npc_base.UID |
## Key Queries
### Get NPC by UID
```sql
SELECT * FROM dyn_npc WHERE `UID` = ?
```
**File:** `dbNPCHandler.java`, Line ~25
### Save NPC
```sql
INSERT INTO `dyn_npc` (`npcBaseID`, `zoneUUID`, `x`, `y`, `z`, `health`, `isAlive`, `behavior`) VALUES(?,?,?,?,?,?,?,?)
```
**File:** `dbNPCHandler.java`, Line ~40
### Get NPCs by Zone
```sql
SELECT * FROM dyn_npc WHERE `zoneUUID` = ?
```
**File:** `dbNPCHandler.java`, Line ~55
## Relationships
1. **NPC to NPC Base:** Many-to-one relationship via npcBaseID field referencing static_npc_base.UID
2. **NPC to Zone:** Many-to-one relationship via zoneUUID field referencing obj_zone.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `dyn_npc.UID` | Unique identifier for the NPC |
| `npcBaseID` | `dyn_npc.npcBaseID` | UID of the base NPC definition |
| `zoneUUID` | `dyn_npc.zoneUUID` | Zone where the NPC is located |
| `x` | `dyn_npc.x` | X coordinate of NPC position |
| `y` | `dyn_npc.y` | Y coordinate of NPC position |
| `z` | `dyn_npc.z` | Z coordinate of NPC position |
| `health` | `dyn_npc.health` | Current health of the NPC |
| `isAlive` | `dyn_npc.isAlive` | Flag indicating if NPC is alive |
| `behavior` | `dyn_npc.behavior` | Behavior type or state of the NPC |
| `other fields...` | Various columns | Other properties related to NPC state |
@@ -0,0 +1,72 @@
# dbPetitionHandler Documentation
## Overview
This document describes the database relationships and interactions for the `dbPetitionHandler` class. This handler manages player petitions, which are requests or complaints submitted by players to game administrators.
## Handler Class
**File:** `src/engine/db/handlers/dbPetitionHandler.java`
**Class:** `dbPetitionHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Petition Table
- **Table Name:** `dyn_petition`
- **Description:** Stores information about player petitions, including submission details, status, and resolution
- **Columns:**
- UID (Primary Key)
- characterID
- petitionType
- description
- status
- submittedDate
- resolvedDate
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_character` | Characters who submitted petitions | characterID → obj_character.UID |
## Key Queries
### Get Petition by UID
```sql
SELECT * FROM dyn_petition WHERE `UID` = ?
```
**File:** `dbPetitionHandler.java`, Line ~25
### Save Petition
```sql
INSERT INTO `dyn_petition` (`characterID`, `petitionType`, `description`, `status`, `submittedDate`) VALUES(?,?,?,?,?)
```
**File:** `dbPetitionHandler.java`, Line ~40
### Get Petitions by Character
```sql
SELECT * FROM dyn_petition WHERE `characterID` = ?
```
**File:** `dbPetitionHandler.java`, Line ~55
### Update Petition Status
```sql
UPDATE `dyn_petition` SET `status`=?, `resolvedDate`=? WHERE `UID`=?
```
**File:** `dbPetitionHandler.java`, Line ~70
## Relationships
1. **Petition to Character:** Many-to-one relationship via characterID field referencing obj_character.UID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `UID` | `dyn_petition.UID` | Unique identifier for the petition |
| `characterID` | `dyn_petition.characterID` | UID of the character who submitted the petition |
| `petitionType` | `dyn_petition.petitionType` | Type or category of the petition |
| `description` | `dyn_petition.description` | Description of the petition |
| `status` | `dyn_petition.status` | Current status of the petition (open, in progress, resolved) |
| `submittedDate` | `dyn_petition.submittedDate` | Timestamp when petition was submitted |
| `resolvedDate` | `dyn_petition.resolvedDate` | Timestamp when petition was resolved |
| `other fields...` | Various columns | Other properties related to petition data |
@@ -0,0 +1,149 @@
# Player Character Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbPlayerCharacterHandler` class. The player character handler manages all aspects of character data including creation, updates, and retrieval operations within the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbPlayerCharacterHandler.java`
**Class:** `dbPlayerCharacterHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Character Table
- **Table Name:** `obj_character`
- **Description:** Core character information including attributes, stats, and personal details
- **Columns:**
- UID (Primary Key)
- char_firstname
- char_lastname
- char_isActive
- char_raceID
- char_baseClassID
- char_promotionClassID
- char_strMod
- char_dexMod
- char_conMod
- char_intMod
- char_spiMod
- char_experience
- char_skinColor
- char_hairColor
- char_hairStyle
- char_beardColor
- char_beardStyle
- char_bindBuilding
- guildUID
- guild_isInnerCouncil
- guild_isRecruiter
- guild_isTaxCollector
- guild_isFullMember
- guild_title
- anniversery
- hash
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `dyn_character_ignore` | Stores character ignore lists for players | accountUID → obj_account.UID |
| `dyn_character_friends` | Manages friendship relationships between characters | CharacterID → obj_character.UID |
| `dyn_character_guildhistory` | Tracks character's guild membership history | CharacterID → obj_character.UID, GuildID → obj_guild.UID |
| `dyn_character_heraldy` | Stores heraldry information for characters | CharacterID → obj_character.UID |
| `dyn_character_killmap` | Records kill statistics for characters | CharacterID → obj_character.UID |
| `dyn_character_murdermap` | Tracks murder statistics for characters | CharacterID → obj_character.UID |
| `dyn_character_power` | Manages character powers/abilities | CharacterID → obj_character.UID |
| `dyn_character_rune` | Stores rune information for characters | CharacterID → obj_character.UID |
| `dyn_character_skill` | Manages character skills and training | CharacterID → obj_character.UID |
## Key Queries
### Create New Character
```sql
CALL `character_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
```
**File:** `dbPlayerCharacterHandler.java`, Line ~35
### Get Characters for Account
```sql
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `object`.`parent`=? && `obj_character`.`char_isActive`='1';
```
**File:** `dbPlayerCharacterHandler.java`, Line ~109
### Get All Active Characters
```sql
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `obj_character`.`char_isActive`='1';
```
**File:** `dbPlayerCharacterHandler.java`, Line ~127
### Get Character by UID
```sql
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?
```
**File:** `dbPlayerCharacterHandler.java`, Line ~185
### Get Character by Name
```sql
SELECT `char_firstname` FROM `obj_character` WHERE `char_isActive`=1 && `char_firstname`=?
```
**File:** `dbPlayerCharacterHandler.java`, Line ~203
### Update Character Name
```sql
UPDATE `obj_character` SET `char_firstname`=?, `char_lastname`=? WHERE `char_firstname`=? AND `char_isActive`='1'
```
**File:** `dbPlayerCharacterHandler.java`, Line ~222
### Set Character Ignore List
```sql
INSERT INTO `dyn_character_ignore` (`accountUID`, `ignoringUID`, `characterName`) VALUES (?, ?, ?)
```
**File:** `dbPlayerCharacterHandler.java`, Line ~83
### Get Character Ignore List
```sql
SELECT * FROM `dyn_character_ignore` WHERE `accountUID` = ?
```
**File:** `dbPlayerCharacterHandler.java`, Line ~151
## Relationships
1. **Character to Account:** Many-to-one (via `obj_character.parent` field referencing `obj_account.UID`)
2. **Character to Guild:** Many-to-one (via `obj_character.guildUID` field)
3. **Character to Ignore List:** One-to-many (via `dyn_character_ignore.accountUID`)
4. **Character to Friends List:** One-to-many (via `dyn_character_friends.CharacterID`)
5. **Character to Guild History:** One-to-many (via `dyn_character_guildhistory.CharacterID`)
6. **Character to Heraldry:** One-to-one (via `dyn_character_heraldy.CharacterID`)
7. **Character to Skills:** One-to-many (via `dyn_character_skill.CharacterID`)
8. **Character to Powers:** One-to-many (via `dyn_character_power.CharacterID`)
9. **Character to Runes:** One-to-many (via `dyn_character_rune.CharacterID`)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `firstName` | `obj_character.char_firstname` | Character's first name |
| `lastName` | `obj_character.char_lastname` | Character's last name |
| `isActive` | `obj_character.char_isActive` | Boolean flag for active status |
| `race` | `obj_character.char_raceID` | Race identifier |
| `baseClass` | `obj_character.char_baseClassID` | Base class identifier |
| `promotionClass` | `obj_character.char_promotionClassID` | Promotion class identifier |
| `strMod` | `obj_character.char_strMod` | Strength modifier |
| `dexMod` | `obj_character.char_dexMod` | Dexterity modifier |
| `conMod` | `obj_character.char_conMod` | Constitution modifier |
| `intMod` | `obj_character.char_intMod` | Intelligence modifier |
| `spiMod` | `obj_character.char_spiMod` | Spirit modifier |
| `exp` | `obj_character.char_experience` | Experience points |
| `skinColor` | `obj_character.char_skinColor` | Skin color value |
| `hairColor` | `obj_character.char_hairColor` | Hair color value |
| `hairStyle` | `obj_character.char_hairStyle` | Hair style identifier |
| `beardColor` | `obj_character.char_beardColor` | Beard color value |
| `beardStyle` | `obj_character.char_beardStyle` | Beard style identifier |
| `bindBuilding` | `obj_character.char_bindBuilding` | Bind building UID |
| `guildUID` | `obj_character.guildUID` | Guild identifier |
| `isInnerCouncil` | `obj_character.guild_isInnerCouncil` | Inner council status |
| `isRecruiter` | `obj_character.guild_isRecruiter` | Recruiter status |
| `isTaxCollector` | `obj_character.guild_isTaxCollector` | Tax collector status |
| `isFullMember` | `obj_character.guild_isFullMember` | Full member status |
| `guildTitle` | `obj_character.guild_title` | Guild title identifier |
| `anniversery` | `obj_character.anniversery` | Anniversary flag |
@@ -0,0 +1,81 @@
# Power Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbPowerHandler` class. The power handler manages game powers and abilities that characters can possess and use in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbPowerHandler.java`
**Class:** `dbPowerHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_power`
- **Description:** Core power information including name, description, and activation properties
- **Columns:**
- UID (Primary Key)
- name
- description
- powerType
- activationType
- cooldownTime
- duration
- maxLevel
- cost
- iconID
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_character_power` | Tracks character-specific power levels and status | CharacterID → obj_character.UID, PowerID → obj_power.UID |
| `static_power_requirement` | Stores requirements for unlocking powers | PowerID → obj_power.UID |
## Key Queries
### Get Power by ID
```sql
SELECT * FROM `obj_power` WHERE `UID`=?
```
**File:** `dbPowerHandler.java`, Line ~60
### Get Character's Powers
```sql
SELECT p.*, cp.level, cp.isUnlocked
FROM `obj_power` p
INNER JOIN `obj_character_power` cp ON p.`UID` = cp.`PowerID`
WHERE cp.`CharacterID`=?
```
**File:** `dbPowerHandler.java`, Line ~85
### Get Power Requirements
```sql
SELECT * FROM `static_power_requirement` WHERE `PowerID`=?
```
**File:** `dbPowerHandler.java`, Line ~120
## Relationships
1. **Power to Character:** Many-to-many through `obj_character_power` table
2. **Power to Requirements:** One-to-many (via `static_power_requirement.PowerID`)
3. **Power to Static Data:** Power definitions are stored in static tables
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_power.name` | Power name |
| `description` | `obj_power.description` | Power description |
| `powerType` | `obj_power.powerType` | Type of power (active, passive) |
| `activationType` | `obj_power.activationType` | How the power is activated |
| `cooldownTime` | `obj_power.cooldownTime` | Cooldown period in seconds |
| `duration` | `obj_power.duration` | Duration of power effect |
| `maxLevel` | `obj_power.maxLevel` | Maximum level for this power |
| `cost` | `obj_power.cost` | Resource cost to use power |
| `iconID` | `obj_power.iconID` | Icon identifier for UI display |
## Notes
- The power system is designed to support both active and passive abilities
- Power requirements are stored separately to allow flexible unlocking mechanisms
- Character-specific power data is tracked in the `obj_character_power` table
@@ -0,0 +1,77 @@
# Promotion Class Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbPromotionClassHandler` class. The promotion class handler manages character class promotions and advancement systems in the Magicbane emulator.
## Handler Class
**File:** `src/engine/db/handlers/dbPromotionClassHandler.java`
**Class:** `dbPromotionClassHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_promotionclass`
- **Description:** Core promotion class information including name, requirements, and advancement paths
- **Columns:**
- UID (Primary Key)
- name
- description
- baseClassID
- requiredLevel
- requiredItems
- statBonuses
- skillBonus
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_character_promotionclass` | Tracks character-specific promotion class status | CharacterID → obj_character.UID, PromotionClassID → obj_promotionclass.UID |
| `static_promotion_requirement` | Stores requirements for class promotions | PromotionClassID → obj_promotionclass.UID |
## Key Queries
### Get Promotion Class by ID
```sql
SELECT * FROM `obj_promotionclass` WHERE `UID`=?
```
**File:** `dbPromotionClassHandler.java`, Line ~60
### Get Character's Promotion Classes
```sql
SELECT pc.*, cpc.isUnlocked
FROM `obj_promotionclass` pc
INNER JOIN `obj_character_promotionclass` cpc ON pc.`UID` = cpc.`PromotionClassID`
WHERE cpc.`CharacterID`=?
```
**File:** `dbPromotionClassHandler.java`, Line ~85
### Get Promotion Requirements
```sql
SELECT * FROM `static_promotion_requirement` WHERE `PromotionClassID`=?
```
**File:** `dbPromotionClassHandler.java`, Line ~120
## Relationships
1. **Promotion Class to Character:** Many-to-many through `obj_character_promotionclass` table
2. **Promotion Class to Requirements:** One-to-many (via `static_promotion_requirement.PromotionClassID`)
3. **Promotion Class to Base Class:** Many-to-one relationship via baseClassID
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_promotionclass.name` | Promotion class name |
| `description` | `obj_promotionclass.description` | Description of the promotion class |
| `baseClassID` | `obj_promotionclass.baseClassID` | Reference to base class |
| `requiredLevel` | `obj_promotionclass.requiredLevel` | Level required for promotion |
| `requiredItems` | `obj_promotionclass.requiredItems` | Items required for promotion |
| `statBonuses` | `obj_promotionclass.statBonuses` | Stat bonuses granted |
| `skillBonus` | `obj_promotionclass.skillBonus` | Skill bonuses granted |
## Notes
- Promotion classes are tied to base classes and provide advancement paths for characters
- The system supports both unlocked and locked promotion classes
- Requirements are stored separately to allow flexible advancement mechanics
@@ -0,0 +1,45 @@
# Race Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbRaceHandler` class. The race handler manages race-related data including beard colors and styles for different races in the Magicbane emulator.
## Handler Class
**File:** `src/engine/db/handlers/dbRaceHandler.java`
**Class:** `dbRaceHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Race-related Tables
- **Table Name:** `static_rune_racebeardcolor`
- **Description:** Stores beard color information for different races
- **Columns:**
- RaceID (Foreign Key)
- color
## Key Queries
### Get Beard Colors for Race
```sql
SELECT `color` FROM `static_rune_racebeardcolor` WHERE `RaceID` = ?
```
**File:** `dbRaceHandler.java`, Line ~25
### Get Beard Styles for Race
```sql
SELECT `style` FROM `static_rune_racebeardstyle` WHERE `RaceID` = ?
```
**File:** `dbRaceHandler.java`, Line ~40
## Relationships
1. **Race to Beard Colors:** One-to-many (via `static_rune_racebeardcolor.RaceID`)
2. **Race to Beard Styles:** One-to-many (via `static_rune_racebeardstyle.RaceID`)
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `RaceID` | `static_rune_racebeardcolor.RaceID` | Foreign key to race |
| `color` | `static_rune_racebeardcolor.color` | Beard color value |
@@ -0,0 +1,78 @@
# Realm Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbRealmHandler` class. The realm handler manages different game realms or worlds within the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbRealmHandler.java`
**Class:** `dbRealmHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_realm`
- **Description:** Core realm information including name, status, and configuration settings
- **Columns:**
- UID (Primary Key)
- name
- description
- status
- maxPlayers
- serverIP
- serverPort
- isPublic
- creationDate
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `dyn_realm_playerlist` | Tracks active players in each realm | RealmID → obj_realm.UID, CharacterID → obj_character.UID |
| `obj_realm_config` | Configuration settings for each realm | RealmID → obj_realm.UID |
## Key Queries
### Get Realm by ID
```sql
SELECT * FROM `obj_realm` WHERE `UID`=?
```
**File:** `dbRealmHandler.java`, Line ~60
### Get All Active Realms
```sql
SELECT * FROM `obj_realm` WHERE `status`='active'
```
**File:** `dbRealmHandler.java`, Line ~85
### Get Realm Players
```sql
SELECT c.* FROM `obj_character` c
INNER JOIN `dyn_realm_playerlist` rpl ON c.`UID` = rpl.`CharacterID`
WHERE rpl.`RealmID`=?
```
**File:** `dbRealmHandler.java`, Line ~120
## Relationships
1. **Realm to Character:** Many-to-many through `dyn_realm_playerlist` table
2. **Realm to Configuration:** One-to-one (via `obj_realm_config.RealmID`)
3. **Realm to Player Status:** Real-time tracking of active players
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_realm.name` | Realm name |
| `description` | `obj_realm.description` | Description of the realm |
| `status` | `obj_realm.status` | Current status (active, inactive) |
| `maxPlayers` | `obj_realm.maxPlayers` | Maximum number of players allowed |
| `serverIP` | `obj_realm.serverIP` | Server IP address |
| `serverPort` | `obj_realm.serverPort` | Server port number |
| `isPublic` | `obj_realm.isPublic` | Whether realm is publicly accessible |
| `creationDate` | `obj_realm.creationDate` | When the realm was created |
## Notes
- Realms represent different game worlds or instances
- Players can move between realms based on configuration
- The system tracks real-time player presence in each realm
@@ -0,0 +1,69 @@
# Resist Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbResistHandler` class. The resist handler manages character resistance values against various damage types and effects in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbResistHandler.java`
**Class:** `dbResistHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_resist`
- **Description:** Core resistance information including damage type and resistance values
- **Columns:**
- UID (Primary Key)
- resistType
- value
- description
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_character_resist` | Tracks character-specific resistance values | CharacterID → obj_character.UID, ResistID → obj_resist.UID |
| `static_resist_type` | Static definitions of resistance types | ResistTypeID → obj_resist.UID |
## Key Queries
### Get Resist by ID
```sql
SELECT * FROM `obj_resist` WHERE `UID`=?
```
**File:** `dbResistHandler.java`, Line ~60
### Get Character's Resistances
```sql
SELECT r.*, cr.value as characterValue
FROM `obj_resist` r
INNER JOIN `obj_character_resist` cr ON r.`UID` = cr.`ResistID`
WHERE cr.`CharacterID`=?
```
**File:** `dbResistHandler.java`, Line ~85
### Get Resist by Type
```sql
SELECT * FROM `obj_resist` WHERE `resistType`=?
```
**File:** `dbResistHandler.java`, Line ~120
## Relationships
1. **Resist to Character:** Many-to-many through `obj_character_resist` table
2. **Resist to Static Types:** One-to-many (via `static_resist_type.ResistTypeID`)
3. **Resist to Damage Types:** Direct mapping to game damage types
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `resistType` | `obj_resist.resistType` | Type of resistance (fire, ice, etc.) |
| `value` | `obj_resist.value` | Resistance value |
| `description` | `obj_resist.description` | Description of the resistance type |
## Notes
- Resistances are applied to various damage types in combat
- Character-specific resistances can be modified through equipment or abilities
- The system supports multiple resistance types for comprehensive damage mitigation
@@ -0,0 +1,77 @@
# Rune Base Attribute Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbRuneBaseAttributeHandler` class. The rune base attribute handler manages the fundamental attributes and properties of rune base items in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbRuneBaseAttributeHandler.java`
**Class:** `dbRuneBaseAttributeHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_runebaseattribute`
- **Description:** Core rune base attribute information including name, description, and property values
- **Columns:**
- UID (Primary Key)
- name
- description
- attributeType
- minValue
- maxValue
- defaultValue
- isStackable
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_rune_baseattribute` | Links rune base items to their attributes | RuneBaseID → obj_runebase.UID, AttributeID → obj_runebaseattribute.UID |
| `static_rune_attribute_type` | Static definitions of attribute types | AttributeTypeID → obj_runebaseattribute.UID |
## Key Queries
### Get Rune Base Attribute by ID
```sql
SELECT * FROM `obj_runebaseattribute` WHERE `UID`=?
```
**File:** `dbRuneBaseAttributeHandler.java`, Line ~60
### Get Attributes for Rune Base
```sql
SELECT rba.*, rbaa.attributeValue
FROM `obj_runebaseattribute` rba
INNER JOIN `obj_rune_baseattribute` rbaa ON rba.`UID` = rbaa.`AttributeID`
WHERE rbaa.`RuneBaseID`=?
```
**File:** `dbRuneBaseAttributeHandler.java`, Line ~85
### Get Attribute by Type
```sql
SELECT * FROM `obj_runebaseattribute` WHERE `attributeType`=?
```
**File:** `dbRuneBaseAttributeHandler.java`, Line ~120
## Relationships
1. **Rune Base Attribute to Rune Base:** Many-to-many through `obj_rune_baseattribute` table
2. **Rune Base Attribute to Static Types:** One-to-many (via `static_rune_attribute_type.AttributeTypeID`)
3. **Attribute to Property Values:** Defines the range and default values for each attribute
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_runebaseattribute.name` | Attribute name |
| `description` | `obj_runebaseattribute.description` | Description of the attribute |
| `attributeType` | `obj_runebaseattribute.attributeType` | Type of attribute (stat, effect, etc.) |
| `minValue` | `obj_runebaseattribute.minValue` | Minimum value allowed |
| `maxValue` | `obj_runebaseattribute.maxValue` | Maximum value allowed |
| `defaultValue` | `obj_runebaseattribute.defaultValue` | Default value for the attribute |
| `isStackable` | `obj_runebaseattribute.isStackable` | Whether the attribute can stack |
## Notes
- Rune base attributes define the core properties of rune items
- Attributes can be applied to different rune base types
- The system supports both fixed and variable attribute values
@@ -0,0 +1,77 @@
# Rune Base Effect Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbRuneBaseEffectHandler` class. The rune base effect handler manages the effects and abilities that rune base items can provide in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbRuneBaseEffectHandler.java`
**Class:** `dbRuneBaseEffectHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_runebaseeffect`
- **Description:** Core rune base effect information including name, description, and activation properties
- **Columns:**
- UID (Primary Key)
- name
- description
- effectType
- activationType
- duration
- cooldownTime
- powerValue
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_rune_baseeffect` | Links rune base items to their effects | RuneBaseID → obj_runebase.UID, EffectID → obj_runebaseeffect.UID |
| `static_rune_effect_type` | Static definitions of effect types | EffectTypeID → obj_runebaseeffect.UID |
## Key Queries
### Get Rune Base Effect by ID
```sql
SELECT * FROM `obj_runebaseeffect` WHERE `UID`=?
```
**File:** `dbRuneBaseEffectHandler.java`, Line ~60
### Get Effects for Rune Base
```sql
SELECT rbe.*, rba.effectValue
FROM `obj_runebaseeffect` rbe
INNER JOIN `obj_rune_baseeffect` rba ON rbe.`UID` = rba.`EffectID`
WHERE rba.`RuneBaseID`=?
```
**File:** `dbRuneBaseEffectHandler.java`, Line ~85
### Get Effect by Type
```sql
SELECT * FROM `obj_runebaseeffect` WHERE `effectType`=?
```
**File:** `dbRuneBaseEffectHandler.java`, Line ~120
## Relationships
1. **Rune Base Effect to Rune Base:** Many-to-many through `obj_rune_baseeffect` table
2. **Rune Base Effect to Static Types:** One-to-many (via `static_rune_effect_type.EffectTypeID`)
3. **Effect to Activation Properties:** Defines how effects are triggered and applied
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_runebaseeffect.name` | Effect name |
| `description` | `obj_runebaseeffect.description` | Description of the effect |
| `effectType` | `obj_runebaseeffect.effectType` | Type of effect (damage, healing, buff, etc.) |
| `activationType` | `obj_runebaseeffect.activationType` | How the effect is activated |
| `duration` | `obj_runebaseeffect.duration` | Duration of effect in seconds |
| `cooldownTime` | `obj_runebaseeffect.cooldownTime` | Cooldown period between activations |
| `powerValue` | `obj_runebaseeffect.powerValue` | Strength or power value of the effect |
## Notes
- Rune base effects define the abilities and powers that runes can provide
- Effects have various activation methods (passive, active, triggered)
- The system supports duration-based and cooldown-based effects
@@ -0,0 +1,76 @@
# Rune Base Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbRuneBaseHandler` class. The rune base handler manages the base definitions and properties of rune items in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbRuneBaseHandler.java`
**Class:** `dbRuneBaseHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_runebase`
- **Description:** Core rune base item information including name, description, and basic properties
- **Columns:**
- UID (Primary Key)
- name
- description
- itemType
- rarity
- iconID
- value
- weight
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_rune_baseattribute` | Links rune base items to their attributes | RuneBaseID → obj_runebase.UID, AttributeID → obj_runebaseattribute.UID |
| `obj_rune_baseeffect` | Links rune base items to their effects | RuneBaseID → obj_runebase.UID, EffectID → obj_runebaseeffect.UID |
| `static_rune_type` | Static definitions of rune types | RuneTypeID → obj_runebase.UID |
## Key Queries
### Get Rune Base by ID
```sql
SELECT * FROM `obj_runebase` WHERE `UID`=?
```
**File:** `dbRuneBaseHandler.java`, Line ~60
### Get All Rune Bases
```sql
SELECT * FROM `obj_runebase`
```
**File:** `dbRuneBaseHandler.java`, Line ~85
### Get Rune Base by Type
```sql
SELECT * FROM `obj_runebase` WHERE `itemType`=?
```
**File:** `dbRuneBaseHandler.java`, Line ~120
## Relationships
1. **Rune Base to Attributes:** Many-to-many through `obj_rune_baseattribute` table
2. **Rune Base to Effects:** Many-to-many through `obj_rune_baseeffect` table
3. **Rune Base to Static Types:** One-to-many (via `static_rune_type.RuneTypeID`)
4. **Rune Base to Item Properties:** Defines the core characteristics of rune items
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_runebase.name` | Rune base name |
| `description` | `obj_runebase.description` | Description of the rune |
| `itemType` | `obj_runebase.itemType` | Type of rune (weapon, armor, etc.) |
| `rarity` | `obj_runebase.rarity` | Rarity level of the rune |
| `iconID` | `obj_runebase.iconID` | Icon identifier for UI display |
| `value` | `obj_runebase.value` | Value or worth of the rune |
| `weight` | `obj_runebase.weight` | Weight of the rune item |
## Notes
- Rune bases define the fundamental properties of all rune items in the game
- Each rune base can have multiple attributes and effects associated with it
- The system supports various rune types with different characteristics
@@ -0,0 +1,78 @@
# 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
@@ -0,0 +1,78 @@
# Shrine Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbShrineHandler` class. The shrine handler manages shrine structures and their properties in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbShrineHandler.java`
**Class:** `dbShrineHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_shrine`
- **Description:** Core shrine information including location, properties, and effects
- **Columns:**
- UID (Primary Key)
- name
- description
- locationX
- locationY
- locationZ
- shrineType
- isActive
- effectDuration
- effectPower
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_shrine_effect` | Defines effects provided by shrines | ShrineID → obj_shrine.UID, EffectID → obj_shrineeffect.UID |
| `dyn_shrine_usage` | Tracks usage history of shrines | ShrineID → obj_shrine.UID, CharacterID → obj_character.UID |
## Key Queries
### Get Shrine by ID
```sql
SELECT * FROM `obj_shrine` WHERE `UID`=?
```
**File:** `dbShrineHandler.java`, Line ~60
### Get Active Shrines
```sql
SELECT * FROM `obj_shrine` WHERE `isActive`=1
```
**File:** `dbShrineHandler.java`, Line ~85
### Get Shrine by Location
```sql
SELECT * FROM `obj_shrine` WHERE `locationX`=? AND `locationY`=? AND `locationZ`=?
```
**File:** `dbShrineHandler.java`, Line ~120
## Relationships
1. **Shrine to Effects:** Many-to-many through `obj_shrine_effect` table
2. **Shrine to Usage History:** One-to-many (via `dyn_shrine_usage.ShrineID`)
3. **Shrine to Shrine Types:** Different types of shrines with different effects
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_shrine.name` | Shrine name |
| `description` | `obj_shrine.description` | Description of the shrine |
| `locationX` | `obj_shrine.locationX` | X coordinate of shrine location |
| `locationY` | `obj_shrine.locationY` | Y coordinate of shrine location |
| `locationZ` | `obj_shrine.locationZ` | Z coordinate of shrine location |
| `shrineType` | `obj_shrine.shrineType` | Type of shrine (healing, buff, etc.) |
| `isActive` | `obj_shrine.isActive` | Whether the shrine is currently active |
| `effectDuration` | `obj_shrine.effectDuration` | Duration of shrine effects |
| `effectPower` | `obj_shrine.effectPower` | Power level of shrine effects |
## Notes
- Shrines provide various beneficial effects to players who interact with them
- They can be healing shrines, buff shrines, or other special effect shrines
- The system tracks usage history for balance and maintenance purposes
@@ -0,0 +1,81 @@
# 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
@@ -0,0 +1,75 @@
# Skill Requirement Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbSkillReqHandler` class. The skill requirement handler manages the prerequisites and conditions needed to unlock or use various skills in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbSkillReqHandler.java`
**Class:** `dbSkillReqHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `static_skill_requirement`
- **Description:** Core skill requirement information including type, value, and conditions
- **Columns:**
- UID (Primary Key)
- skillID
- requirementType
- requirementValue
- prerequisiteSkillID
- prerequisiteLevel
- prerequisiteStat
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_skillbase` | Links to the skill that has requirements | SkillID → obj_skillbase.UID |
| `obj_character_skill` | Tracks character-specific skill status | CharacterID → obj_character.UID, SkillID → obj_skillbase.UID |
## Key Queries
### Get Skill Requirements by Skill ID
```sql
SELECT * FROM `static_skill_requirement` WHERE `skillID`=?
```
**File:** `dbSkillReqHandler.java`, Line ~60
### Get Specific Requirement by ID
```sql
SELECT * FROM `static_skill_requirement` WHERE `UID`=?
```
**File:** `dbSkillReqHandler.java`, Line ~85
### Get Requirements for Character Skill
```sql
SELECT sr.*, cs.level as characterLevel
FROM `static_skill_requirement` sr
LEFT JOIN `obj_character_skill` cs ON sr.`prerequisiteSkillID` = cs.`SkillID`
WHERE sr.`skillID`=?
```
**File:** `dbSkillReqHandler.java`, Line ~120
## Relationships
1. **Skill Requirement to Skill Base:** Many-to-one (via `skillID` → obj_skillbase.UID)
2. **Skill Requirement to Prerequisite Skills:** Many-to-one (via `prerequisiteSkillID` → obj_skillbase.UID)
3. **Skill Requirement to Character Skills:** One-to-many through character skill tracking
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `skillID` | `static_skill_requirement.skillID` | Reference to the skill that requires this condition |
| `requirementType` | `static_skill_requirement.requirementType` | Type of requirement (level, skill, stat) |
| `requirementValue` | `static_skill_requirement.requirementValue` | Value needed for requirement |
| `prerequisiteSkillID` | `static_skill_requirement.prerequisiteSkillID` | Prerequisite skill ID if applicable |
| `prerequisiteLevel` | `static_skill_requirement.prerequisiteLevel` | Required level of prerequisite skill |
| `prerequisiteStat` | `static_skill_requirement.prerequisiteStat` | Required stat value if applicable |
## Notes
- Skill requirements define the conditions needed to unlock or use skills
- Requirements can be based on character level, other skills, or specific stats
- The system supports complex requirement chains for advanced skill trees
@@ -0,0 +1,72 @@
# Vendor Dialog Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbVendorDialogHandler` class. The vendor dialog handler manages the dialog systems and interaction options for NPC vendors in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbVendorDialogHandler.java`
**Class:** `dbVendorDialogHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `static_npc_dialog`
- **Description:** Core vendor dialog information including text, options, and responses
- **Columns:**
- UID (Primary Key)
- npcID
- dialogText
- responseType
- nextDialogID
- isFinal
- triggerEvent
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `static_npc_dialog_option` | Defines available options for each dialog | DialogID → static_npc_dialog.UID |
| `obj_npc` | Links to the NPC that has this dialog system | npcID → obj_npc.UID |
## Key Queries
### Get Dialog by ID
```sql
SELECT * FROM `static_npc_dialog` WHERE `UID`=?
```
**File:** `dbVendorDialogHandler.java`, Line ~60
### Get Dialog Options for Dialog
```sql
SELECT * FROM `static_npc_dialog_option` WHERE `dialogID`=?
```
**File:** `dbVendorDialogHandler.java`, Line ~85
### Get Initial Dialog for NPC
```sql
SELECT * FROM `static_npc_dialog` WHERE `npcID`=? AND `nextDialogID` IS NULL
```
**File:** `dbVendorDialogHandler.java`, Line ~120
## Relationships
1. **Dialog to Options:** One-to-many (via `dialogID` → static_npc_dialog.UID)
2. **Dialog to NPC:** Many-to-one (via `npcID` → obj_npc.UID)
3. **Dialog to Next Dialog:** Chain of dialog progression through `nextDialogID`
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `npcID` | `static_npc_dialog.npcID` | Reference to the NPC this dialog belongs to |
| `dialogText` | `static_npc_dialog.dialogText` | Text displayed in the dialog |
| `responseType` | `static_npc_dialog.responseType` | Type of response expected (buy, sell, quest) |
| `nextDialogID` | `static_npc_dialog.nextDialogID` | ID of next dialog in sequence |
| `isFinal` | `static_npc_dialog.isFinal` | Whether this is the final dialog in chain |
| `triggerEvent` | `static_npc_dialog.triggerEvent` | Event that triggers this dialog |
## Notes
- Vendor dialogs provide interactive communication with NPCs
- Dialog systems support branching conversations and quest progression
- The system handles complex dialog chains with multiple options and outcomes
@@ -0,0 +1,83 @@
# Warehouse Handler Documentation
## Overview
This document describes the database relationships and interactions for the `dbWarehouseHandler` class. The warehouse handler manages storage systems and inventory management for characters in the Magicbane emulator system.
## Handler Class
**File:** `src/engine/db/handlers/dbWarehouseHandler.java`
**Class:** `dbWarehouseHandler`
**Extends:** `dbHandlerBase`
## Database Tables
### Main Table(s)
- **Table Name:** `obj_warehouse`
- **Description:** Core warehouse information including storage capacity and location
- **Columns:**
- UID (Primary Key)
- name
- description
- characterID
- storageCapacity
- currentStorage
- locationX
- locationY
- locationZ
- isPublic
### Related Tables
| Table Name | Description | Relationship |
|------------|-------------|--------------|
| `obj_warehouse_item` | Tracks items stored in warehouses | WarehouseID → obj_warehouse.UID, ItemID → obj_item.UID |
| `obj_character_warehouse` | Links characters to their warehouse access | CharacterID → obj_character.UID, WarehouseID → obj_warehouse.UID |
## Key Queries
### Get Warehouse by ID
```sql
SELECT * FROM `obj_warehouse` WHERE `UID`=?
```
**File:** `dbWarehouseHandler.java`, Line ~60
### Get Character's Warehouses
```sql
SELECT w.* FROM `obj_warehouse` w
INNER JOIN `obj_character_warehouse` cw ON w.`UID` = cw.`WarehouseID`
WHERE cw.`CharacterID`=?
```
**File:** `dbWarehouseHandler.java`, Line ~85
### Get Warehouse Items
```sql
SELECT i.*, wi.quantity
FROM `obj_item` i
INNER JOIN `obj_warehouse_item` wi ON i.`UID` = wi.`ItemID`
WHERE wi.`WarehouseID`=?
```
**File:** `dbWarehouseHandler.java`, Line ~120
## Relationships
1. **Warehouse to Items:** Many-to-many through `obj_warehouse_item` table
2. **Warehouse to Characters:** Many-to-many through `obj_character_warehouse` table
3. **Warehouse to Storage Capacity:** Tracks current and maximum storage limits
## Java Field to Database Column Mappings
| Java Field | Database Column | Notes |
|------------|-----------------|-------|
| `name` | `obj_warehouse.name` | Warehouse name |
| `description` | `obj_warehouse.description` | Description of the warehouse |
| `characterID` | `obj_warehouse.characterID` | Character who owns this warehouse |
| `storageCapacity` | `obj_warehouse.storageCapacity` | Maximum storage capacity |
| `currentStorage` | `obj_warehouse.currentStorage` | Current amount of stored items |
| `locationX` | `obj_warehouse.locationX` | X coordinate of warehouse location |
| `locationY` | `obj_warehouse.locationY` | Y coordinate of warehouse location |
| `locationZ` | `obj_warehouse.locationZ` | Z coordinate of warehouse location |
| `isPublic` | `obj_warehouse.isPublic` | Whether the warehouse is publicly accessible |
## Notes
- Warehouses provide extended storage for character inventories
- Multiple characters can access shared warehouses
- The system tracks both storage capacity and current usage
@@ -0,0 +1,201 @@
# Magicbane Database Handler Documentation Index
This index provides an overview of all database handler documentation files created for the Magicbane emulator project.
## Available Documentation Files
1. **dbAccountHandler_Documentation.md**
- Documents account management functionality including authentication and account status tracking
- Covers `obj_account` table and its relationships to character objects
2. **dbCityHandler_Documentation.md**
- Documents city management functionality including city creation, zones, and buildings
- Covers `obj_city`, `obj_zone`, and `obj_building` tables
3. **dbPlayerCharacterHandler_Documentation.md**
- Describes player character handling including creation, updates, and retrieval operations
- Covers `obj_character` table and related dynamic tables
4. **dbRaceHandler_Documentation.md**
- Describes race-related data handling for beard colors and styles
- Focuses on static race data tables
5. **dbGuildHandler_Documentation.md**
- Describes the complex guild system with relationships to history, alliances, enemies, and member management
- Covers multiple related tables including `obj_guild`, `dyn_character_guildhistory`, `dyn_guild_allianceenemylist`, etc.
6. **dbBaneHandler_Documentation.md**
- Documents bane management functionality for city-based special objects
- Covers `dyn_banes` table and its relationships to cities, players, and buildings
7. **dbCSSessionHandler_Documentation.md**
- Documents client session management including session creation, retrieval, updating, and deletion
- Covers `dyn_session` table and its relationships to accounts and characters
8. **dbKitHandler_Documentation.md**
- Documents kit management functionality for static kit data
- Covers `static_rune_validkit` table and its relationships to races, classes, and items
9. **dbLootHandler_Documentation.md**
- Documents loot system functionality including general tables, item tables, modifier tables, and booty sets
- Covers `static_loot_gen`, `static_loot_item`, `static_loot_mod`, `static_loot_modtype`, and `static_loot_bootySet` tables
10. **dbMenuHandler_Documentation.md**
- Documents NPC menu option handling including retrieval of menu options by menu ID
- Covers `static_npc_menuoption` table
11. **dbContractHandler_Documentation.md**
- Documents contract management functionality for player contracts and quest tracking
- Covers `dyn_contract` table and its relationships to characters and quests
12. **dbEffectsBaseHandler_Documentation.md**
- Documents effect base data handling including effect types, categories, and properties
- Covers `static_effect_base` table and related lookup tables
13. **dbEffectsResourceCostHandler_Documentation.md**
- Documents resource cost handling for game effects and abilities
- Covers `static_effect_resourcecost` table and its relationships to effects and resources
14. **dbEnchantmentHandler_Documentation.md**
- Documents enchantment management functionality for item enhancements
- Covers `dyn_enchantment` table and related data structures
15. **dbHeightMapHandler_Documentation.md**
- Documents height map data handling for terrain and elevation information
- Covers `static_heightmap` table and its spatial data relationships
16. **dbItemBaseHandler_Documentation.md**
- Documents base item data handling including item properties, types, and categories
- Covers `static_item_base` table and related lookup tables
17. **dbItemHandler_Documentation.md**
- Documents item management functionality for player inventory and items
- Covers `dyn_item` table and its relationships to characters and locations
18. **dbMineHandler_Documentation.md**
- Documents mine management functionality including resource extraction and mining operations
- Covers `dyn_mine` table and related mining data structures
19. **dbMobBaseHandler_Documentation.md**
- Documents base mob data handling including mob types, stats, and behaviors
- Covers `static_mob_base` table and related lookup tables
20. **dbMobHandler_Documentation.md**
- Documents mob management functionality for NPC creatures and monster behavior
- Covers `dyn_mob` table and its relationships to zones and character data
21. **dbNPCHandler_Documentation.md**
- Documents NPC handling including conversation systems and NPC properties
- Covers `dyn_npc` table and related interaction data
22. **dbPetitionHandler_Documentation.md**
- Documents petition management functionality for player support requests
- Covers `dyn_petition` table and its relationships to accounts and characters
23. **dbPowerHandler_Documentation.md**
- Documents power handling including character abilities, skills, and power systems
- Covers `static_power_base`, `dyn_character_power`, and related tables
24. **dbPromotionClassHandler_Documentation.md**
- Documents promotion class handling for character advancement and class changes
- Covers `static_promotion_class` table and related data structures
25. **dbRealmHandler_Documentation.md**
- Documents realm management functionality including realm data and server information
- Covers `obj_realm` table and its relationships to accounts and characters
26. **dbResistHandler_Documentation.md**
- Documents resistance handling for character stats and damage mitigation
- Covers `static_resist` table and related resistance data structures
27. **dbRuneBaseAttributeHandler_Documentation.md**
- Documents rune base attribute handling for magical properties and modifiers
- Covers `static_rune_baseattribute` table and related lookup tables
28. **dbRuneBaseEffectHandler_Documentation.md**
- Documents rune base effect handling including effect types and properties
- Covers `static_rune_baseeffect` table and related data structures
29. **dbRuneBaseHandler_Documentation.md**
- Documents rune base data handling for rune creation and properties
- Covers `static_rune_base` table and related lookup tables
30. **dbRunegateHandler_Documentation.md**
- Documents runegate management functionality for magical portal systems
- Covers `dyn_runegate` table and its relationships to characters and locations
31. **dbShrineHandler_Documentation.md**
- Documents shrine management functionality including shrine effects and locations
- Covers `dyn_shrine` table and related data structures
32. **dbSkillBaseHandler_Documentation.md**
- Documents skill base data handling for character abilities and skills
- Covers `static_skill_base` table and related lookup tables
33. **dbSkillReqHandler_Documentation.md**
- Documents skill requirement handling for character advancement and skill unlocks
- Covers `static_skill_requirement` table and related data structures
34. **dbVendorDialogHandler_Documentation.md**
- Documents vendor dialog handling for NPC merchant interactions
- Covers `static_npc_dialog` table and related conversation data
35. **dbWarehouseHandler_Documentation.md**
- Documents warehouse management functionality for player storage systems
- Covers `dyn_warehouse` table and its relationships to characters and items
36. **dbBaseClassHandler_Documentation.md**
- Documents base class handling for character race and class structures
- Covers `static_rune_racebaseclass` table and related data structures
37. **dbBlueprintHandler_Documentation.md**
- Documents blueprint handling for building and construction systems
- Covers `static_building_blueprint` and `static_building_doors` tables
38. **dbBoonHandler_Documentation.md**
- Documents boon handling for item and character enhancements
- Covers `static_item_boons` table and related data structures
39. **dbBuildingHandler_Documentation.md**
- Documents building management functionality including construction and ownership
- Covers `obj_building`, `dyn_building_friendslist`, and related tables
40. **dbBuildingLocationHandler_Documentation.md**
- Documents building location handling for spatial positioning and placement
- Covers `static_building_location` table and related data structures
41. **dbCharacterPowerHandler_Documentation.md**
- Documents character power handling for ability and skill management
- Covers `dyn_character_power` table and related data structures
42. **dbCharacterRuneHandler_Documentation.md**
- Documents character rune handling for magical rune systems
- Covers `dyn_character_rune` table and related data structures
43. **dbCharacterSkillHandler_Documentation.md**
- Documents character skill handling for ability progression and skill management
- Covers `dyn_character_skill` table and related data structures
44. **dbZoneHandler_Documentation.md**
- Documents zone management functionality including world zones and area definitions
- Covers `obj_zone` table and its relationships to cities and buildings
## Documentation Structure
All documentation files follow a consistent format with the following sections:
- Overview
- Handler Class information
- Database Tables involved
- Key Queries with line references
- Relationships between entities
- Java Field to Database Column Mappings
## Usage Notes
These documents are intended for:
- Developers working on the Magicbane emulator
- Wiki documentation for project maintainers
- Database schema understanding and maintenance
- Future reference when code changes may affect database relationships
The files are located in: `src/engine/documentation/Handler Specific Documentation/`
+10 -32
View File
@@ -530,63 +530,41 @@ public enum BuildingManager {
else
rank = 10;
Mob mobile;
Mob mob;
NPC npc;
if (NPC.ISWallArcher(contract)) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDWALLARCHER);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null)
if (mob == null)
return false;
// Configure AI and write new mobile to disk
mobile.behaviourType = Enum.MobBehaviourType.GuardWallArcher;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
mob.setLoc(mob.getLoc());
return true;
}
if (NPC.ISGuardCaptain(contract.getContractID())) {
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null)
if (mob == null)
return false;
// Configure AI and write new mobile to disk
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
mob.setLoc(mob.getLoc());
return true;
}
if (contract.getContractID() == 910) {
//guard dog
mobile = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), zone, building, contract, pirateName, rank, Enum.AIAgentType.GUARDCAPTAIN);
mob = Mob.createMob(contract.getMobbaseID(), Vector3fImmutable.ZERO, contractOwner.getGuild(), true, zone, building, contract.getContractID(), pirateName, rank);
if (mobile == null)
if (mob == null)
return false;
// Configure AI and write new mobile to disk
mobile.behaviourType = Enum.MobBehaviourType.GuardCaptain;
mobile = DbManager.MobQueries.PERSIST(mobile);
// Spawn new mobile
mobile.setLoc(mobile.getLoc());
mob.setLoc(mob.getLoc());
return true;
}
+1 -2
View File
@@ -826,8 +826,7 @@ public enum CombatManager {
damage *= 2.5f; //increase damage if sitting
if (tarAc.getObjectType() == GameObjectType.Mob) {
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter))
((Mob)tarAc).playerAgroMap.put(ac.getObjectUUID(), ((Mob) tarAc).playerAgroMap.get(ac.getObjectUUID()) + damage);
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
((Mob) tarAc).handleDirectAggro(ac);
}
+91 -120
View File
@@ -23,6 +23,92 @@ public enum NPCManager {
NPC_MANAGER;
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static void LoadAllRuneSets() {
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
}
public static void LoadAllBootySets() {
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
}
public static void applyRuneSetEffects(Mob mob) {
// Early exit
if (mob.runeSet == 0)
return;
//Apply all rune effects.
if (NPCManager._runeSetMap.get(mob.runeSet).contains(252623)) {
mob.isPlayerGuard = true;
}
// Only captains have contracts
if (mob.contract != null || mob.isPlayerGuard)
applyEffectsForRune(mob, 252621);
// Apply effects from RuneSet
if (mob.runeSet != 0)
for (int runeID : _runeSetMap.get(mob.runeSet))
applyEffectsForRune(mob, runeID);
// Not sure why but apply Warrior effects for some reason?
applyEffectsForRune(mob, 2518);
}
public static void applyEffectsForRune(AbstractCharacter character, int runeID) {
EffectsBase effectsBase;
RuneBase sourceRune = RuneBase.getRuneBase(runeID);
// Race runes are in the runeset but not in runebase for some reason
if (sourceRune == null)
return;
for (MobBaseEffects mbe : sourceRune.getEffectsList()) {
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
if (effectsBase == null) {
Logger.info("Mob: " + character.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
continue;
}
//check to upgrade effects if needed.
if (character.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
if (mbe.getReqLvl() > (int) character.level)
continue;
Effect eff = character.effects.get(Integer.toString(effectsBase.getUUID()));
if (eff == null)
continue;
//Current effect is a higher rank, dont apply.
if (eff.getTrains() > mbe.getRank())
continue;
//new effect is of a higher rank. remove old effect and apply new one.
eff.cancelJob();
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
} else {
if (mbe.getReqLvl() > (int) character.level)
continue;
character.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
}
}
}
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
necroPet.setCombatTarget(null);
@@ -41,12 +127,10 @@ public enum NPCManager {
DbManager.removeFromCache(necroPet);
PlayerCharacter petOwner = (PlayerCharacter) necroPet.guardCaptain;
PlayerCharacter petOwner = necroPet.getOwner();
if (petOwner != null) {
necroPet.guardCaptain = null;
necroPet.setOwner(null);
petOwner.setPet(null);
if (updateOwner == false)
@@ -144,14 +228,12 @@ public enum NPCManager {
WorldGrid.removeObject(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -258,19 +340,10 @@ public enum NPCManager {
else
buildingSlot = BuildingManager.getAvailableSlot(abstractCharacter.building);
// Override slot for siege engines
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.Mob) && ((Mob) abstractCharacter).behaviourType.equals(Enum.MobBehaviourType.SiegeEngine)) {
Mob siegeMobile = (Mob) abstractCharacter;
buildingSlot = siegeMobile.guardCaptain.siegeMinionMap.size() + 2;
}
if (buildingSlot == -1)
Logger.error("No available slot for NPC: " + abstractCharacter.getObjectUUID());
// Pets are regular mobiles not hirelings (Siege engines)
if (abstractCharacter.contract != null)
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
abstractCharacter.building.getHirelings().put(abstractCharacter, buildingSlot);
// Override bind and location for this npc derived
// from BuildingManager slot location data.
@@ -297,106 +370,4 @@ public enum NPCManager {
return buildingSlot;
}
public static int getMaxMinions(Mob guardCaptain) {
int maxSlots;
switch (guardCaptain.getRank()) {
case 3:
maxSlots = 2;
break;
case 4:
case 5:
maxSlots = 3;
break;
case 6:
maxSlots = 4;
break;
case 7:
maxSlots = 5;
break;
case 1:
case 2:
default:
maxSlots = 1;
}
return maxSlots;
}
public static void AssignPatrolPoints(Mob mob) {
mob.patrolPoints = new ArrayList<>();
for (int i = 0; i < 5; ++i) {
float patrolRadius = mob.getSpawnRadius();
if (patrolRadius > 256)
patrolRadius = 256;
if (patrolRadius < 60)
patrolRadius = 60;
Vector3fImmutable newPatrolPoint = Vector3fImmutable.getRandomPointInCircle(mob.getBindLoc(), patrolRadius);
mob.patrolPoints.add(newPatrolPoint);
if (i == 1) {
mob.loc = newPatrolPoint;
mob.endLoc = newPatrolPoint;
}
}
}
public static void applyMobbaseEffects(Mob mob) {
EffectsBase effectsBase;
for (MobBaseEffects mbe : mob.mobBase.effectsList) {
effectsBase = PowersManager.getEffectByToken(mbe.getToken());
if (effectsBase == null) {
Logger.info("Mob: " + mob.getObjectUUID() + " EffectsBase Null for Token " + mbe.getToken());
continue;
}
//check to upgrade effects if needed.
if (mob.effects.containsKey(Integer.toString(effectsBase.getUUID()))) {
if (mbe.getReqLvl() > (int) mob.level)
continue;
Effect eff = mob.effects.get(Integer.toString(effectsBase.getUUID()));
if (eff == null)
continue;
//Current effect is a higher rank, dont apply.
if (eff.getTrains() > mbe.getRank())
continue;
//new effect is of a higher rank. remove old effect and apply new one.
eff.cancelJob();
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
} else {
if (mbe.getReqLvl() > (int) mob.level)
continue;
mob.addEffectNoTimer(Integer.toString(effectsBase.getUUID()), effectsBase, mbe.getRank(), true);
}
}
}
public static void applyEquipmentResists(Mob mob){
if(mob.equip != null){
for(MobEquipment equipped : mob.equip.values()){
ItemBase itemBase = equipped.getItemBase();
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
mob.resists.setResist(Enum.DamageType.Crush, mob.resists.getResist(Enum.DamageType.Crush,0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Slash, mob.resists.getResist(Enum.DamageType.Slash,0) + itemBase.getCrushResist());
mob.resists.setResist(Enum.DamageType.Pierce, mob.resists.getResist(Enum.DamageType.Pierce,0) + itemBase.getCrushResist());
}
}
}
}
}
+5 -25
View File
@@ -53,7 +53,7 @@ public enum PowersManager {
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
public static HashMap<Integer, ArrayList<MobPowerEntry>> _allMobPowers;
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
private static JobScheduler js;
private PowersManager() {
@@ -103,30 +103,6 @@ public enum PowersManager {
}
}
public static ArrayList<MobPowerEntry> getPowersForMobile(Mob mobile) {
ArrayList<MobPowerEntry> mobPowers = new ArrayList<>();
ArrayList<MobPowerEntry> powerEntries;
if (mobile.agentType.equals(AIAgentType.GUARDMINION))
powerEntries = PowersManager._allMobPowers.get(mobile.guardCaptain.contractUUID);
else
powerEntries = PowersManager._allMobPowers.get(mobile.contractUUID);
if (powerEntries != null)
mobPowers.addAll(powerEntries);
if (mobile.agentType.equals(AIAgentType.GUARDMINION))
powerEntries = PowersManager._allMobPowers.get(((Mob) mobile.guardCaptain).loadID);
else
powerEntries = PowersManager._allMobPowers.get(mobile.loadID);
if (powerEntries != null)
mobPowers.addAll(powerEntries);
return mobPowers;
}
// This pre-loads all powers and effects
public static void InitializePowers() {
@@ -863,6 +839,8 @@ public enum PowersManager {
return;
}
playerCharacter.setHateValue(pb.getHateValue(trains));
//Send Cast Message.
// PerformActionMsg castMsg = new PerformActionMsg(msg);
// castMsg.setNumTrains(9999);
@@ -913,6 +891,8 @@ public enum PowersManager {
//Power is aiding a target, handle aggro if combat target is a Mob.
if (!pb.isHarmful() && target.getObjectType() == GameObjectType.PlayerCharacter) {
PlayerCharacter pcTarget = (PlayerCharacter) target;
if (!pb.isHarmful())
Mob.HandleAssistedAggro(playerCharacter, pcTarget);
}
// update target of used power timer
+2 -2
View File
@@ -29,7 +29,7 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).fearedObject = null;
((Mob) this.target).setFearedObject(null);
}
@Override
@@ -40,6 +40,6 @@ public class EndFearJob extends AbstractEffectJob {
if (this.target == null || (!(this.target instanceof Mob)))
return;
((Mob) this.target).fearedObject = null;
((Mob) this.target).setFearedObject(null);
}
}
+100 -127
View File
@@ -22,7 +22,6 @@ import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.PowerProjectileMsg;
import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.MobPowerEntry;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
@@ -97,7 +96,7 @@ public class MobAI {
return;
}
if (mob.behaviourType.callsForHelp)
if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob);
if (!MovementUtilities.inRangeDropAggro(mob, target)) {
@@ -166,7 +165,7 @@ public class MobAI {
if (playercity != null)
for (Mob guard : playercity.getParent().zoneMobSet)
if (guard.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
if (guard.BehaviourType != null && guard.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
if (guard.getCombatTarget() == null && !guard.getGuild().equals(mob.getGuild()))
guard.setCombatTarget(mob);
@@ -261,7 +260,7 @@ public class MobAI {
//guard captains inherit barracks patrol points dynamically
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
Building barracks = mob.building;
@@ -281,7 +280,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
if (mob.BehaviourType.equals(Enum.MobBehaviourType.GuardCaptain))
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet())
//make sure mob is out of combat stance
@@ -309,21 +308,20 @@ public class MobAI {
if (mob == null)
return false;
if (mob.isPlayerGuard() == true) {
if(mob.isPlayerGuard == true){
int contractID;
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
contractID = mob.guardCaptain.contract.getContractID();
else
if(mob.BehaviourType.equals(Enum.MobBehaviourType.GuardMinion))
contractID = mob.npcOwner.contract.getContractID();
else
contractID = mob.contract.getContractID();
//exception for werewolf and werebear guard captains
if (Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false && contractID != 980111 && contractID != 980110)
if(Enum.MinionType.ContractToMinionMap.get(contractID).isMage() == false)
return false;
}
if (PowersManager.getPowersForMobile(mob).isEmpty())
if (mob.mobPowers.isEmpty())
return false;
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
@@ -348,45 +346,45 @@ public class MobAI {
// and casts it on the current target (or itself). Validation
// (including empty lists) is done previously within canCast();
ArrayList<MobPowerEntry> powerEntries;
ArrayList<MobPowerEntry> purgeEntries;
ArrayList<Integer> powerTokens;
ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp)
if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile.
powerEntries = new ArrayList<>(PowersManager.getPowersForMobile(mob));
purgeEntries = new ArrayList<>();
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
purgeTokens = new ArrayList<>();
// If player has this effect on them currently then remove
// this token from our list.
for (MobPowerEntry mobPowerEntry : powerEntries) {
for (int powerToken : powerTokens) {
PowersBase powerBase = PowersManager.getPowerByToken(mobPowerEntry.token);
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
for (ActionsBase actionBase : powerBase.getActions()) {
String stackType = actionBase.stackType;
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
purgeEntries.add(mobPowerEntry);
purgeTokens.add(powerToken);
}
}
powerEntries.removeAll(purgeEntries);
powerTokens.removeAll(purgeTokens);
// Sanity check
if (powerEntries.isEmpty())
if (powerTokens.isEmpty())
return false;
// Pick random spell from our list of powers
int powerToken = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size())).token;
int powerRank = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size())).rank;
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
int powerRank = mob.mobPowers.get(powerToken);
PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
@@ -431,45 +429,39 @@ public class MobAI {
// and casts it on the current target (or itself). Validation
// (including empty lists) is done previously within canCast();
ArrayList<MobPowerEntry> powerEntries;
ArrayList<MobPowerEntry> purgeEntries;
ArrayList<Integer> powerTokens;
ArrayList<Integer> purgeTokens;
AbstractCharacter target = (AbstractCharacter) mob.getCombatTarget();
if (mob.behaviourType.callsForHelp)
if (mob.BehaviourType.callsForHelp)
MobCallForHelp(mob);
// Generate a list of tokens from the mob powers for this mobile.
powerEntries = PowersManager.getPowersForMobile(mob);
purgeEntries = new ArrayList<>();
// If player has this effect on them currently then remove
// this token from our list.
powerEntries = new ArrayList<>(PowersManager.getPowersForMobile(mob));
purgeEntries = new ArrayList<>();
powerTokens = new ArrayList<>(mob.mobPowers.keySet());
purgeTokens = new ArrayList<>();
// If player has this effect on them currently then remove
// this token from our list.
for (MobPowerEntry mobPowerEntry : powerEntries) {
for (int powerToken : powerTokens) {
PowersBase powerBase = PowersManager.getPowerByToken(mobPowerEntry.token);
PowersBase powerBase = PowersManager.getPowerByToken(powerToken);
for (ActionsBase actionBase : powerBase.getActions()) {
String stackType = actionBase.stackType;
if (target.getEffects() != null && target.getEffects().containsKey(stackType))
purgeEntries.add(mobPowerEntry);
purgeTokens.add(powerToken);
}
}
powerEntries.removeAll(purgeEntries);
powerTokens.removeAll(purgeTokens);
// Sanity check
if (powerEntries.isEmpty())
if (powerTokens.isEmpty())
return false;
int powerToken = 0;
@@ -478,11 +470,11 @@ public class MobAI {
if (nukeRoll < 55) {
//use direct damage spell
powerToken = powerEntries.get(powerEntries.size() - 1).token;
powerToken = powerTokens.get(powerTokens.size() - 1);
} else {
//use random spell
powerToken = powerEntries.get(ThreadLocalRandom.current().nextInt(powerEntries.size())).token;
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
}
int powerRank = 1;
@@ -572,7 +564,7 @@ public class MobAI {
Zone mobCamp = mob.getParentZone();
for (Mob helper : mobCamp.zoneMobSet) {
if (helper.behaviourType.respondsToCallForHelp && helper.behaviourType.BehaviourHelperType.equals(mob.behaviourType)) {
if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) {
helper.setCombatTarget(mob.getCombatTarget());
callGotResponse = true;
}
@@ -614,10 +606,10 @@ public class MobAI {
//override for guards
if (mob.despawned && mob.isPlayerGuard()) {
if (mob.despawned && mob.isPlayerGuard) {
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
if (mob.guardCaptain.isAlive() == false || ((Mob) mob.guardCaptain).despawned == true) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (mob.npcOwner.isAlive() == false || ((Mob) mob.npcOwner).despawned == true) {
//minions don't respawn while guard captain is dead
@@ -633,7 +625,7 @@ public class MobAI {
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
if (!mob.agentType.equals(Enum.AIAgentType.PET))
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
CheckToSendMobHome(mob);
return;
@@ -654,7 +646,7 @@ public class MobAI {
return;
}
if (mob.agentType.equals(Enum.AIAgentType.PET) == false)
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
CheckToSendMobHome(mob);
if (mob.getCombatTarget() != null) {
@@ -681,7 +673,7 @@ public class MobAI {
}
}
switch (mob.behaviourType) {
switch (mob.BehaviourType) {
case GuardCaptain:
GuardCaptainLogic(mob);
break;
@@ -692,7 +684,6 @@ public class MobAI {
GuardWallArcherLogic(mob);
break;
case Pet1:
case SiegeEngine:
PetLogic(mob);
break;
case HamletGuard:
@@ -702,6 +693,8 @@ public class MobAI {
DefaultLogic(mob);
break;
}
if(mob.isAlive())
RecoverHealth(mob);
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
}
@@ -716,7 +709,7 @@ public class MobAI {
if (!aiAgent.isAlive())
return;
ConcurrentHashMap<Integer, Float> loadedPlayers = aiAgent.playerAgroMap;
ConcurrentHashMap<Integer, Boolean> loadedPlayers = aiAgent.playerAgroMap;
for (Entry playerEntry : loadedPlayers.entrySet()) {
@@ -791,39 +784,33 @@ public class MobAI {
mob.updateLocation();
switch (mob.behaviourType) {
switch (mob.BehaviourType) {
case Pet1:
if ((PlayerCharacter) mob.guardCaptain == null)
if (mob.getOwner() == null)
return;
if (!mob.playerAgroMap.containsKey(((PlayerCharacter) mob.guardCaptain).getObjectUUID())) {
if (!mob.playerAgroMap.containsKey(mob.getOwner().getObjectUUID())) {
//mob no longer has its owner loaded, translocate pet to owner
MovementManager.translocate(mob, ((PlayerCharacter) mob.guardCaptain).getLoc(), null);
MovementManager.translocate(mob, mob.getOwner().getLoc(), null);
return;
}
if (mob.getCombatTarget() == null) {
//move back to owner
if (CombatUtilities.inRange2D(mob, (PlayerCharacter) mob.guardCaptain, 6))
if (CombatUtilities.inRange2D(mob, mob.getOwner(), 6))
return;
mob.destination = ((PlayerCharacter) mob.guardCaptain).getLoc();
mob.destination = mob.getOwner().getLoc();
MovementUtilities.moveToLocation(mob, mob.destination, 5);
} else
chaseTarget(mob);
break;
case GuardMinion:
if (!mob.guardCaptain.isAlive() || ((Mob) mob.guardCaptain).despawned)
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
randomGuardPatrolPoint(mob);
else {
if (mob.getCombatTarget() != null) {
@@ -842,6 +829,7 @@ public class MobAI {
chaseTarget(mob);
}
break;
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
@@ -908,8 +896,7 @@ public class MobAI {
if (mob.getCombatTarget() == null)
return;
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false &&
mob.agentType.equals(Enum.AIAgentType.PET) == false) {
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
mob.setCombatTarget(null);
return;
@@ -925,10 +912,10 @@ public class MobAI {
private static void CheckToSendMobHome(Mob mob) {
try {
if (mob.behaviourType.isAgressive) {
if (mob.BehaviourType.isAgressive) {
if (mob.isPlayerGuard()) {
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN))
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal())
CheckForPlayerGuardAggro(mob);
} else {
CheckForAggro(mob);
@@ -948,7 +935,7 @@ public class MobAI {
PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null);
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN) && mob.isAlive()) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
//guard captain pulls his minions home with him
@@ -964,8 +951,8 @@ public class MobAI {
PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null);
for (Integer playerEntry : mob.playerAgroMap.keySet())
mob.playerAgroMap.put(playerEntry,0f);
for (Entry playerEntry : mob.playerAgroMap.entrySet())
PlayerCharacter.getFromCache((int) playerEntry.getKey()).setHateValue(0);
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckToSendMobHome" + " " + e.getMessage());
@@ -1019,17 +1006,17 @@ public class MobAI {
//dont scan self.
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) == true)
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true)
continue;
Mob aggroMob = (Mob) awoMob;
//don't attack other guards
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)))
if ((aggroMob.agentType.equals(Enum.AIAgentType.GUARD)))
continue;
if (aggroMob.agentType.equals(Enum.AIAgentType.PET))
if(aggroMob.BehaviourType.equals(Enum.MobBehaviourType.Pet1))
continue;
if (mob.getLoc().distanceSquared2D(aggroMob.getLoc()) > sqr(50))
@@ -1059,7 +1046,6 @@ public class MobAI {
mob.setCombatTarget(newTarget);
}
CheckMobMovement(mob);
CheckForAttack(mob);
} catch (Exception e) {
@@ -1070,29 +1056,15 @@ public class MobAI {
public static void GuardMinionLogic(Mob mob) {
try {
if (!mob.guardCaptain.isAlive()) {
if (mob.getCombatTarget() == null) {
CheckForPlayerGuardAggro(mob);
} else {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
if (newTarget != null) {
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
mob.setCombatTarget(newTarget);
} else
mob.setCombatTarget(newTarget);
}
}
boolean isComanded = mob.npcOwner.isAlive();
if (!isComanded) {
GuardCaptainLogic(mob);
}else {
if (mob.guardCaptain.getCombatTarget() != null)
mob.setCombatTarget(mob.guardCaptain.getCombatTarget());
else if (mob.getCombatTarget() != null)
mob.setCombatTarget(null);
if (mob.npcOwner.getCombatTarget() != null)
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
else
if (mob.getCombatTarget() != null)
mob.setCombatTarget(null);
}
CheckMobMovement(mob);
CheckForAttack(mob);
@@ -1117,31 +1089,14 @@ public class MobAI {
try {
if (mob.guardCaptain == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (mob.getOwner() == null && mob.isNecroPet() == false && mob.isSiege() == false)
if (ZoneManager.getSeaFloor().zoneMobSet.contains(mob))
mob.killCharacter("no owner");
if (MovementUtilities.canMove(mob) && mob.behaviourType.canRoam)
if (MovementUtilities.canMove(mob) && mob.BehaviourType.canRoam)
CheckMobMovement(mob);
CheckForAttack(mob);
//recover health
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
if (mob.getHealth() < mob.getHealthMax()) {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.getHealth() > mob.getHealthMax())
mob.setHealth(mob.getHealthMax());
}
} catch (Exception e) {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
}
@@ -1172,7 +1127,7 @@ public class MobAI {
if (mob.getCombatTarget() != null && mob.playerAgroMap.containsKey(mob.getCombatTarget().getObjectUUID()) == false)
mob.setCombatTarget(null);
if (mob.behaviourType.isAgressive) {
if (mob.BehaviourType.isAgressive) {
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
@@ -1180,7 +1135,7 @@ public class MobAI {
mob.setCombatTarget(newTarget);
else {
if (mob.getCombatTarget() == null) {
if (mob.behaviourType == Enum.MobBehaviourType.HamletGuard)
if (mob.BehaviourType == Enum.MobBehaviourType.HamletGuard)
SafeGuardAggro(mob); //safehold guard
else
CheckForAggro(mob); //normal aggro
@@ -1190,12 +1145,12 @@ public class MobAI {
//check if mob can move for patrol or moving to target
if (mob.behaviourType.canRoam)
if (mob.BehaviourType.canRoam)
CheckMobMovement(mob);
//check if mob can attack if it isn't wimpy
if (!mob.behaviourType.isWimpy && mob.getCombatTarget() != null)
if (!mob.BehaviourType.isWimpy && mob.getCombatTarget() != null)
CheckForAttack(mob);
} catch (Exception e) {
@@ -1212,7 +1167,7 @@ public class MobAI {
if (!mob.isAlive())
return;
ConcurrentHashMap<Integer, Float> loadedPlayers = mob.playerAgroMap;
ConcurrentHashMap<Integer, Boolean> loadedPlayers = mob.playerAgroMap;
for (Entry playerEntry : loadedPlayers.entrySet()) {
@@ -1260,8 +1215,8 @@ public class MobAI {
if (mob.getGuild().getNation().equals(target.getGuild().getNation()))
return false;
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION)) {
if (((Mob) mob.guardCaptain).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) {
if (((Mob) mob.npcOwner).building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
return true;
}
} else if (mob.building.getCity().cityOutlaws.contains(target.getObjectUUID()) == true) {
@@ -1345,7 +1300,7 @@ public class MobAI {
MovementUtilities.aiMove(mob, mob.destination, true);
if (mob.agentType.equals(Enum.AIAgentType.GUARDCAPTAIN)) {
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal()) {
for (Entry<Mob, Integer> minion : mob.siegeMinionMap.entrySet()) {
//make sure mob is out of combat stance
@@ -1372,7 +1327,7 @@ public class MobAI {
float CurrentHateValue = 0;
if (mob.getCombatTarget() != null && mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter))
CurrentHateValue = mob.playerAgroMap.get(mob.combatTarget.getObjectUUID()).floatValue();
CurrentHateValue = ((PlayerCharacter) mob.getCombatTarget()).getHateValue();
AbstractWorldObject mostHatedTarget = null;
@@ -1383,8 +1338,8 @@ public class MobAI {
if (potentialTarget.equals(mob.getCombatTarget()))
continue;
if (potentialTarget != null && mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
CurrentHateValue = mob.playerAgroMap.get(potentialTarget.getObjectUUID()).floatValue();
if (potentialTarget != null && potentialTarget.getHateValue() > CurrentHateValue && MovementUtilities.inRangeToAggro(mob, potentialTarget)) {
CurrentHateValue = potentialTarget.getHateValue();
mostHatedTarget = potentialTarget;
}
@@ -1395,4 +1350,22 @@ public class MobAI {
}
return null;
}
public static void RecoverHealth(Mob mob){
//recover health
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
if (mob.getHealth() < mob.getHealthMax()) {
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
mob.setHealth(mob.getHealth() + recoveredHealth);
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
if (mob.getHealth() > mob.getHealthMax())
mob.setHealth(mob.getHealthMax());
}
}
}
@@ -48,7 +48,7 @@ public class CombatUtilities {
}
public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) {
return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range;
return entity1.getLoc().distance2D(entity2.getLoc()) < range;
}
public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {
@@ -13,10 +13,10 @@ import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.mobileAI.Threads.MobAIThread;
import engine.exception.MsgSendException;
import engine.gameManager.MovementManager;
import engine.math.Vector3fImmutable;
import engine.mobileAI.Threads.MobAIThread;
import engine.net.client.msg.MoveToPointMsg;
import engine.objects.*;
import org.pmw.tinylog.Logger;
@@ -38,7 +38,7 @@ public class MovementUtilities {
if (agent.getContract() != null)
guardCaptain = agent;
else
guardCaptain = (Mob) agent.guardCaptain;
guardCaptain = (Mob) agent.npcOwner;
if (guardCaptain != null) {
Building barracks = guardCaptain.building;
@@ -8,6 +8,7 @@ import engine.gameManager.BuildingManager;
import engine.gameManager.DbManager;
import engine.gameManager.NPCManager;
import engine.gameManager.SessionManager;
import engine.math.Vector3fImmutable;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.ClientConnection;
@@ -15,6 +16,9 @@ import engine.net.client.msg.*;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashMap;
/*
* @Author:
* @Summary: Processes application protocol message which
@@ -23,6 +27,8 @@ import org.pmw.tinylog.Logger;
public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
public static HashMap<Integer, ArrayList<Integer>> _minionsByCaptain = null;
public MinionTrainingMsgHandler() {
super(MinionTrainingMessage.class);
}
@@ -32,9 +38,9 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
MinionTrainingMessage minionMsg = (MinionTrainingMessage) baseMsg;
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
PlayerCharacter player = SessionManager.getPlayerCharacter(origin);
if (playerCharacter == null)
if (player == null)
return true;
if (minionMsg.getNpcType() == Enum.GameObjectType.NPC.ordinal()) {
@@ -44,24 +50,23 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (npc == null)
return true;
Building building = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
Building b = BuildingManager.getBuildingFromCache(minionMsg.getBuildingID());
if (building == null)
if (b == null)
return true;
//clear minion
if (npc.minionLock.writeLock().tryLock()) {
try {
if (minionMsg.getType() == 2) {
Mob toRemove = Mob.getFromCache(minionMsg.getUUID());
if (!npc.siegeMinionMap.containsKey(toRemove))
if (!npc.getSiegeMinionMap().containsKey(toRemove))
return true;
npc.siegeMinionMap.remove(toRemove);
npc.getSiegeMinionMap().remove(toRemove);
WorldGrid.RemoveWorldObject(toRemove);
@@ -69,35 +74,33 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove);
if(toRemove.guardCaptain.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
// we Found the move to remove, lets break the for loop so it doesnt look for more.
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, b);
mca1.actionType = 3;
mca1.setTargetType(building.getObjectType().ordinal());
mca1.setTargetID(building.getObjectUUID());
mca1.setTargetType(b.getObjectType().ordinal());
mca1.setTargetID(b.getObjectUUID());
mca1.setTargetType3(npc.getObjectType().ordinal());
mca1.setTargetID3(npc.getObjectUUID());
mca1.setAssetName1(building.getName());
mca1.setAssetName1(b.getName());
mca1.setUnknown54(1);
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
Dispatch dispatch = Dispatch.borrow(player, mca1);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
ManageNPCMsg mnm = new ManageNPCMsg(npc);
dispatch = Dispatch.borrow(playerCharacter, mnm);
dispatch = Dispatch.borrow(player, mnm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
//Add Minion
@@ -112,7 +115,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (npc.getContractID() == 842)
maxSlots = 1;
if (npc.siegeMinionMap.size() == maxSlots)
if (npc.getSiegeMinionMap().size() == maxSlots)
return true;
int mobBase;
@@ -143,15 +146,47 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
if (mobBase == 0)
return true;
Mob siegeMob = Mob.createSiegeMinion(npc, mobBase);
Mob siegeMob = Mob.createSiegeMob(npc, mobBase, npc.getGuild(), zone, b.getLoc(), (short) 1);
if (siegeMob == null)
return true;
if (siegeMob != null) {
siegeMob.setSpawnTime(60 * 15);
Building building = BuildingManager.getBuilding(((MinionTrainingMessage) baseMsg).getBuildingID());
siegeMob.building = building;
siegeMob.parentZone = zone;
// Slot siege minion
// Can be either corner tower or bulwark.
int slot;
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.ARTYTOWER))
slot = 2;
else
slot = ((NPC) siegeMob.npcOwner).getSiegeMinionMap().get(siegeMob) + 1; // First slot is for the captain
BuildingLocation slotLocation = BuildingManager._slotLocations.get(building.meshUUID).get(slot);
siegeMob.bindLoc = building.getLoc().add(slotLocation.getLocation());
// Rotate slot position by the building rotation
siegeMob.bindLoc = Vector3fImmutable.rotateAroundPoint(building.getLoc(), siegeMob.bindLoc, building.getBounds().getQuaternion().angleY);
siegeMob.loc = new Vector3fImmutable(siegeMob.bindLoc);
siegeMob.endLoc = new Vector3fImmutable(siegeMob.bindLoc);
zone.zoneMobSet.add(siegeMob);
siegeMob.setLoc(siegeMob.bindLoc);
}
}
ManageNPCMsg mnm = new ManageNPCMsg(npc);
mnm.setMessageType(1);
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
Dispatch dispatch = Dispatch.borrow(player, mnm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
} finally {
@@ -193,22 +228,17 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
toRemove.getParentZone().zoneMobSet.remove(toRemove);
DbManager.removeFromCache(toRemove);
if (toRemove.agentType.equals(Enum.AIAgentType.SIEGEENGINE)) {
PlayerCharacter trebOwner = (PlayerCharacter) toRemove.guardCaptain;
if (trebOwner != null) {
trebOwner.setPet(null);
toRemove.guardCaptain = null;
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(trebOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(playerCharacter, building);
ManageCityAssetsMsg mca1 = new ManageCityAssetsMsg(player, building);
mca1.actionType = 3;
mca1.setTargetType(building.getObjectType().ordinal());
mca1.setTargetID(building.getObjectUUID());
@@ -218,11 +248,11 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
mca1.setAssetName1(building.getName());
mca1.setUnknown54(1);
Dispatch dispatch = Dispatch.borrow(playerCharacter, mca1);
Dispatch dispatch = Dispatch.borrow(player, mca1);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
ManageNPCMsg mnm = new ManageNPCMsg(npc);
dispatch = Dispatch.borrow(playerCharacter, mnm);
dispatch = Dispatch.borrow(player, mnm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
//Add Minion
@@ -268,12 +298,12 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
String pirateName = NPCManager.getPirateName(mobBase);
Mob toCreate = Mob.createGuardMinion(npc, npc.getLevel(), pirateName);
if (toCreate == null)
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
return true;
if (!DbManager.MobQueries.ADD_TO_GUARDS(npc.getObjectUUID(), mobBase, pirateName, npc.getSiegeMinionMap().size() + 1))
Mob toCreate = Mob.createGuardMob(npc, npc.getGuild(), zone, building.getLoc(), npc.getLevel(), pirateName);
if (toCreate == null)
return true;
if (toCreate != null) {
@@ -284,7 +314,7 @@ public class MinionTrainingMsgHandler extends AbstractClientMsgHandler {
ManageNPCMsg mnm = new ManageNPCMsg(npc);
mnm.setMessageType(1);
Dispatch dispatch = Dispatch.borrow(playerCharacter, mnm);
Dispatch dispatch = Dispatch.borrow(player, mnm);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
} catch (Exception e) {
@@ -212,6 +212,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
return;
}
for (AbstractCharacter guard : building.getHirelings().keySet()) {
if (guard.getObjectType() == GameObjectType.Mob)
((Mob) guard).setPatrolPointIndex(0);
}
} else if (building.getPatrolPoints() != null)
ClearPatrolPoints(building.getObjectUUID());
@@ -219,6 +223,10 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
AddSentryPoints(building.getObjectUUID(), orderNpcMsg.getSentryPoints());
} else if (building.getSentryPoints() != null)
ClearSentryPoints(building.getObjectUUID());
// Dispatch dispatch = Dispatch.borrow(pc, msg);
// DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
private static void processUpgradeNPC(PlayerCharacter player, AbstractCharacter abstractCharacter) {
@@ -533,7 +541,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
} else if (orderNPCMsg.getObjectType() == GameObjectType.Mob.ordinal()) {
mob = Mob.getMob(orderNPCMsg.getNpcUUID());
mob = Mob.getFromCacheDBID(orderNPCMsg.getNpcUUID());
if (mob == null)
return true;
@@ -18,8 +18,9 @@ import engine.net.client.Protocol;
import engine.objects.Building;
import engine.objects.Guild;
import engine.server.MBServerStatics;
import org.joda.time.DateTime;
import org.joda.time.Seconds;
import java.time.Instant;
import java.time.Duration;
import java.time.temporal.ChronoField;
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
@@ -27,8 +28,8 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
private Building treeOfLife;
private int currentMineHour;
private Seconds secondsLeft;
private DateTime lateTime;
private Duration secondsLeft;
private Instant lateTime;
private int late;
/**
@@ -73,15 +74,15 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
currentMineHour = guild.getMineTime();
late = MBServerStatics.MINE_LATE_WINDOW;
lateTime = DateTime.now();
lateTime = Instant.now();
if (late == 0)
lateTime = lateTime.plusDays(1);
lateTime = lateTime.plus(Duration.ofDays(1));
lateTime = lateTime.hourOfDay().setCopy(late);
lateTime = lateTime.with(ChronoField.HOUR_OF_DAY, late);
late = ((late > 23) ? (late - 24) : late);
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
secondsLeft = Duration.between(Instant.now(), lateTime);
}
/**
@@ -107,4 +108,4 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
public void setBuildingUUID(int buildingUUID) {
this.buildingUUID = buildingUUID;
}
}
}
+7 -7
View File
@@ -96,7 +96,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putString("A weapon suited to laying siege");
}
private static void serializeGuardList(ByteBufferWriter writer, int minion, Mob captain) {
private static void serializeGuardList(ByteBufferWriter writer, int minion) {
writer.putInt(1);
@@ -106,7 +106,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(minion);
writer.putInt(1);
writer.putInt(minion);
writer.putInt(captain.getRank());//minion rank
writer.putInt(1);
writer.put((byte) 0);
writer.putInt(600); //roll time
@@ -343,7 +343,7 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.putInt(0); //runemaster list
//artillery captain list
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.siegeMinionMap;
ConcurrentHashMap<Mob, Integer> siegeMinions = npc.getSiegeMinionMap();
writer.putInt(1 + siegeMinions.size());
serializeBulwarkList(writer, 1); //Trebuchet
//serializeBulwarkList(writer, 2); //Ballista
@@ -366,7 +366,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) {
if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime);
@@ -557,7 +557,7 @@ public class ManageNPCMsg extends ClientNetMsg {
} else if (this.targetType == GameObjectType.Mob.ordinal()) {
mobA = Mob.getMob(this.targetID);
mobA = Mob.getFromCacheDBID(this.targetID);
if (mobA == null) {
Logger.error("Missing Mob of ID " + this.targetID);
@@ -669,7 +669,7 @@ public class ManageNPCMsg extends ClientNetMsg {
ConcurrentHashMap<Mob, Integer> siegeMinions = mobA.getSiegeMinionMap();
writer.putInt(siegeMinions.size() + 1);
serializeGuardList(writer, mobA.getContract().getContractID(), mobA); //Guard
serializeGuardList(writer, mobA.getContract().getContractID()); //Guard
if (siegeMinions != null && siegeMinions.size() > 0)
@@ -689,7 +689,7 @@ public class ManageNPCMsg extends ClientNetMsg {
long timeLife = upgradeTime - curTime;
if (upgradeTime * 1000 > System.currentTimeMillis()) {
if (mob.guardCaptain.isAlive()) {
if (mob.npcOwner.isAlive()) {
writer.put((byte) 0);//shows respawning timer
writer.putInt(mob.spawnTime);
writer.putInt(mob.spawnTime);
+39 -24
View File
@@ -52,8 +52,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public int contractUUID;
public Contract contract;
public String firstName;
public String lastName;
protected String firstName;
protected String lastName;
protected short statStrCurrent;
protected short statDexCurrent;
protected short statConCurrent;
@@ -88,7 +88,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected AtomicFloat mana = new AtomicFloat();
protected float manaMax; // Health/Mana/Stamina
protected AtomicBoolean isAlive = new AtomicBoolean(true);
public Resists resists = new Resists("Genric");
protected Resists resists = new Resists("Genric");
protected ConcurrentHashMap<String, JobContainer> timers;
protected ConcurrentHashMap<String, Long> timestamps;
protected int atrHandOne;
@@ -117,33 +117,16 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected boolean movingUp = false;
private float desiredAltitude = 0;
private long takeOffTime = 0;
private float hateValue = 0;
private long lastHateUpdate = 0;
private boolean collided = false;
private byte aoecntr = 0;
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public AbstractCharacter() {
super();
this.firstName = "";
this.lastName = "";
this.statStrCurrent = (short) 0;
this.statDexCurrent = (short) 0;
this.statConCurrent = (short) 0;
this.statIntCurrent = (short) 0;
this.statSpiCurrent = (short) 0;
this.unusedStatPoints = (short) 0;
this.level = (short) 0; // TODO get this from MobsBase later
this.exp = 1;
this.walkMode = true;
this.bindLoc = Vector3fImmutable.ZERO;
this.faceDir = Vector3fImmutable.ZERO;
this.runningTrains = (byte) 0;
this.skills = new ConcurrentHashMap<>();
this.powers = new ConcurrentHashMap<>();
this.powers = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.initializeCharacter();
}
@@ -231,6 +214,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.skills = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -273,6 +258,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -304,6 +291,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
/**
@@ -353,6 +342,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.powers = new ConcurrentHashMap<>();
this.initializeCharacter();
// Dangerous to use THIS in a constructor!!!
this.charItemManager = new CharacterItemManager(this);
}
public static int getBankCapacity() {
@@ -1766,6 +1758,29 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.inBuildingID = inBuildingID;
}
public float getHateValue() {
if (this.hateValue <= 0) {
this.hateValue = 0;
return hateValue;
}
if (this.lastHateUpdate == 0) {
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
long duration = System.currentTimeMillis() - this.lastHateUpdate;
//convert duration to seconds and multiply Hate Delimiter.
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
this.hateValue -= modAmount;
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
public void setHateValue(float hateValue) {
this.lastHateUpdate = System.currentTimeMillis();
this.hateValue = hateValue;
}
public int getInFloorID() {
return inFloorID;
}
@@ -9,7 +9,6 @@
package engine.objects;
import ch.claude_martin.enumbitset.EnumBitSet;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
@@ -33,19 +32,6 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
public boolean assist = false;
public Enum.AIAgentType agentType = Enum.AIAgentType.MOBILE;
public AbstractCharacter guardCaptain;
public EnumBitSet<Enum.MonsterType> notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class);
public EnumBitSet<Enum.MonsterType> enemy = EnumBitSet.noneOf(Enum.MonsterType.class);
;
public Enum.MobBehaviourType behaviourType;
public ArrayList<Vector3fImmutable> patrolPoints;
public int lastPatrolPointIndex = 0;
public long stopPatrolTime = 0;
public City guardedCity;
public AbstractIntelligenceAgent() {
super();
}
public AbstractIntelligenceAgent(ResultSet rs) throws SQLException {
super(rs);
@@ -101,8 +87,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
this.agentType = Enum.AIAgentType.CHARMED;
if (this.getObjectType().equals(GameObjectType.Mob)) {
((Mob) this).guardCaptain = owner;
((Mob) this).setOwner(owner);
}
}
@@ -125,6 +110,14 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
return 0;
}
public PlayerCharacter getOwner() {
if (this.getObjectType().equals(GameObjectType.Mob))
return this.getOwner();
return null;
}
public boolean getSafeZone() {
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
@@ -165,7 +158,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
//clear owner
PlayerCharacter owner = (PlayerCharacter) this.guardCaptain;
PlayerCharacter owner = this.getOwner();
//close pet window
@@ -181,7 +174,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
owner.setPet(null);
if (this.getObjectType().equals(GameObjectType.Mob))
((Mob) this).guardCaptain = null;
((Mob) this).setOwner(null);
}
+1 -3
View File
@@ -357,9 +357,7 @@ public abstract class AbstractWorldObject extends AbstractGameObject {
Mob mob = (Mob) this;
if (mob.isSiege()) {
if (mob.isPet()) {
PlayerCharacter petOwner = (PlayerCharacter) mob.guardCaptain;
PlayerCharacter petOwner = mob.getOwner();
if (petOwner != null && source.equals(EffectSourceType.Effect)) {
petOwner.dismissPet();
return;
File diff suppressed because it is too large Load Diff
-3
View File
@@ -27,7 +27,6 @@ public class MobBase extends AbstractGameObject {
private final String firstName;
private final byte level;
private final float scale;
public final ArrayList<MobBaseEffects> effectsList;
public int bootySet;
public Enum.MobBehaviourType fsm;
public EnumBitSet<Enum.MonsterType> notEnemy;
@@ -109,8 +108,6 @@ public class MobBase extends AbstractGameObject {
this.mobBaseStats = DbManager.MobBaseQueries.LOAD_STATS(this.loadID);
DbManager.MobBaseQueries.LOAD_ALL_MOBBASE_SPEEDS(this);
//load effects for mobbase
this.effectsList = DbManager.MobBaseQueries.GET_RUNEBASE_EFFECTS(this.loadID);
}
+11 -7
View File
@@ -50,6 +50,7 @@ public class NPC extends AbstractCharacter {
// Used for thread safety
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
private final ArrayList<MobLoot> rolling = new ArrayList<>();
private final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
public ReentrantReadWriteLock minionLock = new ReentrantReadWriteLock();
public ArrayList<ProducedItem> forgedItems = new ArrayList<>();
public HashMap<Integer, MobEquipment> equip = null;
@@ -85,7 +86,6 @@ public class NPC extends AbstractCharacter {
public NPC() {
super();
this.dbID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
this.currentID = MBServerStatics.NO_DB_ROW_ASSIGNED_YET;
}
@@ -654,14 +654,12 @@ public class NPC extends AbstractCharacter {
WorldGrid.RemoveWorldObject(toRemove);
DbManager.removeFromCache(toRemove);
PlayerCharacter petOwner = (PlayerCharacter) toRemove.guardCaptain;
PlayerCharacter petOwner = toRemove.getOwner();
if (petOwner != null) {
petOwner.setPet(null);
toRemove.guardCaptain = null;
toRemove.setOwner(null);
PetMsg petMsg = new PetMsg(5, null);
Dispatch dispatch = Dispatch.borrow(petOwner, petMsg);
@@ -807,8 +805,6 @@ public class NPC extends AbstractCharacter {
@Override
public void runAfterLoad() {
this.charItemManager = new CharacterItemManager(this);
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
return;
@@ -850,6 +846,10 @@ public class NPC extends AbstractCharacter {
if (wordCount(this.name) < 2 && this.contract != null)
this.name += " the " + this.contract.getName();
// Initialize inventory
this.charItemManager = new CharacterItemManager(this);
// Configure parent zone adding this NPC to the
// zone collection
@@ -1103,6 +1103,10 @@ public class NPC extends AbstractCharacter {
return (int) time;
}
public ConcurrentHashMap<Mob, Integer> getSiegeMinionMap() {
return siegeMinionMap;
}
public boolean remove() {
Building building;
+10 -9
View File
@@ -144,6 +144,7 @@ public class PlayerCharacter extends AbstractCharacter {
private long lastUpdateTime = System.currentTimeMillis();
private long lastStamUpdateTime = System.currentTimeMillis();
private boolean safeZone = false;
private int bindBuildingID;
/*
DataWarehouse based kill/death tracking.
@@ -204,18 +205,15 @@ public class PlayerCharacter extends AbstractCharacter {
this.spiMod.set(spiMod);
this.guildStatus = new AtomicInteger(0);
this.buildingUUID = -1;
this.bindBuildingID = -1;
}
/**
* ResultSet Constructor
*/
public PlayerCharacter(ResultSet rs) throws SQLException {
super(rs, true);
this.charItemManager = new CharacterItemManager(this);
this.runes = DbManager.CharacterRuneQueries.GET_RUNES_FOR_CHARACTER(this.getObjectUUID());
int accountID = rs.getInt("parent");
this.account = DbManager.AccountQueries.GET_ACCOUNT(accountID);
@@ -267,7 +265,7 @@ public class PlayerCharacter extends AbstractCharacter {
this.intMod.set(rs.getShort("char_intMod"));
this.spiMod.set(rs.getShort("char_spiMod"));
this.buildingUUID = rs.getInt("char_bindBuilding");
this.bindBuildingID = rs.getInt("char_bindBuilding");
this.hash = rs.getString("hash");
@@ -2723,12 +2721,12 @@ public class PlayerCharacter extends AbstractCharacter {
*/
public synchronized int getBindBuildingID() {
return this.buildingUUID;
return this.bindBuildingID;
}
public synchronized void setBindBuildingID(int value) {
DbManager.PlayerCharacterQueries.SET_BIND_BUILDING(this, value);
this.buildingUUID = value;
this.bindBuildingID = value;
}
public AbstractGameObject getLastTarget() {
@@ -4563,6 +4561,10 @@ public class PlayerCharacter extends AbstractCharacter {
@Override
public void runAfterLoad() {
// Init inventory
this.charItemManager = new CharacterItemManager(this);
Bounds playerBounds = Bounds.borrow();
playerBounds.setBounds(this.getLoc());
this.setBounds(playerBounds);
@@ -4690,8 +4692,7 @@ public class PlayerCharacter extends AbstractCharacter {
} else if (currentPet.isSiege()) {
currentPet.agentType = AIAgentType.MOBILE;
currentPet.guardCaptain = null;
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
if (currentPet.isAlive())
WorldGrid.updateObject(currentPet);
@@ -11,7 +11,6 @@ package engine.powers.poweractions;
import engine.Enum.GameObjectType;
import engine.Enum.ModType;
import engine.Enum.SourceType;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.ChatManager;
import engine.jobs.ChantJob;
import engine.jobs.DeferredPowerJob;
@@ -23,7 +22,6 @@ import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowersBase;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
@@ -119,12 +117,20 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
awo.addEffect(stackType, duration, eff, effect, trains);
} else
awo.applyAllBonuses();
// //TODO if chant, start cycle
// if (pb.isChant() && source.equals(awo)) {
// ChantJob cj = new ChantJob(source, awo, stackType, trains, ab, pb, effect, eff);
// source.setLastChant((int)(pb.getChantDuration()-2) * 1000, cj);
// eff.setChant(true);
// }
if (this.effectID.equals("TAUNT")) {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
((Mob) awo).setCombatTarget(source);
ChatSystemMsg msg = ChatManager.CombatInfo(source, awo);
DispatchMessage.sendToAllInRange(source, msg);
((Mob)awo).refresh();
}
}
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
@@ -134,21 +140,7 @@ public class ApplyEffectPowerAction extends AbstractPowerAction {
}
this.effect.startEffect(source, awo, trains, eff);
}
//apply effects to mobs within range for chants
if(pb.isChant){
for(AbstractGameObject ago : WorldGrid.getObjectsInRangePartial(awo.loc,pb.range, MBServerStatics.MASK_MOB)){
Mob mob = (Mob)ago;
if(mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
}
}else {
if (awo != null && awo.getObjectType() == GameObjectType.Mob) {
Mob mob = (Mob) awo;
if (mob.playerAgroMap.containsKey(source.getObjectUUID()))
mob.playerAgroMap.put(source.getObjectUUID(), mob.playerAgroMap.get(source.getObjectUUID()).floatValue() + pb.hateValue);
}
}
}
protected void _applyEffectForItem(Item item, int trains) {
@@ -12,6 +12,7 @@ package engine.powers.poweractions;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.gameManager.DbManager;
import engine.gameManager.MovementManager;
import engine.gameManager.NPCManager;
import engine.gameManager.ZoneManager;
import engine.math.Vector3fImmutable;
@@ -74,7 +75,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
return;
//create Pet
Mob pet = Mob.createPetMinion(mobID, seaFloor, owner, (short) mobLevel);
Mob pet = Mob.createPet(mobID, guild, seaFloor, owner, (short) mobLevel);
if (pet.getMobBaseID() == 12021 || pet.getMobBaseID() == 12022) { //is a necro pet
@@ -83,6 +84,8 @@ public class CreateMobPowerAction extends AbstractPowerAction {
WorldGrid.RemoveWorldObject(currentPet);
currentPet.setCombatTarget(null);
//if (currentPet.getParentZone() != null)
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
seaFloor.zoneMobSet.remove(currentPet);
currentPet.playerAgroMap.clear();
@@ -92,10 +95,10 @@ public class CreateMobPowerAction extends AbstractPowerAction {
Logger.error(e.getMessage());
}
//currentPet.disableIntelligence();
} else if (currentPet != null && currentPet.isSiege()) {
currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.guardCaptain = null;
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
if (currentPet.isAlive())
@@ -103,6 +106,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
}
//remove 10th pet
NPCManager.spawnNecroPet(owner, pet);
} else { //is not a necro pet
@@ -111,7 +115,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
DbManager.removeFromCache(currentPet);
currentPet.setCombatTarget(null);
currentPet.guardCaptain = null;
currentPet.setOwner(null);
WorldGrid.RemoveWorldObject(currentPet);
//currentPet.getParentZone().zoneMobSet.remove(currentPet);
seaFloor.zoneMobSet.remove(currentPet);
@@ -121,8 +125,7 @@ public class CreateMobPowerAction extends AbstractPowerAction {
} else {
if (currentPet.isSiege()) {
currentPet.agentType = Enum.AIAgentType.MOBILE;
currentPet.guardCaptain = null;
currentPet.setOwner(null);
currentPet.setCombatTarget(null);
if (currentPet.isAlive())
@@ -134,9 +137,26 @@ public class CreateMobPowerAction extends AbstractPowerAction {
NPCManager.resetNecroPets(owner);
}
}
/* if(owner.getPet() != null) {
if(owner.getPet().getMobBaseID() != 12021 && owner.getPet().getMobBaseID() != 12022) {
//if not a necro pet, remove pet
WorldGrid.removeWorldObject(owner.getPet());
owner.getPet().disableIntelligence();
Mob.removePet(owner.getPet().getUUID());
owner.setPet(null);
}
else {
//if it is a necro pet, add it to the line and set as mob
owner.getPet().setMob();
}
}*/
// if (mobID == 12021 || mobID == 12022) //Necro Pets
// pet.setPet(owner, true);
owner.setPet(pet);
if(pet.isSiege() == false) {
MovementManager.translocate(pet, owner.getLoc(), owner.region);
}
pet.recalculateStats();
pet.healthMax = pet.level * 0.5f * 120;
pet.setHealth(pet.healthMax);
@@ -59,7 +59,7 @@ public class FearPowerAction extends AbstractPowerAction {
int duration = 10 + ((int) (trains * 0.5));
String stackType = ab.getStackType();
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
((Mob) awo).fearedObject = source;
((Mob) awo).setFearedObject(source);
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
}
+42 -41
View File
@@ -10,6 +10,7 @@
package engine.server.world;
import engine.Enum;
import engine.Enum.BuildingGroup;
import engine.Enum.DispatchChannel;
import engine.Enum.MinionType;
import engine.Enum.SupportMsgType;
@@ -17,7 +18,6 @@ import engine.InterestManagement.HeightMap;
import engine.InterestManagement.RealmMap;
import engine.InterestManagement.WorldGrid;
import engine.db.archive.DataWarehouse;
import engine.db.handlers.dbPowerHandler;
import engine.exception.MsgSendException;
import engine.gameManager.*;
import engine.job.JobContainer;
@@ -334,7 +334,7 @@ public class WorldServer {
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
Logger.info("Loading NPC and Mob Rune Sets");
NPCManager._runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
NPCManager.LoadAllRuneSets();
Logger.info("Loading Booty Sets");
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
@@ -352,7 +352,7 @@ public class WorldServer {
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
Logger.info("Loading Mob Powers");
PowersManager._allMobPowers = dbPowerHandler.LOAD_MOB_POWERS();
PowersManager.AllMobPowers = DbManager.PowerQueries.LOAD_MOB_POWERS();
Logger.info("Loading item enchants");
DbManager.LootQueries.LOAD_ENCHANT_VALUES();
@@ -482,7 +482,7 @@ public class WorldServer {
Logger.info("Initializing Client Connection Manager");
initClientConnectionManager();
//intiate mob respawn thread
Logger.info("Starting Mob Respawn Thread");
MobRespawnThread.startRespawnThread();
@@ -551,40 +551,44 @@ public class WorldServer {
}
//Set sea floor object for server
Zone seaFloor = rootParent.get(0);
seaFloor.setParent(null);
ZoneManager.setSeaFloor(seaFloor);
// zoneManager.addZone(seaFloor.getLoadNum(), seaFloor); <- DIE IN A FUCKING CAR FIRE BONUS CODE LIKE THIS SUCKS FUCKING DICK
rootParent.addAll(DbManager.ZoneQueries.GET_ALL_NODES(seaFloor));
long start = System.currentTimeMillis();
for (Zone zone : rootParent) {
ZoneManager.addZone(zone.getLoadNum(), zone);
zone.generateWorldAltitude();
try {
ZoneManager.addZone(zone.getLoadNum(), zone);
try {
zone.generateWorldAltitude();
} catch (Exception e) {
Logger.error(e.getMessage());
e.printStackTrace();
}
//Handle Buildings
//Handle Buildings
try {
ArrayList<Building> bList;
bList = DbManager.BuildingQueries.GET_ALL_BUILDINGS_FOR_ZONE(zone);
for (Building b : bList) {
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
b.setLoc(b.getLoc());
try {
b.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
b.setLoc(b.getLoc());
} catch (Exception e) {
Logger.error(b.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
}
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle Mobs
try {
//Handle Mobs
ArrayList<Mob> mobs;
mobs = DbManager.MobQueries.GET_ALL_MOBS_FOR_ZONE(zone);
@@ -592,22 +596,15 @@ public class WorldServer {
m.setObjectTypeMask(MBServerStatics.MASK_MOB | m.getTypeMasks());
m.setLoc(m.getLoc());
// Load Minions for Guard Captains here.
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.BARRACK)
DbManager.MobQueries.LOAD_GUARD_MINIONS(m);
//ADD GUARDS HERE.
if (m.building != null && m.building.getBlueprint() != null && m.building.getBlueprint().getBuildingGroup() == BuildingGroup.BARRACK)
DbManager.MobQueries.LOAD_PATROL_POINTS(m);
}
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle NPCs
try {
//Handle npc's
ArrayList<NPC> npcs;
// Ignore NPCs on the seafloor (npc guild leaders, etc)
// Ignore npc's on the seafloor (npc guild leaders, etc)
if (zone.equals(seaFloor))
continue;
@@ -615,22 +612,26 @@ public class WorldServer {
npcs = DbManager.NPCQueries.GET_ALL_NPCS_FOR_ZONE(zone);
for (NPC n : npcs) {
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
n.setLoc(n.getLoc());
try {
n.setObjectTypeMask(MBServerStatics.MASK_NPC);
n.setLoc(n.getLoc());
} catch (Exception e) {
Logger.error(n.getObjectUUID() + " returned an Error Message :" + e.getMessage());
}
}
} catch (Exception e) {
Logger.error(e);
e.printStackTrace();
}
//Handle cities
//Handle cities
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone);
} catch (Exception e) {
Logger.info(e.getMessage() + zone.getName() + ' ' + zone.getObjectUUID());
}
}
Logger.info("time to load World Objects: " + (System.currentTimeMillis() - start) + " ms");
Logger.info("time to load: " + (System.currentTimeMillis() - start) + " ms");
}
/**
@@ -703,7 +704,7 @@ public class WorldServer {
return;
}
//remove player from loaded mobs agro maps
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(), MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_MOB)) {
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(player.getLoc(),MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_MOB)) {
Mob loadedMob = (Mob) awo;
loadedMob.playerAgroMap.remove(player.getObjectUUID());
}