
This commit introduces significant updates to the admin and bank systems, focusing on improved event handling and user interface enhancements. Key changes include: - Refactored event handling for player data requests, paygrade updates, and message broadcasting in the admin panel. - Implemented new event types for handling player funds and transaction history in the bank system. - Updated JavaScript functions for better interaction with the web-based UI, including dynamic data requests and improved user feedback. - Removed deprecated functions and streamlined code for better maintainability. These enhancements aim to provide a more efficient and user-friendly experience for administrators and players alike.
48 lines
1.8 KiB
Plaintext
48 lines
1.8 KiB
Plaintext
#include "script_component.hpp"
|
|
|
|
[QGVAR(handleEvents), {
|
|
params ["_control", "_isConfirmDialog", "_message"];
|
|
|
|
diag_log text format ["[FORGE::Client::Garage::XEH_postInit] Received event: '%1'", _message];
|
|
|
|
_message = fromJSON _message;
|
|
private _event = _message get "event";
|
|
private _data = _message get "data";
|
|
|
|
private _vehicles = GETVAR(player,FORGE_Garage,[]); //TODO: Implement garage from server
|
|
|
|
switch (_event) do {
|
|
case "REQUEST::GARAGE::DATA": {
|
|
private _garageData = createHashMap;
|
|
private _vehicleList = [];
|
|
|
|
{
|
|
private _vehicle = _x;
|
|
if (isNull _vehicle || { !alive _vehicle }) exitWith {};
|
|
|
|
private _vehicleInfo = createHashMapFromArray [
|
|
["classname", typeOf _vehicle],
|
|
["damage", damage _vehicle],
|
|
["fuel", fuel _vehicle],
|
|
["hitpoints", getAllHitPointsDamage _vehicle]
|
|
];
|
|
|
|
_vehicleList pushBack _vehicleInfo;
|
|
} forEach _vehicles;
|
|
|
|
_garageData set ["vehicles", _vehicleList];
|
|
_control ctrlWebBrowserAction ["ExecJS", format ["handleGarageDataRequest(%1)", (toJSON _vehicleList)]];
|
|
};
|
|
case "STORE::VEHICLE": {
|
|
// Logic to store vehicle in garage
|
|
// This would typically involve saving the vehicle's state to a database or similar
|
|
};
|
|
case "RETRIEVE::VEHICLE": {
|
|
// Logic to retrieve vehicle from garage
|
|
// This would typically involve loading the vehicle's state from a database or similar
|
|
};
|
|
default {
|
|
diag_log text format ["[FORGE::Client::Garage::XEH_postInit] Unknown event: '%1'", _event];
|
|
};
|
|
};
|
|
}] call CFUNC(addEventHandler); |