
All checks were successful
Build / Build (push) Successful in 28s
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.
49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Purchases an item and adds it to the player's locker
|
|
*
|
|
* Arguments:
|
|
* 0: Class Name <STRING> - The classname of the item to purchase
|
|
* 1: Price <NUMBER> - The price of the item
|
|
* 2: Config Type <STRING> - The type of config ("item", "weapon", "magazine", "backpack")
|
|
* 3: Item Type <STRING> - The type of item for locker storage ("backpack", "facewear", "headgear", "hmd", "item", "magazine", "uniform", "vest", "weapon")
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* ["arifle_MX_F", 1000, "weapon", "weapon"] call forge_store_fnc_buyItem
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_className", "_price", "_configType", "_itemType"];
|
|
|
|
private _displayName = "";
|
|
private _locker = GETVAR(player,FORGE_Locker,[]);
|
|
|
|
if !([_price] call FUNC(handlePurchase)) exitWith {};
|
|
|
|
switch (_configType) do {
|
|
case "item";
|
|
case "weapon": {
|
|
_displayName = getText (configFile >> "CfgWeapons" >> _className >> "displayName");
|
|
_locker pushBack [_itemType, _className];
|
|
};
|
|
case "magazine": {
|
|
_displayName = getText (configFile >> "CfgMagazines" >> _className >> "displayName");
|
|
_locker pushBack [_itemType, [_className, getNumber (configFile >> "CfgMagazines" >> _className >> "count"), getNumber (configFile >> "CfgMagazines" >> _className >> "count")]];
|
|
};
|
|
case "backpack": {
|
|
_displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
|
|
_locker pushBack [_itemType, _className];
|
|
};
|
|
};
|
|
|
|
[_locker] spawn FUNC(handleDelivery);
|
|
|
|
[_className, _itemType] call EFUNC(arsenal,addArmoryItem);
|
|
|
|
[format ["You have purchased %1 for $%2.", _displayName, _price], "info", 3, "right"] call EFUNC(misc,notify); |