client/addons/db/README.md
Jacob Schmidt 9936d6ddc3
All checks were successful
Build / Build (push) Successful in 28s
feat: Enhance module documentation and features
This commit updates the documentation for several Forge modules, adding comprehensive details about their functionalities, user interfaces, and integration with other systems. Key enhancements include:

- Expanded descriptions for the Admin, Arsenal, Bank, Garage, Interaction, Locker, Medical, Organization, Service, Store, and other modules.
- Added new features such as financial operations, user interface improvements, and integration with organization systems.
- Improved clarity on usage instructions and configuration options across modules.

These changes aim to provide better guidance for users and developers interacting with the Forge client system.
2025-05-25 16:03:03 -05:00

125 lines
3.3 KiB
Markdown

# Forge Database Module
## Overview
The Database module provides a comprehensive data persistence system for the Forge client. It includes features for managing player data, organization information, and game state persistence using the ArmaDragonflyClient database system.
## Dependencies
- forge_client_main
- ArmaDragonflyClient
## Authors
- J. Schmidt
- Creedcoder
- IDSolutions
## Features
### Database System
1. **Server Communication** (`fnc_requestServerDB.sqf`)
- Handles client-server database communication
- Manages asynchronous database operations
- Provides callback support for data retrieval
- Ensures data consistency across clients
2. **Data Management**
- **Player Data**
- Armory unlocks
- Garage unlocks
- Locker contents
- Vehicle inventory
- Financial information
- Contact details
- Organization membership
- Player statistics
- Equipment loadouts
- Position and state
- **Organization Data**
- Member information
- Asset tracking
- Financial records
- Reputation system
- Activity logs
- Creation timestamps
- Modification history
3. **Persistence Features**
- Automatic data saving
- Periodic state synchronization
- Data validation and sanitization
- Error recovery mechanisms
- Transaction logging
- Data versioning
### Data Operations
1. **Storage Operations**
- Hash-based storage (HSET)
- Bulk data operations
- Atomic transactions
- Data serialization
- String normalization
2. **Retrieval Operations**
- Hash-based retrieval (HGET)
- Bulk data loading
- Data deserialization
- Error handling
- Default value management
3. **Synchronization**
- Client-server sync
- Real-time updates
- Conflict resolution
- State verification
- Data integrity checks
## Event Handlers
The module uses several event handlers for initialization and execution:
- `XEH_preInit.sqf`: Pre-initialization setup
- `XEH_postInit.sqf`: Post-initialization tasks
- `XEH_preStart.sqf`: Pre-start configuration
- `XEH_postInit_client.sqf`: Client-specific post-initialization
- `XEH_preInit_server.sqf`: Server-specific pre-initialization
## Usage
To use the database module:
1. Ensure the module is properly loaded in your mission
2. Initialize database connections
3. Perform database operations:
```sqf
// Request data from server
["hgetall", "Hello World!", {
systemChat format ["Message: %1", _this];
}] call forge_db_fnc_requestServerDB;
// Save player data
[] call forge_client_init_fnc_playerDBSave;
// Load player data
[] call forge_client_init_fnc_playerDBLoad;
```
4. Handle database callbacks and responses
## Debugging
Debug mode can be enabled by uncommenting the following in `script_component.hpp`:
```cpp
#define DEBUG_MODE_FULL
```
## Version Information
Version information is managed through the main Forge client system configuration.
## Technical Details
- Asynchronous database operations
- Callback-based response handling
- Data serialization and normalization
- Error handling and recovery
- Transaction logging
- State management
- Data validation
- Conflict resolution
- Real-time synchronization
- Bulk operation support
- Atomic transactions
- Data versioning
- Integrity verification