client/addons/store/functions/fnc_buyItem.sqf
Jacob Schmidt 613f05d52a Refactor: Database and Client Updates
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`.
2025-03-28 09:46:24 -05:00

35 lines
1.4 KiB
Plaintext

#include "..\script_component.hpp"
params ["_className", "_price", "_configType", "_itemType"];
private _displayName = "";
// private _locker = player getVariable ["FORGE_Locker", []];
private _locker = GETVAR(player,FORGE_Locker,[]);
if !([_price] call FUNC(handlePurchase)) exitWith {};
switch (_configType) do {
case "item": {
_displayName = getText (configFile >> "CfgWeapons" >> _className >> "displayName");
_locker pushBack [_itemType, _className];
};
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];
};
};
// player setVariable ["FORGE_Locker", _locker, true];
SETPVAR(player,FORGE_Locker,_locker);
[_className, _itemType] call EFUNC(arsenal,addArmoryItem);
[format ["You have purchased %1 for $%2.", _displayName, _price], "info", 3, "right"] call EFUNC(misc,notify);