
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`.
49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Function: forge_client_org_fnc_addAsset
|
|
* Author: J. Schmidt
|
|
*
|
|
* Description:
|
|
* Adds an asset to an organization's inventory
|
|
*
|
|
* Arguments:
|
|
* 0: _uid - Player UID <STRING>
|
|
* 1: _name - Organization name <STRING>
|
|
* 2: _assetType - Type of asset (vehicle, building, etc.) <STRING>
|
|
* 3: _assetData - Asset data <HASHMAP>
|
|
*
|
|
* Return Value:
|
|
* Updated assets collection <HASHMAP>
|
|
*/
|
|
|
|
params [["_uid", "", [""]], ["_name", "", [""]], ["_assetType", "", [""]], ["_assetData", createHashMap, [createHashMap]]];
|
|
|
|
if (_uid == "" || _name == "" || _assetType == "") exitWith { TRACE_3("Invalid parameters for adding asset",_uid,_name,_assetType); nil };
|
|
|
|
private _store = call FUNC(verifyOrgStore);
|
|
private _key = format ["%1_%2", _uid, _name];
|
|
private _org = _store call ["getByKey", [_key]];
|
|
|
|
private _timestamp = systemTimeUTC apply { if (_x < 10) then { "0" + str _x } else { str _x }};
|
|
private _dateTime = format ["%1-%2-%3_%4:%5:%6.%7", _timestamp#0, _timestamp#1, _timestamp#2, _timestamp#3, _timestamp#4, _timestamp#5, _timestamp#6];
|
|
|
|
if (isNil "_org") exitWith { TRACE_1("Organization not found",_key); nil };
|
|
|
|
private _assets = _org get "assets";
|
|
private _logs = _org get "logs";
|
|
private _owner = _org get "owner";
|
|
|
|
if (isNil { _assets get _assetType }) then { _assets set [_assetType, []]; };
|
|
|
|
private _typeAssets = _assets get _assetType;
|
|
|
|
_typeAssets pushBack _assetData;
|
|
_org set ["assets", _assets];
|
|
|
|
_logs pushBack [_dateTime, "ASSET_ADDED", _assetType, _assetData];
|
|
_org set ["logs", _logs];
|
|
|
|
_store call ["post", [_owner, _name]];
|
|
|
|
_assets |