client/addons/org/functions/fnc_addReputation.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

39 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Adds or removes reputation from an organization
*
* Arguments:
* 0: Amount <NUMBER> - Amount of reputation to add (positive) or subtract (negative)
*
* Return Value:
* Success <BOOLEAN> - True if reputation was updated successfully, false otherwise
*
* Example:
* [10] call forge_client_org_fnc_addReputation // Add 10 reputation
* [-5] call forge_client_org_fnc_addReputation // Remove 5 reputation
*
* Public: Yes
*/
params [["_amount", 0, [0]]];
// Get the organization store interface
private _store = call FUNC(verifyOrgStore);
// Update the organization's reputation
private _result = _store call ["updateReputation", [_amount]];
// Provide feedback based on success or failure
if (_result) then {
// Format a user-friendly message based on whether we're adding or subtracting
private _actionText = ["decreased", "increased"] select (_amount > 0);
private _absAmount = abs _amount;
[format ["Organization reputation %1 by %2 points", _actionText, _absAmount], "info", 5, "right"] call forge_client_misc_fnc_notify;
} else {
["Failed to update organization reputation", "error", 5, "right"] call forge_client_misc_fnc_notify;
};
// Return the result for further operations
_result