client/addons/db/functions/fnc_requestServerDB.sqf
Jacob Schmidt 613f05d52a Refactor: Database and Client Updates
This commit introduces several changes related to database interactions and client-side functionality:

*   **Database Response Handling:** Implements a mechanism to handle responses from server requests, specifically for database operations. This includes setting up a callback system to process results based on request IDs.
*   **Store Functionality:** Corrects a typo in the `fnc_buyItem.sqf` script, changing `EFUNC(armory,addArmoryItem)` to `EFUNC(arsenal,addArmoryItem)`.
*   **Inventory Management:** Improves the `fnc_moveInventory.sqf` script by correcting a conditional statement to ensure proper handling of inventory items.
*   **Configuration Updates:** Updates the mod configuration (`CfgMods.hpp`) to use the correct path for the mod picture.
*   **Client Initialization:** Adds a client registration call to the server during client post-initialization (`XEH_postInit_client.sqf`).
*   **Workflow Update:** Updates the build workflow to use the latest Ubuntu runner.
*   **Database Preparation:** Removes unnecessary preparations from `XEH_postInit.sqf` and `XEH_PREP.hpp`.
2025-03-28 09:46:24 -05:00

35 lines
857 B
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_client_db_fnc_requestServerDB
* Author: J. Schmidt
*
* Description:
* Sends database requests to the server using CBA events
*
* Arguments:
* 0: _type - Type of database operation <STRING>
* 1: _data - Data for the operation <ANY>
* 2: _callback - Function to call when data is returned <CODE>
*
* Return Value:
* Request ID <STRING>
*/
params [
["_type", "", [""]],
["_data", nil, [createHashMap, [], "", 0, true, objNull]],
["_callback", {}, [{}]]
];
private _requestID = format ["%1_%2", diag_tickTime, random 1000];
if (isNil QGVAR(pendingCallbacks)) then {
GVAR(pendingCallbacks) = createHashMap;
};
GVAR(pendingCallbacks) set [_requestID, _callback];
["forge_db_request", [getPlayerUID player, _type, _data, _requestID]] call CBA_fnc_serverEvent;
_requestID