2.8 KiB
2.8 KiB
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
- 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
SELECT * FROM `obj_account` WHERE `UID`=?
File: dbAccountHandler.java, Line ~60
Get Account by Username
SELECT * FROM `obj_account` WHERE `username`=?
File: dbAccountHandler.java, Line ~85
Create New Account
INSERT INTO `obj_account` (`username`, `password`, `email`, `accountStatus`, `creationDate`) VALUES (?, ?, ?, ?, ?)
File: dbAccountHandler.java, Line ~105
Update Account Status
UPDATE `obj_account` SET `accountStatus`=?, `lastLogin`=? WHERE `UID`=?
File: dbAccountHandler.java, Line ~132
Check Username Availability
SELECT `username` FROM `obj_account` WHERE `username`=?
File: dbAccountHandler.java, Line ~158
Relationships
- Account to Character: One-to-many (via
obj_character.accountIDfield) - Account to Account Wipe History: One-to-many (via
obj_account_wipe.AccountID) - 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 |