client/addons/org/functions/fnc_verifyOrgStore.sqf
Jacob Schmidt c87deec60b
All checks were successful
Build / Build (push) Successful in 26s
Refactor: Organization Funds, Reputation, Tasks, and Player Saving
This commit refactors how organization funds and reputation are handled, updates task completion logic to use the new organization functions, and modifies player saving to include organization data. Additionally, it introduces string serialization/deserialization and fixes a player save loop.

*   **Organization Funds and Reputation:** Replaces direct server calls for handling funds and reputation with calls to the new organization functions (`EFUNC(org,addFunds)` and `EFUNC(org,addReputation)`). This centralizes fund and reputation management within the organization store.
*   **Task Completion Logic:** Updates task completion functions (`fnc_destroy.sqf`, `fnc_attack.sqf`, `fnc_hostage.sqf`, `fnc_hvt.sqf`, `fnc_defuse.sqf`) to use the new organization functions for adding funds and reputation upon task success or failure. Also adds notifications to inform the player of reputation and fund changes.
*   **Player Saving:** Modifies the player saving function (`fnc_playerDBSave.sqf`) to include the player's organization ID in the saved data.
*   **String Serialization/Deserialization:** Adds `serializeString` and `deserializeString` PREP macros to `XEH_PREP.hpp` and uses them in `fnc_handleOrgLoad.sqf` and `fnc_create.sqf` to handle special characters in organization and member names.
*   **Player Save Loop Fix:** Removes unnecessary brackets from the `call FUNC(playerDBSave)` in `fnc_playerSaveLoop.sqf`.
*   **Organization Purchase Verification:** Adds organization ownership verification to `fnc_handlePurchase.sqf` to ensure only the owner can make purchases using organization funds.
*   **Player Initialization:** Updates `fnc_initPlayer.sqf` to retrieve and set the player's organization upon initialization.
2025-04-05 14:16:24 -05:00

34 lines
951 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: J. Schmidt
* Ensures the organization store is initialized and returns the store object.
* Acts as a singleton accessor for the organization store interface.
* If the store doesn't exist yet, it initializes it first.
*
* Arguments:
* None
*
* Return Value:
* Organization Store <OBJECT> - The organization store interface object
*
* Example:
* private _orgStore = call forge_client_org_fnc_verifyOrgStore
*
* Public: No
*/
// Attempt to retrieve the existing organization store from the global variable
private _store = GETMVAR(FORGE_ORG_STORE_REG,nil);
// If the store doesn't exist yet, initialize it
if (isNil "_store") then {
// Create a new organization store
_store = call FUNC(initOrgStore);
// Log the initialization for debugging
diag_log text "[FORGE Organization] Organization store initialized";
};
// Return the organization store interface
_store