
All checks were successful
Build / Build (push) Successful in 27s
This commit refactors the organization store to utilize the new CRUD (Create, Read, Update, Delete) operations and simplifies several organization-related functions. * **Organization Store CRUD Operations:** Implements a new interface for the organization store, providing methods for creating, reading, updating, and deleting organization data. This includes methods for adding and removing assets, managing funds and reputation, and handling member operations. The store now interfaces with the ArmaDragonflyClient database for persistence. * **Function Simplification:** Simplifies several organization functions by leveraging the new CRUD operations within the organization store. This reduces code duplication and improves readability. Specifically: * `fnc_addAsset.sqf`: Simplified to use the `addAsset` method. * `fnc_removeAsset.sqf`: Simplified to use the `removeAsset` method. * `fnc_create.sqf`: Simplified to use the `createOrg` method. * `fnc_leave.sqf`: Simplified to use the `leaveOrg` method. * `fnc_disband.sqf`: Simplified to use the `deleteOrg` method. * `fnc_addFunds.sqf`: Simplified to use the `updateFunds` method. * `fnc_addReputation.sqf`: Simplified to use the `updateReputation` method. * `fnc_verifyOrgStore.sqf`: Improved to ensure the store is initialized. * **XEH Updates:** Updated `XEH_PREP.hpp` files to reflect the changes in function calls. * **Locker Fix:** Fixed an issue in `fnc_equipGear.sqf` where the `isNull` check was incorrect for certain gear types.
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Function: forge_client_org_fnc_create
|
|
* Author: J. Schmidt
|
|
*
|
|
* Description:
|
|
* Creates a new organization for a player
|
|
*
|
|
* Arguments:
|
|
* 0: _ownerUID - Player UID <STRING>
|
|
* 1: _ownerName - Player name <STRING> (unused, gets name from player object)
|
|
* 2: _name - Organization name <STRING>
|
|
* 3: _initialFunds - Initial funds for the org <NUMBER> (Optional, default: 0)
|
|
* 4: _initialReputation - Initial reputation for the org <NUMBER> (Optional, default: 0)
|
|
*
|
|
* Return Value:
|
|
* Organization data <HASHMAP> or nil on failure
|
|
*/
|
|
|
|
params [
|
|
["_ownerUID", "", [""]],
|
|
["_name", "", [""]],
|
|
["_initialFunds", 0, [0]],
|
|
["_initialReputation", 0, [0]]
|
|
];
|
|
|
|
if (_ownerUID == "" || _name == "") exitWith {
|
|
TRACE_2("Invalid parameters for organization creation",_ownerUID,_name);
|
|
nil
|
|
};
|
|
|
|
private _store = call FUNC(verifyOrgStore);
|
|
|
|
// The createOrg method in the store already handles:
|
|
// - Checking if player already has an organization
|
|
// - Creating the organization with basic data
|
|
// - Adding the owner as a member
|
|
// - Saving to database
|
|
private _orgData = _store call ["createOrg", [_ownerUID, _name, _initialFunds, _initialReputation]];
|
|
|
|
if (isNil "_orgData") then {
|
|
TRACE_2("Failed to create organization",_name,_ownerUID);
|
|
} else {
|
|
TRACE_2("Organization created successfully",_name,_ownerUID);
|
|
};
|
|
|
|
// Return the organization data
|
|
_orgData |