
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.
203 lines
7.9 KiB
Plaintext
203 lines
7.9 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
private _display = findDisplay IDD_LOCKERDIALOG;
|
|
private _playerItems = _display displayCtrl IDC_PLAYEREQUIPMENTLIST;
|
|
private _lockerItems = _display displayCtrl IDC_LOCKEREQUIPMENTLIST;
|
|
private _selectedItem = lbCurSel _lockerItems;
|
|
private _selectedItemData = _lockerItems lbData _selectedItem;
|
|
|
|
private _data = call compile _selectedItemData;
|
|
// private _locker = player getVariable ["FORGE_Locker", []];
|
|
private _locker = GETVAR(player,FORGE_Locker,[]);
|
|
|
|
if ((isNil { _data })) exitWith { ctrlEnable [IDC_EQUIPBUTTON, true]; };
|
|
|
|
private _itemType = _data select 0;
|
|
private _item = _data select 1;
|
|
private _clear = true;
|
|
|
|
switch (_itemType) do {
|
|
case "backpack": {
|
|
if (isNull (unitBackpack player)) then {
|
|
player addBackpack _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have a backpack equipped!";
|
|
["You already have a backpack equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "facewear": {
|
|
if (goggles player == "") then {
|
|
player addGoggles _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have facewear equipped!";
|
|
["You already have facewear equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "headgear": {
|
|
if (headgear player == "") then {
|
|
player addHeadgear _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have headgear equipped!";
|
|
["You already have headgear equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "hmd": {
|
|
if (hmd player == "") then {
|
|
player linkItem _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have a HMD equipped!";
|
|
["You already have a HMD equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "item": {
|
|
if (player canAdd _item) then {
|
|
player addItem _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You don't have enough space left!";
|
|
["You don't have enough space left!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "magazine": {
|
|
if (player canAdd (_item select 0)) then {
|
|
player addMagazine [(_item select 0), (_item select 1)];
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You don't have enough space left!";
|
|
["You don't have enough space left!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "uniform": {
|
|
if (uniform player == "") then {
|
|
player forceAddUniform _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have a uniform equipped!";
|
|
["You already have a uniform equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
case "vest": {
|
|
if (vest player == "") then {
|
|
player addVest _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
// hintSilent "You already have a vest equipped!";
|
|
["You already have a vest equiped!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
// case "weapon": {
|
|
// if (!(getNumber (configFile >> "CfgWeapons" >> _item >> "type") == 131072) &&
|
|
// {!(getNumber (configFile >> "CfgWeapons" >> _item >> "type") == 1) || primaryWeapon player == ""} &&
|
|
// {!(getNumber (configFile >> "CfgWeapons" >> _item >> "type") == 2) || handgunWeapon player == ""} &&
|
|
// {!(getNumber (configFile >> "CfgWeapons" >> _item >> "type") == 4) || secondaryWeapon player == ""}) then {
|
|
|
|
// private _compatibleMags = getArray (configFile >> "CfgWeapons" >> _item >> "magazines");
|
|
// private _baseType = (_compatibleMags select 0) select [0, (_compatibleMags select 0) find "_Tracer"];
|
|
|
|
// if (_baseType == "") then { _baseType = _compatibleMags select 0 };
|
|
|
|
// private _magIndices = [];
|
|
// {
|
|
// if ((_x select 0) == "magazine") then {
|
|
// private _magClass = (_x select 1) select 0;
|
|
|
|
// if ((_magClass in _compatibleMags ||
|
|
// {("ACE_" in _magClass) && {_baseType in _magClass}}) &&
|
|
// {player canAdd _magClass}) then {
|
|
// player addMagazine [_magClass, (_x select 1) select 1];
|
|
// _magIndices pushBack _forEachIndex;
|
|
// };
|
|
// };
|
|
// } forEach _locker;
|
|
|
|
// reverse _magIndices;
|
|
// {
|
|
// _locker deleteAt _x;
|
|
// } forEach _magIndices;
|
|
|
|
// player addWeapon _item;
|
|
// playSound "FD_Finish_F";
|
|
// } else {
|
|
// _clear = false;
|
|
// // hintSilent "You don't have enough space left!";
|
|
// ["You don't have enough space left!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
// playSound "FD_CP_Not_Clear_F";
|
|
// };
|
|
// };
|
|
case "weapon": {
|
|
private _weaponType = getNumber (configFile >> "CfgWeapons" >> _item >> "type");
|
|
private _hasSpace = switch (_weaponType) do {
|
|
case 1: {primaryWeapon player == ""}; // Primary
|
|
case 2: {handgunWeapon player == ""}; // Handgun
|
|
case 4: {secondaryWeapon player == ""}; // Launcher
|
|
case 131072: {false}; // Binoculars
|
|
default {true};
|
|
};
|
|
|
|
if (_hasSpace) then {
|
|
private _compatibleMags = getArray (configFile >> "CfgWeapons" >> _item >> "magazines");
|
|
private _baseType = (_compatibleMags select 0) select [0, (_compatibleMags select 0) find "_Tracer"];
|
|
if (_baseType == "") then {_baseType = _compatibleMags select 0};
|
|
|
|
private _magIndices = [];
|
|
{
|
|
if ((_x select 0) == "magazine") then {
|
|
private _magClass = (_x select 1) select 0;
|
|
if ((_magClass in _compatibleMags || {("ACE_" in _magClass) && {_baseType in _magClass}}) &&
|
|
{player canAdd _magClass}) then {
|
|
player addMagazine [_magClass, (_x select 1) select 1];
|
|
_magIndices pushBack _forEachIndex;
|
|
};
|
|
};
|
|
} forEach _locker;
|
|
|
|
reverse _magIndices;
|
|
{_locker deleteAt _x} forEach _magIndices;
|
|
|
|
player addWeapon _item;
|
|
playSound "FD_Finish_F";
|
|
} else {
|
|
_clear = false;
|
|
["You don't have enough space left!", "warning", 3, "right"] call EFUNC(misc,notify);
|
|
playSound "FD_CP_Not_Clear_F";
|
|
};
|
|
};
|
|
};
|
|
|
|
if (_clear) then {
|
|
lbClear _lockerItems;
|
|
lbClear _playerItems;
|
|
_lockerItems lbSetCurSel -1;
|
|
_playerItems lbSetCurSel -1;
|
|
|
|
private _index = _locker findIf { _x isEqualTo _data };
|
|
|
|
_locker deleteAt _index;
|
|
// player setVariable ["FORGE_Locker", _locker, true];
|
|
SETPVAR(player,FORGE_Locker,_locker);
|
|
|
|
[] call FUNC(fetchLocker);
|
|
[] call FUNC(fetchPlayer);
|
|
|
|
ctrlEnable [IDC_EQUIPBUTTON, true];
|
|
}; |